I used to promise that I will come out with a procedure to make hercules workable on linux. Now it's time to redeem it. As I don't have a machine running linux to host the hercules, so I'm gonna put it in a Virtualbox virtual machine. And I found it's more interesting using it in this way.
Firstly, download the latest version of Oracle VirtualBox and install it on your laptop/desktop. Then chooose a linux of your favourite. I'm using Ubuntu Desktop 18.04 LTS which was just go alive less than 2 months ago.
VirtualBox VM download link: https://www.virtualbox.org/wiki/Downloads
Ubuntu Linux download link: https://www.ubuntu.com/download
1. Get Your Linux Ready
After installed Ubuntu linux on a VM, issue following command in sequence to get necessary updates and software to run hercules.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc make perl net-tools hercules x3270
then next is to install the VirtualBox Guest Additions in order to copy your z/OS DASD files to Ubuntu.
I put the DASD files in ~/DASD and the config file as ~/ZOS113.txt
Change the network setting of your VM to use Host-only Adapters. This is the most interesting part.
Use the following commands to check readiness of linux.
Prepare the config file ZOS113.txt
For all the DASD file path, it was ../DASD/, as now I'm not putting the config file in a config folder. so this should be changed to ./DASD/
For CTC Adapters, it should be as below here
0E20.2 CTCI /dev/net/tun 1500 192.168.88.88 192.168.88.100 255.255.255.0
Please be noticed that the TCPIP profile I'm using in linux is a little bit different with what I posted at https://blog.csdn.net/tuliangde/article/details/78157764
As the IP address from TCPIP profile should tally with the config file CTC adapter settings. So need to set it up later after power on according to the config file used above as
DEVICE DEFINITION
DEVICE CTC1 CTC E20
LINK CTC1L CTC 0 CTC1
HOME
192.168.88.88 CTC1L
GATEWAY
192.168.88.100 = CTC1L 1500 HOST
DEFAULTNET 192.168.88.100 CTC1L 1500 0
START CTC1
2. Power On
Now, it's time to power it on. use the following command
sudo hercules –f ZOS113.txt
you'll see the terminal changed like this
Press Esc key, it will become an ancient control panel
3. Connect console and IPL
Open another terminal and type x3270, then hit enter.
the x3270 panel will come out and connect it to 127.0.0.1 using port 3270
Go back to the ancient Hercules control panel.
press L key to initiate the IPL
at the bottom, you'll see an prompt that asking for the device for IPL.
This should be 0A80, so check on the device list on the right half of the terminal. the sequence of 0A80 is F. Then press F key, IPL will be fired.
4. Connect to TSO via TCPIP
After the IPL process, you may start another terminal to invoke x3270.
Connect to 192.168.88.88 using port 23.
By now you're good with the TCPIP configuration for local linux usage. what if someone from the other part of the local network is trying to access hercules? Ah, you got it, that's the interesting part I've been talking about.
5. Interesting part
If above configuration already satisfied your requirement. You don't have to read this section. Just jump to Section 6.
Let's first take a look how VirtualBox Host-only network works. When you install VirtualBox on your laptop/desktop (probably in a Windows OS), it installs a VirtualBox Host-Only Network adapter. And sets its IP address as 192.168.56.1 Mask 255.255.255.0
That is to say, VBox help you to created a virtual local area network. All the VMs that is running using Host-Only network mode, is joined in this LAN and given a IP address as 192.168.56.XXX
let's see the default setup of this LAN in VirtualBox Global Tools
By checking the DHCP service here, you'll see the IP range from this LAN. so the Ubuntu within which I'm running hercules, should be given an IP address like this.
Let's see the ifconfig of Ubuntu
From above screenshot we may see, now the Hercules TCPIP network is working on the TUN/TAP device tun0 that is created by hercifc. Is it possible to make it work on device enp0s3 which is physically a real network adapter if you install Ubuntu on a real machine? Absolutely positive.
What is needed to make 2 network adapters talking to each other when they're not in the same network segment? it's IP FORWARDING.
Let's try enable it using below commands
OK, now these 2 device can talk to each other. Our goal is to make Hercules accessible over the host-only networks, which means my Windows host not yet got the idea that tun0 is accessible over the enp0s3 yet. So, we need to add a route to the Windows host.
Run the CMD in windows as administrator, and input this command
route –p add 192.168.88.0 mask 255.255.255.0 192.168.56.101 metric 1
Then use the command in below screenshot to check if route added correctly
route print 192* –4
ping 192.168.88.88
Try connect to 192.168.88.88 port 23 using your 3270 terminal emulator on your Windows. it's working.
If there's enough RAM on your laptop/desktop, try get another VM up running Ubuntu. it should also be able to access the hercules by just adding the route using
sudo route add –net 192.168.88.0 gw 192.168.56.101 netmask 255.255.255.0
and check the route using
netstat –r
6. Shutdown Hercules Properly
Issue S SHUTDOWN on the console, same as you do in windows configuration.
then $PJES2,TERM to purge JES2.
Go back to the ancient hercules control panel. Press P, then W
Confirmation prompt at bottm, press Y to confirm power off.
When you see messages like in above screenshot, it's done.