KarelS
KarelS

Reputation: 1

how to network to and from local VM (fusion) with fixed IP on mac os host

I am running a VM (Debian) on MacOs using VMware Fusion. The VM has fixed IP address (required) and the networking is bridged. It all works very well in my local network under 192.168.1.XXX ip range. The problem is when I leave home and connect to internet via 4G or some public wifi etc. In this situation my Host OS (Mac) obviously gets a different ip address and the VM (Debian) becomes inaccessible from the host mac os. I would really like to be able to keep the VM on the fixed 192.168.1.XXX address even outside of my home network. That is to be able to connect to the guest from the host and also to connect from the guest to the outside internet (as I am able to do when on the home network). Could you please advise on ways how to achieve that. Thank you.

EDIT1: More googling gained this link .. I followed the steps and created adapter as per the screenshot attached. I am now able to ssh to the VM from the MacOs host (progress!), however the connectivity from the Debian VM to the internet still does not work. Ping 8.8.8.8 fails. My network setup on the Debian VM is:

/etc/network/interfaces:

auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.177
    netmask 255.255.255.0
    gateway 192.168.1.1

/etc/resolv.conf:

nameserver 192.168.1.1
nameserver 8.8.4.4

EDIT2:

netstat -nr on the host:

Destination        Gateway            Flags        Refs      Use   Netif Expire
default            172.20.10.1        UGSc          141       64     en0
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH              5      420     lo0
169.254            link#10            UCS             0        0     en0      !
172.16.37/24       link#19            UC              2        0  vmnet1      !
172.16.37.255      ff:ff:ff:ff:ff:ff  UHLWbI          0        9  vmnet1      !
172.20.10/28       link#10            UCS             1        0     en0      !
172.20.10.1/32     link#10            UCS             1        0     en0      !
172.20.10.1        XXXXXXXXXXXXXXXXX  UHLWIir        56      440     en0   1192
172.20.10.6/32     link#10            UCS             0        0     en0      !
172.20.10.15       ff:ff:ff:ff:ff:ff  UHLWbI          0        9     en0      !
192.168.1          link#20            UC              2        0  vmnet3      !
192.168.1.177      0:50:56:35:35:b    UHLWIi          2      756  vmnet3   1180
192.168.1.255      ff:ff:ff:ff:ff:ff  UHLWbI          0        9  vmnet3      !
192.168.114        link#21            UC              2        0  vmnet8      !
192.168.114.255    ff:ff:ff:ff:ff:ff  UHLWbI          0        9  vmnet8      !
224.0.0/4          link#10            UmCS            2        0     en0      !
224.0.0.251        1:0:5e:0:0:fb      UHmLWI          0        0     en0
239.255.255.250    1:0:5e:7f:ff:fa    UHmLWI          0       54     en0
255.255.255.255/32 link#10            UCS             1        0     en0      !
255.255.255.255    ff:ff:ff:ff:ff:ff  UHLWbI          0      128     en0      !

According to the VMware docs here, the ping from the guest to the outside should "just work" in this setup, but it does not.

Upvotes: 0

Views: 2995

Answers (2)

KarelS
KarelS

Reputation: 1

Talking to VMware support gained a solution that is acceptable. They recommended setup with 2 adapters. This way both ssh into (via one adapter that keeps the same fixed internal IP address) and connections to the internet (second adapter with dhcp) work fine.

Upvotes: 0

eckenrod
eckenrod

Reputation: 529

Try using a host-only or NAT network setup instead of bridged. A bridged adaptor will always give your VM an IP address from whatever wireless/ethernet network your host machine resides in at a given time. Using a host-only or NAT setup should allow you to create a private network between your host and VM in which you can get a static IP for your VM. The link I posted is for VMware Workstation, but the network options should be relevant to Fusion as well.

Upvotes: 1

Related Questions