DHCP issue with jumpbox in a NAT network

This is for discussing general topics about how to use VirtualBox.
Post Reply
jamieburns0
Posts: 1
Joined: 13. Apr 2024, 08:27

DHCP issue with jumpbox in a NAT network

Post by jamieburns0 »

Running into a DHCP issue setting up a jumpbox in a NAT network. Here are my VBoxManage commands.

Code: Select all

$env:VM_NAME="jumpbox1"
$env:NETWORK_NAME="natnet1"

VBoxManage.exe natnetwork add --netname $env:NETWORK_NAME --network "10.0.10.0/27" --enable --dhcp on
VBoxManage.exe dhcpserver add --network $env:NETWORK_NAME --netmask 255.255.255.224 --server-ip 10.0.10.3 --lower-ip 10.0.10.5 --upper-ip 10.0.10.30

VBoxManage.exe dhcpserver start --network $env:NETWORK_NAME
VBoxManage.exe natnetwork start --netname $env:NETWORK_NAME
At this point I believe I've created and started a NAT Service network with a DHCP server that is reserving address 10.0.10.4 for my jumpbox.

Code: Select all

VBoxManage.exe list natnetworks
Name:         natnet1
Network:      10.0.10.0/27
Gateway:      10.0.10.1
DHCP Server:  Yes
IPv6:         No
IPv6 Prefix:  fd17:625c:f037:2::/64
IPv6 Default: No

VBoxManage.exe list dhcpservers
NetworkName:    natnet1
Dhcpd IP:       10.0.10.3
LowerIPAddress: 10.0.10.5
UpperIPAddress: 10.0.10.30
NetworkMask:    255.255.255.224
Enabled:        No
Global Configuration:
    minLeaseTime:     default
    defaultLeaseTime: default
    maxLeaseTime:     default
    Forced options:   None
    Suppressed opts.: None
        1/legacy: 255.255.255.224
        3/legacy: 10.0.10.1
        6/legacy: 192.168.86.1
       15/legacy: lan
Groups:               None
Individual Configs:   None

Code: Select all

VBoxManage.exe createvm --name $env:VM_NAME --ostype Linux_64 --register
VBoxManage.exe modifyvm $env:VM_NAME --audio-enabled off --usb-ehci off --usb-ohci off --usb-xhci off --cpus 1 --nictype1 82540EM --nic1 natnetwork --nat-network1 $env:NETWORK_NAME --natpf1 "guestssh,tcp,127.0.0.1,1022,,22"
VBoxManage.exe dhcpserver modify --network $env:NETWORK_NAME --vm $env:VM_NAME --fixed-address 10.0.10.4
At this point i believe I have a VM called "jumpbox1" that will be statically assigned 10.0.10.4 with port-forwarding that will allow me to ssh on port 1022.

When i run setup in my VM, it fails to get a DHCP lease

Code: Select all

Available interfaces are: eth0.
...
Which one do you want to initialize? ... [eth0]
Ip address for eth0? (or 'dchp', ...) [dhcp]
Do you want to do any manual network configuration? (y/n) [n]
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: broadcasting discover
... (3 more times)
udhcpc failed to get a DHCP lease
If i drop the dhcpserver commands above, a DHCP lease is obtained.

Code: Select all

...
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: broadcasting select for 10.0.10.4, server 10.0.10.3
udhcpc: lease of 10.0.10.4 obtained from 10.0.10.3, ...
Am i misunderstanding the relationship between natnetwork and dhcpserver ?
Post Reply