Add static route to DHCP

Is this Routing per DHCP übergeben (in German… Google translate works) the only way to set a static route to DHCP clients?

Gerald

With my DHCP maintainer hat on and as far as I know: yes.
According to man:dhcp-options(5) there also is option static-routers, but that is deprecated and should not be used. For that reason /usr/sbin/dhclient-script automatically ignores it as soon as RFC3442 classless static routers are used.
Also option routers stops working as soon as you use it! So make sure to specify the default route via RFC3442, too.

The following example setups two routes:

  • 10.10.10/24 via 10.10.0.9
  • default via 10.10.0.1
udm dhcp/service modify \
  --dn "$(udm dhcp/service list | sed -ne 's/^DN: //p;T;q')" \
  --option options \
  --append option='rfc3442-classless-static-routes code 121 = array of integer 8;'  \
  --append option='ms-classless-static-routes code 249 = array of integer 8;'
udm dhcp/subnet modify \
  --dn "$(udm dhcp/subnet list | sed -ne 's/^DN: //p;T;q')" \
  --option options \
  --append option='rfc3442-classless-static-routes 24, 10,10,10, 10,10,0,9, 0,10.10.0.1' \
  --append option='ms-classless-static-routes 24, 10,10,10, 10,10,0,9, 0, 10.10.0.1'
Mastodon