Skip to content

DHCP ignores containers mac-address when sending DHCPREQUEST to server #450

@ghost

Description

Hi!

I'm opening this because I'm trying to make a Podman container to join a PFsense LAN network on a bridge using a static DHCP lease. I thought that when podman released 1.7 (supporting setting static mac-addresses) this would be an easy task. I was wrong.

So currently im using the following network config list:

[root@leierpc leier]# cat /etc/cni/net.d/podnet.conflist
{
   "cniVersion": "0.4.0",
   "name": "podnet",
   "plugins": [
      {
         "type": "bridge",
         "bridge": "br0",
         "ipam": {
            "type": "dhcp"
         }
      },
      {
        "type": "tuning",
        "capabilities": {
          "mac": true
      }
      }
   ]
}

And this works from a Podman perspective. It asks for a IP through the dhcp.sock and the mac-address sat is indeed static. From Podmans side of things.

[root@leierpc leier]# podman run -d --net podnet --name="testMac"  --mac-address=3e:84:ea:ab:7d:52 docker.io/library/debian tail -f /dev/null
2020/02/04 19:58:25 5a0841b3f0347378d14ce3f7673da0380a720cf1873bc9a768f98aacc42c9d39/podnet/eth0: acquiring lease
2020/02/04 19:58:26 5a0841b3f0347378d14ce3f7673da0380a720cf1873bc9a768f98aacc42c9d39/podnet/eth0: lease acquired, expiration is 2020-02-04 21:58:26.330024245 +0100 CET m=+13799.752185010
5a0841b3f0347378d14ce3f7673da0380a720cf1873bc9a768f98aacc42c9d39

[root@leierpc leier]# podman exec testMac ip link show 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: eth0@if38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default 
    link/ether 3e:84:ea:ab:7d:52 brd ff:ff:ff:ff:ff:ff link-netnsid 0

But the DHCP plugin (/usr/libexec/cni/dhcp daemon &) does not respect the containers mac-address and presents the DHCP server with a seemingly random mac-address.

[root@leierpc leier]# podman start testMac 
2020/02/04 20:15:24 5a0841b3f0347378d14ce3f7673da0380a720cf1873bc9a768f98aacc42c9d39/podnet/eth0: acquiring lease
2020/02/04 20:15:25 5a0841b3f0347378d14ce3f7673da0380a720cf1873bc9a768f98aacc42c9d39/podnet/eth0: lease acquired, expiration is 2020-02-04 22:15:25.249862644 +0100 CET m=+14818.672023419
testMac

The mac-address on container testMac is currently 3e:84:ea:ab:7d:52 and nowhere to be seen

[root@leierpc leier]# tcpdump -n -i br0
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on br0, link-type EN10MB (Ethernet), capture size 262144 bytes
20:15:24.216490 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 12:9f:61:68:d7:a7, length 326
20:15:24.392415 IP6 :: > ff02::1:ff68:d7a7: ICMP6, neighbor solicitation, who has fe80::109f:61ff:fe68:d7a7, length 32

All help would be appriciated, thanku

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions