2

I sometimes bring my computer to home to work; and every time I do this, I have to check the IP of my VMware CentOS box's IP because I connect with Putty.

The work LAN use 10.160.xx.xx IP range and at home I have 192.168.xx.xx.

I can configure static IP, but I prefer DHCP in these two networks because of the different IP range, and I think there must be some way to do it. Another reason is that I may not log out in the guest box when I switch; I just suspend the machine and when I switch, the previous IP remains(ip addr returns same); I have to log out and login again.

I want to connect the machine with the hostname, not the IP, to prevent changing from one another.

1 Answer 1

0

I assume your host OS is Windows (because of putty).

The way I'd do it is to use VMWare NAT for the VM, which will assign the VM a local IP address valid only on your Laptop, and use NAT (network address translation) to access the outside network using the host's external IP. Then I'd make this assignment permanent, and enter a name for this IP in the Windows hosts file, and you should be able to connect with putty using this name.

Note the VM will not any longer retrieve its IP address via DHCP, but the host still will, and the VM will show up under this IP address in the external network.

If the VM must be accessible from the outside, because there are servers running in it (unlikely), I'd probably try if VMWare supports both a bridged and a host-only (like NAT but without NAT) network adapter at the same time. But I haven't done this, so I'm not sure it will work.

2
  • Eh... it is close to what I want, but the hostname cannot be used for connection? I don't want to sacrifice the possibility of allowing possible company LAN connection(which is very possible) for the convenience of my usage. I imagine something like adding my guest hostname to the company DNS registry and my home router once and for all. I am now with bridged
    – WesternGun
    Commented Jul 2, 2018 at 15:01
  • If you can add the vm guest hostname to your company's DNS registry (make sure to write down the MAC address of the VMs network interface, because it'll get attached to that), and if you do have a home router where you can access the DNS functions (or install OpenWRT etc.), then this is also an option. I didn't mention it because that's two big "if"s. In that case, the only additional thing you have to do is to make sure the MAC address of the VM interface stays the same. Using mDNS instead of DNS is a third option.
    – dirkt
    Commented Jul 2, 2018 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .