I have a physical host machine running Ubuntu 20.4LTS (fully patched) attached to my network, which retrieves it's IP address via DHCP. This works.
I have a VirtualBox VM on that host attached to a bridged interface (macvlan on the physical NIC) that is trying to obtain an IP address from the same DHCP server.
Using tcpdump -i ethXXX port 67 or port 68 -e -n -vv
on the Host, I see multiple repeats of this message going out:
15:04:52.845988 66:66:66:66:66:12 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 66:66:66:66:66:12, length 300, xid 0x84ce756d, secs 6, Flags [none] (0x0000)
Client-Ethernet-Address 66:66:66:66:66:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Hostname Option 12, length 6: "nodename"
Parameter-Request Option 55, length 17:
Subnet-Mask, BR, Time-Zone, Default-Gateway
Domain-Name, Domain-Name-Server, Option 119, Hostname
Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
NTP, Classless-Static-Route-Microsoft, Static-Route, Option 252
RP
and on the DHCP server, I see it come in, and a reply sent out:
15:05:57.193384 66:66:66:66:66:12 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 66:66:66:66:66:12, length 300, xid 0xcede823f, secs 22, Flags [none] (0x0000)
Client-Ethernet-Address 66:66:66:66:66:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Hostname Option 12, length 6: "nodename"
Parameter-Request Option 55, length 17:
Subnet-Mask, BR, Time-Zone, Default-Gateway
Domain-Name, Domain-Name-Server, Option 119, Hostname
Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
NTP, Classless-Static-Route-Microsoft, Static-Route, Option 252
RP
15:05:57.193585 00:0c:29:cc:f8:f6 > 66:66:66:66:66:12, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
10.0.0.20.67 > 10.0.0.180.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0xcede823f, secs 22, Flags [none] (0x0000)
Your-IP 10.0.0.180
Client-Ethernet-Address 66:66:66:66:66:12
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Offer
Server-ID Option 54, length 4: 10.0.0.20
Lease-Time Option 51, length 4: 14400
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 10.0.0.20
Domain-Name Option 15, length 17: "my.domain.for.dhcp"
Domain-Name-Server Option 6, length 4: 10.0.0.20
What I do not see is the reply arriving at the Host (or at the requesting VM, obviously).
I had originally thought this was a VirtualBox problem, but now I am thinking there is some othher setting I am missing in Linux to allow layer 2 messages to macvlan
MAC addresses to be routed correctly.
I do have ip_forward
set to 1 in /proc/sys/net/ipv4/ip_forward
.
Edit:
The commands used to set up the macvlan
connection are:
ip link add mvlan_bn_bld2 link eth_int type macvlan mode bridge
ip link set mvlan_bn_bld2 up
ip link set mvlan_bn_bld2 address 66:66:66:66:66:12 up
And the MAC of the VM NIC is set to match mvlan_bn_bld2.
Edit: Turns out to be the result of a faulty driver/NIC. See this post for a more broad discussion.