dhcpcd-discuss

Re: interfaces are killed after boot

Roy Marples

Thu Nov 14 14:07:55 2019

Hi Daniel

On 14/11/2019 13:29, Daniel Huhardeaux wrote:
I have an Raspi3 running raspbian/buster. dhcpcd version is 7.0.8 Network uses ipv4 and ipv6.

Raspbian should consider upgrading to dhcpcd-8, I don't really support older versions much.

I want to run a firewall script as soon as an interface (eth0 and wlan0) get's IP's (ipv4 and ipv6). I installed my script
/lib/dhcpcd/dhcpcd-hooks/99-startFW which contains

You should install it as /etc/dhcpcd.exit-hook


#
PATHtoFW=/etc/network/if-post-up.d/

case $reason in
         BOUND)
               $PATHtoFW/sfw4 ${interface}
               ;;
         BOUND6)
               $PATHtoFW/sfw6 ${interface}
               ;;
esac

but the scripts are not executed :(

How can I get this work ?

BOUND is only set initally.
You are missing other important DHCP states such as REBIND or RENEW.
Also Router Advertisments don't even have states which you're missing.

Try this instead

PATHtoFW=/etc/network/if-post-up.d

if $if_up; then
	case "$protocol" in
		dhcp|ipv4ll) "$PATHtoFW/sfw4" "$interface";;
		ra|dhcp6|static6) "$PATHtoFW/sfw6" "$interface";;
	esac
fi

Good luck!

Roy

Follow-Ups:
Re: interfaces are killed after bootJED
Re: interfaces are killed after bootDaniel Huhardeaux
References:
interfaces are killed after bootDaniel Huhardeaux
Archive administrator: postmaster@marples.name