[VirtualBox 5.1.30 r118389 (Qt5.6.3), HOST: MacBook Pro w/ 10.13.1 (High Sierra), GUEST: Ubuntu 14.04 LTS]
Yes, the changing IP caused DNS problems. I could have managed this using a script in the VM to adjust it's IP/DNS settings according to the network environment it was in, along with some minor (though irritating) adjustments to the Mac's network settings. But would prefer a cleaner solution.
So I have moved away from using the 'bridged network' arrangement and am trying a 'host-only' network approach instead.
As an isolated network, the 'host-only' network is functioning fine, and the configuration is almost ideal. From my Mac HOST, I am able to browse the public Internet (and post this question) as well as browse my locally hosted domains on my guest VM using its DNS server. The only problems that exist are:
1) The VM takes a REALLY long time to get past the network configuration stage of the boot. I don't know why this is happening except that I'm sure it has something to do with not being able to access the Internet. Also,
2) The VM itself cannot access the Internet to get updates etc (I prefer not to setup a NAT interface for this).
(By adding a NAT adapter to the VM, these problems are both solved. However, I really want to get the bridge going as I don't think putting two NICs in each VM is really the right way of going about the issue.)
In order to overcome the second limitation (which may have a positive effect on the first once it's working), I have setup a bridge between the 'vboxnet0' and 'en5' (the wired thunderbolt ethernet adapter on the Mac) interfaces.
However the bridge isn't working, and I cannot ping any host upstream of my Mac HOST.
I created the bridge using the commands below:
Code: Select all
sudo sysctl -w net.inet.ip.forwarding=1
sudo sysctl -w net.inet6.ip6.forwarding=1
sudo sysctl -w net.link.ether.inet.proxyall=1
sudo sysctl -w net.inet.ip.fw.enable=1
sudo ifconfig bridge1 destroy 2>/dev/null #if bridge1 still exists
sudo ifconfig en5 down
sudo ifconfig vboxnet0 down
sudo ifconfig bridge1 create
sudo ifconfig bridge1 addm vboxnet0 addm en5
sudo ifconfig bridge1 up
Whilst the host's IP address on 'vboxnet0' is 192.168.56.1, I have set the IP of the bridge using:
sudo ifconfig bridge1 192.168.56.14 where the .14 is outside the DHCP range assigned by 'vboxnet0'. The DHCP address range is set to 192.168.56..2 - 192.168.56..13, and I have the server itself located on 192.168.56.1. The VM's IP address on the 'vboxnet0' network is 192.168.56.2.
On the guest, I've set the default route to point to 192.168.56.14, so the route table looks like:
Code: Select all
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.56.14 0.0.0.0 UG 0 0 0 eth0
192.168.56.0 * 255.255.255.240 U 0 0 0 eth0
On the Mac, I have cleaned up the route table to the following state:
Code: Select all
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 172.20.11.1 UGSc 46 0 en5
127.0.0.1 127.0.0.1 UH 3 441 lo0
172.20.11/28 link#5 UCS 2 0 en5
172.20.11.1 0:xx:xx:xx:b1:10 UHLWIir 15 93 en5 1026 <<== MAC address here is the mac of the router's interface
192.168.56/28 link#13 UC 3 0 vboxnet
192.168.56.1 a:0:27:0:0:0 UHLWI 0 4 lo0
192.168.56.2 8:0:27:xx:xx:ef UHLWIi 2 1015 vboxnet 1194
192.168.56.14 172.20.11.1 UGHS 0 0 en5
255.255.255.255/32 link#5 UCS 0 0 en5
Internet6:
Destination Gateway Flags Netif Expire
default fe80::%utun0 UGcI utun0
::1 ::1 UHL lo0
fe80::%lo0/64 fe80::1%lo0 UcI lo0
fe80::1%lo0 link#1 UHLI lo0
fe80::%en5/64 link#5 UCI en5
fe80::8e6:xxxx:xxxx:xxx%en5 38:xx:xx:xx:xx:97 UHLI lo0 <<== MAC address here is the thunderbolt
ethernet's adapter mac.
fe80::%utun0/64 fe80::528c:xxxx:xxxx:xxxx%utun0 UcI utun0
fe80::528c:xxxx:xxxx:xxxx%utun0 link#12 UHLI lo0
ff01::%lo0/32 ::1 UmCI lo0
ff01::%en5/32 link#5 UmCI en5
ff01::%en0/32 link#6 UmCI en0
ff01::%utun0/32 fe80::528c:xxxx:xxxx:xxxx%utun0 UmCI utun0
ff02::%lo0/32 ::1 UmCI lo0
ff02::%en5/32 link#5 UmCI en5
ff02::%en0/32 link#6 UmCI en0
ff02::%utun0/32 fe80::528c:xxxx:xxxx:xxxx%utun0 UmCI utun0
In
/etc/resolve.conf, I have:
Code: Select all
nameserver 192.168.56.2
nameserver 172.20.10.1
Assigned through the 'Advanced' settings for the Thunderbolt adapter in 'System Preferences'.
For some reason Mac OS does not always check with the alternative nameservers, it tends to simply use the 1st one. A possible reason for this is that the DNS servers are down different paths from the host; i.e. my private DNS is connected to a local subnet on my laptop, while the normal DNS I use is my internet access point, two hops from my notebook.