dhcpcd-discuss

Re: interfaces are killed after boot

JED

Thu Nov 14 16:08:15 2019

Daniel, update your OS and try again.

I'm running current raspbian buster and it HAD older dhcpcd but I did an apt-get upgrade and NOW:

pi@rpi1909Ty:~ $ dhcpcd --version
dhcpcd 8.1.1
Copyright (c) 2006-2019 Roy Marples
Compiled in features: INET ARP ARPing IPv4LL INET6 DHCPv6 AUTH

Linux 4.19.75+ #1270 Tue Sep 24 18:38:54 BST 2019 armv6l
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"

On 11/14/2019 9:12 AM, Roy Marples wrote:
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 bootSerge Schneider
References:
interfaces are killed after bootDaniel Huhardeaux
Re: interfaces are killed after bootRoy Marples
Archive administrator: postmaster@marples.name