1

I have a LAN with 2 PC, one of the PC is a vmware workstation host. I installed a virtual machine behind NAT. (I do not want Bridge.) I set the port forwarding (22 SSH) in the vmware virtual network editor. I can ssh into the virtual machine from the host, but can not from the another machine. (openssh is installed). My guess is the PC does not know the route. How to solve this problem?

  • 1
    Add a route? The method depends on the OS... – acejavelin May 2 '18 at 11:45
  • I am not good at adding route. Where to add it. In the PC or in the router. I can SSH between the 2 PC both are Ubuntu. Based on the the trace route I should add in the router, because it leaves the LAN network after the LAN gateway. Can you explain it why? – István Radics May 2 '18 at 11:59
  • The host and VM share the same visibile IP address... If the host has a service on port 22, the guest cannot use it as well. You need to do splir port forwarding, maybe 8022 on visible side and 22 on private side, or change the port you are using for ssh entirely on the guest. – acejavelin May 2 '18 at 12:19
  • I managed to change the ssh port on the virtual machine and I could connect from the host successfully, but still no luck with the other PC. I put in the routing table of the router a new route dest: 192.168.108.138 mask 255.255.255.255 GW:vm_host_pc. The traceroute stopped at the GW and nothing... – István Radics May 2 '18 at 13:03
1

Last advice: I imitated your setup in both VirtualBox & VMware Workstation and I can connect to VM from PC1(192.168.1.11) & PC2(192.168.1.12) using 192.168.1.12:8022, NAT port forwarding host port 8022 guest port 22, VM IP in VBox 10.0.2.15, VMware 192.168.2.11. No route was added.

-1

First check that your firewall is not blocking the port. Next set up port forwarding in your router. I see in your comment above that you've put 255.255.255.255 as the gwateway - that wont work. Put the gateway to something like 255.255.255.0, if the other pc is in the same subne. It will work if machine 1 has eg. IP 172.25.68.4 and machine 2 172.25.68.44, but not if machine 2 has IP 172.25.69.4 - than you'd need to set a subent mask of 255.255.0.0

  • Hi and93hil. I have a simple home network with 2 pc and a router. PC1 192.168.137.100 PC2 192.168.137.105. And PC2 has a virtual machine behind NAT. VPC 192.168.108.138. I used the 255.255.255.255 because I gave a the specific dest VIP. I still not understand this subnet thing, but I would like to force the PC1 to search the VPC under the PC2. According the the traceroute from PC1 toward VPC it search the VPC outside the LAN. – István Radics May 2 '18 at 13:29
  • either give your virtual PC a IP adress 192.168.137.xxx or set the subnet to 255.255.0.0 – and93hil May 2 '18 at 15:53
  • Can you explain , why will see the other net, if I set the mask for. 255.255.0.0 The number of host will increase, so will see the router every IP after 192.168.x.x, but what if if I have more network? – István Radics May 3 '18 at 12:13
  • that's how subnet masks work. alternative is that you create a route to the other net with your router /switch. – and93hil May 9 '18 at 14:52
  • Finally I managed to reach the VM behind NAT. I used the port forwarding solution. Still a bit strange to use the VM host IP to reach the VM guest. This link was useful: ask.xmodulo.com/access-nat-guest-from-host-virtualbox.html – István Radics May 15 '18 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.