Re: "dhcpcd not running"
Roy Marples
Wed Apr 27 21:50:02 2016
On Wednesday 27 April 2016 11:02:38 Shahid Mahmood wrote:
> Use case is a multiple vlan environment. At start, the device obtains a
> lease on a no-vlan (eth0) dhcp server. The lease informs us (using a custom
> option) to switch to another vlan, say 345 (as supplied). We will first
> need to release the old eth0 lease and then request new lease using the
> provided vlan id.
>
> Basically we cant hard code the vlan id (and consequently adaptor name) in
> the .conf file because it is not known.
>
> Can you suggest why my approach would not work? (ie putting desired
> interface name in .conf file).
> (I want to avoid having to deal with pidfile).
Everything in dhcpcd is known :D
If you're more clever with shell you don't even need the -M flag, but I'll
leave that exercise upto the reader.
Start it up
dhcpcd -M eth0
In dhcpcd.enter-hook, maybe something like this (untested).
if $if_up && [ "$old_vlanid" != "$new_vlanid"]; then
# vlan changed, release current.
# This works because of the -M flag.
dhcpcd -k
# Fire up the vlan
platform_specific_vlan_init
# Request DHCP over it, background right away
dhcpcd -bM eth0."$new_vlanid"
# Exit dhcpcd-run-hooks
exit 1
fi
Roy
Archive administrator: postmaster@marples.name