Im using the following network declaration to get an IP address for my Windows virtual machines, which is routable inside the same network to corresponding linux VMs made using the same directive. The vagrantfile in question is something like this:
winw1.vm.network "public_network", bridge: "en0: Wi-Fi (Wireless)"
...
linuxvm.vm.network "public_network", bridge: "en0: Wi-Fi (Wireless)"
However these machines wind up having different network properties.
Problem
Simply put: My VMs have totally different network configurations, and this seems to be because windows and linux respond to the bridged network directive in vagrant in totally different ways:
Windows VM configuration
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::c5d8:d6be:4f2f:b3a5%5
IPv4 Address. . . . . . . . . . . : 10.0.2.15
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.2.2
Ethernet adapter Ethernet 2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::4ea:c2c7:63c2:e429%4
Default Gateway . . . . . . . . . :
Ethernet adapter vEthernet (nat):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::d849:5ecb:80c6:41e8%16
IPv4 Address. . . . . . . . . . . : 172.21.16.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
Linux VM configuration
inet 127.0.0.1/8 scope host lo
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
inet 10.0.0.15/24 brd 10.0.0.255 scope global dynamic enp0s8
Conclusion
Using the exact same public_network
stanza for windows server 2019 and linux (ubuntu) VMs, results in different ethernet configurations, and different default IP address ranges.
This means possibly that DHCP doesnt work the same way on these boxes.
Question
Why do my linux VMs have "real" IP addresses in the 10.0.0 network, similar to other machines on my home network, whereas my windows server instances dont seem to get these same 10.0.0.* ip addresses ?
Alternatives
Since this question is complex, i think its worth discussing alternatives, like using private_network solutions.
The private_network
solution doesn't work for me, because I explicitly need vagrant to create VMs where there is one primary IP address and where this primary IP also has a defaultGateway
that is routable.
If there are other alternatives for using vagrant, windows, and linux together in virtualbox with a single bridged network / IP space, feel free to answer accordingly or comment.