BUG in updating Nat Network configuration: parameter Network CIDR

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Sagypt
Posts: 51
Joined: 16. Apr 2012, 15:46

BUG in updating Nat Network configuration: parameter Network CIDR

Post by Sagypt »

VirtualBox version 6.1.36

BUG in updating Nat Network configuration: parameter Network CIDR
 Edit: Changing the parameter Network CIDR does not affect the correct configuration of the DHCP server active on the NAT network.
The IP address of the DHCP server and the range of addresses served are not updated. 
********** Walkthrough **********

Open VirtualBox Manager

VirtualBox Manager > File > Preferences > Network > Adds new NAT network
VirtualBox Manager > File > Preferences > Network > Edit selected NAT network (see screnshot_01.png)
screenshot_01.png
screenshot_01.png (122.42 KiB) Viewed 2152 times

Code: Select all

cat /home/sagypt/.config/VirtualBox/VirtualBox.xml

Code: Select all

...
<NATNetworks>
  <NATNetwork networkName="TestNatNetwork" network="10.0.0.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>
...
Assign TestNatNetwork to a VM

Start VM

Code: Select all

CMD > ipconfig

Code: Select all

Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : fritz.box
   Link-local IPv6 Address . . . . . : fe80::5801:f08d:62b6:3969%6
   IPv4 Address. . . . . . . . . . . : 10.0.0.4
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.0.0.1

(Windows) VM Network settings ... OK!

Close VM

Code: Select all

cat /home/sagypt/.config/VirtualBox/VirtualBox.xml

Code: Select all

...
<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="TestNatNetwork" IPAddress="10.0.0.3" networkMask="255.255.255.0" lowerIP="10.0.0.4" upperIP="10.0.0.254" enabled="1">
	<Options>
	  <Option name="3" value="10.0.0.1"/>
	  <Option name="6" value="192.168.0.1"/>
	  <Option name="15" value="fritz.box"/>
	</Options>
  </DHCPServer>
</DHCPServers>
<NATNetworks>
  <NATNetwork networkName="TestNatNetwork" network="10.0.0.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>
...

Code: Select all

cat /home/sagypt/.config/VirtualBox/TestNatNetwork-Dhcpd.config

Code: Select all

<?xml version="1.0"?>
<DHCPServer networkName="TestNatNetwork" trunkType="whatever" IPAddress="10.0.0.3" lowerIP="10.0.0.4" upperIP="10.0.0.254" leasesFilename="/home/sagypt/.config/VirtualBox/TestNatNetwork-Dhcpd.leases" networkMask="255.255.255.0">
  <Options>
    <Option name="1" encoding="0" value="255.255.255.0"/>
    <Option name="3" encoding="0" value="10.0.0.1"/>
    <Option name="6" encoding="0" value="192.168.0.1"/>
    <Option name="15" encoding="0" value="fritz.box"/>
  </Options>
</DHCPServer>
VirtualBox Manager > File > Preferences > Network > Edit selected NAT network (see screnshot_02.png)
screenshot_02.png
screenshot_02.png (124.04 KiB) Viewed 2152 times

Start VM

Code: Select all

CMD > ipconfig

Code: Select all

Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : fritz.box
   Link-local IPv6 Address . . . . . : fe80::5801:f08d:62b6:3969%6
   IPv4 Address. . . . . . . . . . . : 10.0.0.4
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.10.10.1

(Windows) VM Network settings ... KO!

Close VM

Code: Select all

cat /home/sagypt/.config/VirtualBox/VirtualBox.xml
...
<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="TestNatNetwork" IPAddress="10.0.0.3" networkMask="255.255.255.0" lowerIP="10.0.0.4" upperIP="10.0.0.254" enabled="1">
<Options>
<Option name="3" value="10.10.10.1"/>
<Option name="6" value="192.168.0.1"/>
<Option name="15" value="fritz.box"/>
</Options>
</DHCPServer>
</DHCPServers>
<NATNetworks>
<NATNetwork networkName="TestNatNetwork" network="10.10.10.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>
...

Code: Select all

cat /home/sagypt/.config/VirtualBox/TestNatNetwork-Dhcpd.config
<?xml version="1.0"?>
<DHCPServer networkName="TestNatNetwork" trunkType="whatever" IPAddress="10.0.0.3" lowerIP="10.0.0.4" upperIP="10.0.0.254" leasesFilename="/home/sagypt/.config/VirtualBox/TestNatNetwork-Dhcpd.leases" networkMask="255.255.255.0">
<Options>
<Option name="1" encoding="0" value="255.255.255.0"/>
<Option name="3" encoding="0" value="10.10.10.1"/>
<Option name="6" encoding="0" value="192.168.0.1"/>
<Option name="15" encoding="0" value="fritz.box"/>
</Options>
</DHCPServer>
Delete some files ...

Code: Select all

rm -rf /home/sagypt/.config/VirtualBox/TestNatNetwork*
Start VM

Code: Select all

CMD > ipconfig

Code: Select all

Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : fritz.box
   Link-local IPv6 Address . . . . . : fe80::5801:f08d:62b6:3969%6
   IPv4 Address. . . . . . . . . . . : 10.0.0.4
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.10.10.1

(Windows) VM Network settings ... KO!

Close VM

Code: Select all

cat /home/sagypt/.config/VirtualBox/VirtualBox.xml
...
<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="TestNatNetwork" IPAddress="10.0.0.3" networkMask="255.255.255.0" lowerIP="10.0.0.4" upperIP="10.0.0.254" enabled="1">
<Options>
<Option name="3" value="10.10.10.1"/>
<Option name="6" value="192.168.0.1"/>
<Option name="15" value="fritz.box"/>
</Options>
</DHCPServer>
</DHCPServers>
<NATNetworks>
<NATNetwork networkName="TestNatNetwork" network="10.10.10.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>
...
(Recreated by VirtualBox Manager)

Code: Select all

cat /home/sagypt/.config/VirtualBox/TestNatNetwork-Dhcpd.config
<?xml version="1.0"?>
<DHCPServer networkName="TestNatNetwork" trunkType="whatever" IPAddress="10.0.0.3" lowerIP="10.0.0.4" upperIP="10.0.0.254" leasesFilename="/home/sagypt/.config/VirtualBox/TestNatNetwork-Dhcpd.leases" networkMask="255.255.255.0">
<Options>
<Option name="1" encoding="0" value="255.255.255.0"/>
<Option name="3" encoding="0" value="10.10.10.1"/>
<Option name="6" encoding="0" value="192.168.0.1"/>
<Option name="15" encoding="0" value="fritz.box"/>
</Options>
</DHCPServer>
OPS ... something doesn't works in VirtualBox Manager!

********** WORKAROUND **********

Close VirtualBox Manager

Delete some files ...

Code: Select all

rm -rf /home/sagypt/.config/VirtualBox/TestNatNetwork*
Edit manually /home/sagypt/.config/VirtualBox/VirtualBox.xml
...
<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="TestNatNetwork" IPAddress="10.10.10.3" networkMask="255.255.255.0" lowerIP="10.10.10.4" upperIP="10.10.10.254" enabled="1">
<Options>
<Option name="3" value="10.10.10.1"/>
<Option name="6" value="192.168.0.1"/>
<Option name="15" value="fritz.box"/>
</Options>
</DHCPServer>
</DHCPServers>
<NATNetworks>
<NATNetwork networkName="TestNatNetwork" network="10.10.10.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>
...
Start VirtualBox Manager

Start VM

Code: Select all

CMD > ipconfig

Code: Select all

Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : fritz.box
   Link-local IPv6 Address . . . . . : fe80::5801:f08d:62b6:3969%6
   IPv4 Address. . . . . . . . . . . : 10.10.10.4
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.10.10.1

(Windows) VM Network settings ... OK!
Last edited by Sagypt on 14. Aug 2022, 21:27, edited 2 times in total.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: BUG in updating Nat Network configuration: parameter Network CIDR

Post by scottgus1 »

It was a bit hard to follow where you were going, could have used a tl;dr. But it appears that you made and used a NAT Network, then changed the IP range after you used it, and the DHCP server assigned to that NAT Network didn't follow the changes. This is known behavior, see Virtualbox Networks: In Pictures: NAT network . Whether it is a bug will have to be determined by the devs. You can present this on the Bugtracker.
Sagypt
Posts: 51
Joined: 16. Apr 2012, 15:46

Re: BUG in updating Nat Network configuration: parameter Network CIDR

Post by Sagypt »

Right!

OK, I haven't read all the documentation.
The same correction I made manually could be done through commands:

Code: Select all

VBoxManage list dhcpservers

Code: Select all

VBoxManage dhcpserver modify --network="NatNetwork" --server-ip=10.10.10.3 --lower-ip=10.10.10.4 --upper-ip=10.10.10.254 --netmask=255.255.255.0
... but for me the bug remains! The update of the parameter Network CIDR via GUI - in my example 10.10.10.0/24 - must be reflected on the configuration of the NAT network as a whole.
<DHCPServers>
...
<DHCPServer networkName="NatNetwork" IPAddress="10.10.10.3" networkMask="255.255.255.0" lowerIP="10.10.10.4" upperIP="10.10.10.254" enabled="1">
<Options>
<Option name="3" value="10.10.10.1"/>
<Option name="6" value="192.168.0.1"/>
<Option name="15" value="fritz.box"/>
</Options>
</DHCPServer>
</DHCPServers>
<NATNetworks>
<NATNetwork networkName="NatNetwork" network="10.10.10.0/24" ipv6="0" ipv6prefix="fd17:625c:f037:2::/64" advertiseDefaultIPv6Route="0" needDhcp="1" enabled="1">
...
</NATNetwork>
</NATNetworks>
Post Reply