Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHCP plugin override the default route #698

Closed
MaxThom opened this issue Feb 7, 2022 · 2 comments
Closed

DHCP plugin override the default route #698

MaxThom opened this issue Feb 7, 2022 · 2 comments
Labels

Comments

@MaxThom
Copy link

MaxThom commented Feb 7, 2022

Hi,

I have setup up a macvlan with dhcp with multuscni in our k8s clusters.
Pods receives the ip address from the dhcp and the container is starting normally. The problem is the dhcp add a second default route in the ip tables. This blocks all internet connection because the now default route is the wrong one.
How can I configure multus or the dhcp daemon to not add a second route ?

image

Multus config
{
    "cniVersion": "0.3.1",
    "type": "macvlan",
    "name": "sw-lan",
    "master": "eno1",
    "mode": "bridge",
    "ipam": {
        "type": "dhcp"
    }
}
DHCP Plugin daemon
[Unit]
Description=DHCP Client for CNI

[Socket]
ListenStream=/run/cni/dhcp.sock
SocketMode=0660
SocketUser=root
SocketGroup=root
RemoveOnStop=true

[Install]
WantedBy=sockets.target
[Unit]
Description=DHCP Client CNI Service
Requires=multus.dhcp.socket
After=network.target multus.dhcp.socket

[Service]
Type=simple
ExecStart=/var/lib/rancher/k3s/data/current/bin/dhcp daemon
TimeoutStopSec=30
KillMode=process

[Install]
WantedBy=multi-user.target
Also=multus.dhcp.socket
Annotation on the pods
annotations:
    k8s.v1.cni.cncf.io/networks: networking/sw-lan@sw0
@calh
Copy link

calh commented Mar 16, 2023

Hey @MaxThom, I have this same issue. Did you ever find a solution to remove the default route?

@n0rad
Copy link

n0rad commented Oct 22, 2024

    {
      "cniVersion": "0.3.0",
      "name": "mymacvlan",
      "plugins": [
        {
          "type": "macvlan",
          "master": "SOMETHING",
          "mode": "bridge",
          "ipam": {
            "type": "dhcp",
            "request": [
              {
                "skipDefault": true,
                "option": "subnet-mask"
              }
            ]
          }
        }
      ]
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants