Ignoring DHCP Default Route Option For eth0

Follow

Issue

I'd like the management port eth0 to be configured over DHCP, but I don't want it to install the default route received over DHCP.

Environment

  • Cumulus Linux 2.5.0 through 2.5.8 (for Cumulus Linux 2.5.9 or later, or 3.0.0 or later, use management VRF)
  • eth0 configured as follows in /etc/network/interfaces:
    cumulus@switch$ ifquery eth0
    auto eth0
    iface eth0 inet dhcp
    

Resolution

Create a dhclient hook, /etc/dhcp/dhclient-enter-hooks.d/no-default-route, with the following contents:

case $reason in
  BOUND|RENEW|REBIND|REBOOT)
    if [[ $interface =~ eth[0-9] ]]; then
      unset new_routers
    fi
    ;;
esac
Have more questions? Submit a request

Comments

Powered by Zendesk