Skip to content

netavark: dhcp: cannot add default route when using multiple networks with dhcp ipam-driver #1456

Description

@agorgl

Passing multiple macvlan networks with dhcp ipam-driver in a container, results to:

Error: netavark: unable to obtain lease: dhcp proxy error: status: Unknown, message: "add default route (dest: 0.0.0.0/0 ,gw: 192.168.122.1, metric 100): Netlink error: File exists (os error 17)"

even when we specify to not add a default route in the rest of them.

The problem can be reproduced on a host with 2 network interfaces (in this example enp1s0 and enp7s0) doing the following:

user@test:~$ sudo podman network create --driver macvlan --ipam-driver dhcp --opt parent=enp1s0 macvlan1
macvlan1
user@test:~$ sudo podman network create --driver macvlan --ipam-driver dhcp --opt parent=enp7s0 --opt no_default_route=1 macvlan2
macvlan2
user@test:~$ sudo podman run --name test --replace --rm --network macvlan1 --network macvlan2 caddy:latest
Resolving "caddy" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/library/caddy:latest...
Getting image source signatures
Copying blob 4f4fb700ef54 done   |
Copying blob 6a0ac1617861 done   |
Copying blob 5920de1d55d9 done   |
Copying blob 057c497bda06 done   |
Copying blob 3b55c68e4a0f done   |
Copying config 5190456911 done   |
Writing manifest to image destination
[  651.570571] virtio_net virtio1 enp1s0: entered promiscuous mode
[  654.578605] virtio_net virtio1 enp1s0: left promiscuous mode
[  654.593383] virtio_net virtio6 enp7s0: entered promiscuous mode
[  654.597027] virtio_net virtio6 enp7s0: left promiscuous mode
Error: netavark: unable to obtain lease: dhcp proxy error: status: Unknown, message: "add default route (dest: 0.0.0.0/0 ,gw: 192.168.122.1, metric 100): Netlink error: File exists (os error 17)", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Sun, 31 May 2026 20:13:17 GMT", "content-length": "0"} }

It also can be reproduced using the more modern --interface-name and --internal flags (instead of --opt parent= and --opt no_default_route=1 respectively):

user@test:~$ sudo podman network create --driver macvlan --ipam-driver dhcp --interface-name=enp1s0 macvlan1
macvlan1
user@test:~$ sudo podman network create --driver macvlan --ipam-driver dhcp --interface-name=enp7s0 --internal macvlan2
macvlan2
user@test:~$ sudo podman run --name test --replace --rm --network macvlan1 --network macvlan2 caddy:latest
Resolving "caddy" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/library/caddy:latest...
Getting image source signatures
Copying blob 4f4fb700ef54 done   |
Copying blob 6a0ac1617861 done   |
Copying blob 5920de1d55d9 done   |
Copying blob 057c497bda06 done   |
Copying blob 3b55c68e4a0f done   |
Copying config 5190456911 done   |
Writing manifest to image destination
[  705.398967] virtio_net virtio1 enp1s0: entered promiscuous mode
[  708.406993] virtio_net virtio1 enp1s0: left promiscuous mode
[  708.420220] virtio_net virtio6 enp7s0: entered promiscuous mode
[  708.423986] virtio_net virtio6 enp7s0: left promiscuous mode
Error: netavark: unable to obtain lease: dhcp proxy error: status: Unknown, message: "add default route (dest: 0.0.0.0/0 ,gw: 192.168.122.1, metric 100): Netlink error: File exists (os error 17)", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Sun, 31 May 2026 20:14:11 GMT", "content-length": "0"} }

I think that the root cause is that the dhcp ipam-driver possibly doesn't respect the --opt no_default_route=1 (or the more modern --internal) flag at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions