1.3. How to allow access to a VMware Virtual Machine (NAT) from remote computer

If you are running WebSphere Application Server V8.0 in a virtual machine on host computer, you may want to access that virtual machine from a remote computer.

For example: you have a SLES 11 virtual machine with installed WebSphere Application Server V8.0. The sshd is running on port 22, and you want to access your VM from other remote computer on the same network.

Assume that the SLES 11 virtual machine was added a NAT network adapter, and it has been assigned an IP address of 192.168.87.128:

test317:~ # ifconfig

eth2      Link encap:Ethernet  HWaddr 08:00:27:FC:B8:A1
          inet addr:192.168.87.128  Bcast:192.168.87.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fefc:b8a1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:34470 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32177 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3831460 (3.6 Mb)  TX bytes:2515311 (2.3 Mb)

eth3      Link encap:Ethernet  HWaddr 08:00:27:95:10:03
          inet addr:192.168.206.128  Bcast:192.168.206.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe95:1003/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1972 errors:0 dropped:0 overruns:0 frame:0
          TX packets:597 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:219335 (214.1 Kb)  TX bytes:63101 (61.6 Kb)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1977 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1977 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:199116 (194.4 Kb)  TX bytes:199116 (194.4 Kb)
					

The host computer (Windows XP) has an IP address 172.16.3.209:


Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . : iba
        Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller
        Physical Address. . . . . . . . . : F4-6D-04-65-FF-91
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 172.16.3.209
        Subnet Mask . . . . . . . . . . . : 255.255.240.0
        Default Gateway . . . . . . . . . : 172.16.0.3
        DHCP Server . . . . . . . . . . . : 172.16.0.1
        DNS Servers . . . . . . . . . . . : 172.16.0.1
                                            172.16.0.2
        Primary WINS Server . . . . . . . : 172.16.0.1
        Lease Obtained. . . . . . . . . . : 18 мая 2013 10:29:42
        Lease Expires . . . . . . . . . . : 20 мая 2013 10:29:42


Ethernet adapter VMware Network Adapter VMnet1:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet1
        Physical Address. . . . . . . . . : 00-50-56-C0-00-01
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.206.1
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :

Ethernet adapter VMware Network Adapter VMnet8:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet8
        Physical Address. . . . . . . . . : 00-50-56-C0-00-08
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.87.1
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :
					

First, open the VMware Workstation menu Edit > Virtual Network Editor...:

Figure 1.6. 


Select the NAT network adapter and click the NAT Settings... button:

Figure 1.7. 


Click the Add button to add port forwarding rule.

Figure 1.8. 


Let's assume that on host OS (Windows XP) the listening port for external access will be 10022. And that incoming packets will be forwarded to 192.168.87.128 (this is an IP address of NAT network adapter on SLES 11 VM), port 22 of the SLES 11 VM:

Figure 1.9. 


It should look like this.

Figure 1.10. 


Now, start VM.

On remote computer, configure SSH client to access the host machine (with IP address 172.16.3.209) on port 10022, instead of traditional 22:

Figure 1.11. 


You successfully logged in to SLES 11 virtual machine:

Figure 1.12. 


If you wish to run some applications, like IBM Installation Manager (IIM) in GUI mode, then you need to run X Window server on remote computer (for example, Xming Server):

Figure 1.13. 


Also, you need to configure X11 port forwarding on SSH client on remote computer:

Figure 1.14. 


Test GUI by running xeyes application.

Figure 1.15. 


Now, you're all set !

Professional hosting         Free 'Oracle Certified Expert Web Services Developer 6' Guide     Free SCDJWS 5.0 Guide