VirtualBox

#21714 closed defect (duplicate)

DHCP engine of the NatNetwork doesn't read/get host's DNS settings to pass to the guest.

Reported by: Farhad Owned by:
Component: network/NAT Version: VirtualBox-7.0.8
Keywords: DNS, DHCP, NatNetwork Cc:
Guest type: Linux Host type: Mac OS X

Description (last modified by Farhad)

When I set the VM to be on the NatNetwork, Neither my host DNS list nor my home router's DNS list is provided to the guest via DHCP.

Below is the DHCP configuration after it got created. You can see there's no 6/legacy: in it.

❯ VBoxManage list dhcpservers
NetworkName:    NatNetwork
Dhcpd IP:       10.0.2.3
LowerIPAddress: 10.0.2.4
UpperIPAddress: 10.0.2.254
NetworkMask:    255.255.255.0
Enabled:        Yes
Global Configuration:
    minLeaseTime:     default
    defaultLeaseTime: default
    maxLeaseTime:     default
    Forced options:   None
    Suppressed opts.: None
        1/legacy: 255.255.255.0
        3/legacy: 10.0.2.1
Groups:               None
Individual Configs:   None

Below is what I get in the guest OS and the content of the /etc/resolv.conf is empty.

$nslookup google.com
;; communications error to ::1#53: connection refused
;; communications error to 127.0.0.1#53: connection refused
;; no servers could be reached

I can ping IP addresses though.

This is the result guest OS requesting DHCP in which there's no DNS settings:

$sudo nmap --script broadcast-dhcp-discover
[sudo] password for farhad: 
Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-06 22:54 CEST
Pre-scan script results:
| broadcast-dhcp-discover: 
|   Response 1 of 1: 
|     Interface: enp0s3
|     IP Offered: 10.0.2.10
|     Server Identifier: 10.0.2.3
|     DHCP Message Type: DHCPOFFER
|     Subnet Mask: 255.255.255.0
|     Router: 10.0.2.1
|_    IP Address Lease Time: 10m00s
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 10.38 seconds

When I modify the DHCP on the host via VBoxManage dhcpserver modify --network NatNetwork --set-opt 6 1.1.1.1,8.8.8.8 and restarting it via vboxmanage dhcpserver restart --netname NatNetwork, then the DNS settings will show up in its configuratio, DHCP engine passes the values to the guest, and works as expected. Here are the results:

❯ VBoxManage list dhcpservers
NetworkName:    NatNetwork
Dhcpd IP:       10.0.2.3
LowerIPAddress: 10.0.2.4
UpperIPAddress: 10.0.2.254
NetworkMask:    255.255.255.0
Enabled:        Yes
Global Configuration:
    minLeaseTime:     default
    defaultLeaseTime: default
    maxLeaseTime:     default
    Forced options:   None
    Suppressed opts.: None
        1/legacy: 255.255.255.0
        3/legacy: 10.0.2.1
        6/legacy: 1.1.1.1,8.8.8.8
Groups:               None
Individual Configs:   None
$cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 1.1.1.1
nameserver 8.8.8.8
$sudo nmap --script broadcast-dhcp-discover
Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-06 22:59 CEST
Pre-scan script results:
| broadcast-dhcp-discover: 
|   Response 1 of 1: 
|     Interface: enp0s3
|     IP Offered: 10.0.2.10
|     Server Identifier: 10.0.2.3
|     DHCP Message Type: DHCPOFFER
|     Subnet Mask: 255.255.255.0
|     Router: 10.0.2.1
|     Domain Name Server: 1.1.1.1, 8.8.8.8
|_    IP Address Lease Time: 10m00s
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 10.34 seconds

Also, in the Bridged mode, the guest receives all the DNS list I have registered on my home router.

I have attached my VM logs for both cases (DHCP with --set-opt and without it) to this ticket.

Thank you for your attention to this matter.

Attachments (1)

VM-logs.zip (92.4 KB ) - added by Farhad 18 months ago.
VM logs for both DHCP default and modified cases

Download all attachments as: .zip

Change History (4)

by Farhad, 18 months ago

Attachment: VM-logs.zip added

VM logs for both DHCP default and modified cases

comment:1 by Farhad, 18 months ago

Description: modified (diff)

ETA: Grammsr correction and some formattings.

comment:2 by Farhad, 18 months ago

Description: modified (diff)

2nd edit: Apparently formatting doesn't work in the code block - reverted them back.

comment:3 by aeichner, 16 months ago

Resolution: duplicate
Status: newclosed

Duplicate of #21713.

Note: See TracTickets for help on using tickets.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette