I created a new nat network with dhcp enable through GUI on my VirtualBox 6.0 and connected 2 Guest VM's to it but keeps assigning the same IP to both VM's even if they are running at the same time.
- Host: Ubuntu Desktop 18.04.
- Guest A: Ubuntu Server 18.04. 08:00:27:33:ac:c6
- Guest B: Ubuntu Server 18.04. 08:00:27:b9:41:77 (cloned from Guest A)
I checked the NatNetwork-Dhcpd.leases file that VirtualBox generates after starting the VM's the first time and saw that leases for both VM's appears as "acked" but got the same IP even though they have different MAC addresses.
<?xml version="1.0"?>
<Leases version="1.0">
<Lease mac="08:00:27:b9:41:77" id="ffe2343f3e00020000ab117f957fa5c66cfffd" network="0.0.0.0" state="acked">
<Address value="10.0.2.4"/>
<Time issued="1565568632" expiration="1200"/>
</Lease>
<Lease mac="08:00:27:33:ac:c6" network="0.0.0.0" state="acked">
<Address value="10.0.2.4"/>
<Time issued="1565568546" expiration="1200"/>
</Lease>
</Leases>
I have also noticed that if I turn off Guest A and the turn it on again then the NatNetwork-Dhcpd.leases removes the id attribute to the lease section of Guest B and adds it to the lease section of Guest A with the exact same value modifying the file as follows:
<?xml version="1.0"?>
<Leases version="1.0">
<Lease mac="08:00:27:b9:41:77" network="0.0.0.0" state="acked">
<Address value="10.0.2.4"/>
<Time issued="1565568632" expiration="1200"/>
</Lease>
<Lease mac="08:00:27:33:ac:c6" id="ffe2343f3e00020000ab117f957fa5c66cfffd" network="0.0.0.0" state="acked">
<Address value="10.0.2.4"/>
<Time issued="1565576544" expiration="1200"/>
</Lease>
</Leases>
My VirtualBox nat network is as follows:
<NetserviceRegistry>
<DHCPServers>
<DHCPServer networkName="HostInterfaceNetworking-vboxnet0" IPAddress="192.168.56.100" networkMask="255.255.255.0" lowerIP="192.168.56.101" upperIP="192.168.56.254" enabled="1"/>
<DHCPServer networkName="NatNetwork" IPAddress="10.0.2.3" networkMask="255.255.255.0" lowerIP="10.0.2.4" upperIP="10.0.2.254" enabled="1">
<Options>
<Option name="3" value="10.0.2.1"/>
<Option name="6" value="10.0.2.1"/>
</Options>
</DHCPServer>
</DHCPServers>
<NATNetworks>
<NATNetwork networkName="NatNetwork" network="10.0.2.0/24" ipv6="0" ipv6prefix="fd17:625c:f037:2::/64" advertiseDefaultIPv6Route="0" needDhcp="1" enabled="1">
<Mappings>
<Loopback4 address="127.0.0.1" offset="2"/>
</Mappings>
</NATNetwork>
</NATNetworks>
</NetserviceRegistry>
Any help would be really appreciated.