Re: interfaces are killed after boot
Daniel Huhardeaux
Thu Nov 14 15:30:25 2019
Hi Roy, thanks to take care on this matter
Le 14/11/2019 à 15:12, Roy Marples a écrit :
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.
Well, Debian Buster being 7.1 ...
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
Done
#
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
My script is only launched for eth0 ipv4 and what is strange, not all
the script is executed ! It's a sh script which start nftables rules.
Inside they are echo "bla bla ..." for debugging. Could this be the
problem ? I don't find those datas in syslog, even using logger "..."
This is the logs from dhcpcd in syslog after the pi has booted (sorry
for length):
Nov 14 16:09:26 raspi systemd[1]: Starting dhcpcd on all interfaces...
Nov 14 16:09:26 raspi dhcpcd[331]: dev: loaded udev
Nov 14 16:09:26 raspi dhcpcd[331]: forked to background, child pid 408
Nov 14 16:09:26 raspi dhcpcd-run-hooks[428]: wlan0: starting wpa_supplicant
Nov 14 16:09:27 raspi systemd[1]: Started dhcpcd on all interfaces.
Nov 14 16:09:27 raspi dhcpcd[408]: eth0: waiting for carrier
Nov 14 16:09:27 raspi dhcpcd[408]: wlan0: waiting for carrier
Nov 14 16:09:27 raspi dhcpcd[408]: wlan0: carrier acquired
Nov 14 16:09:28 raspi dhcpcd[408]: DUID
00:01:00:01:25:5e:ba:93:b8:27:eb:89:ee:cd
Nov 14 16:09:28 raspi dhcpcd[408]: wlan0: IAID eb:89:ee:cd
Nov 14 16:09:28 raspi dhcpcd[408]: wlan0: adding address
fe80::78ca:e473:416a:61f0
Nov 14 16:09:28 raspi dhcpcd[408]: wlan0: carrier lost
Nov 14 16:09:28 raspi dhcpcd[408]: wlan0: deleting address
fe80::78ca:e473:416a:61f0
Nov 14 16:09:28 raspi dhcpcd[408]: eth0: carrier acquired
Nov 14 16:09:28 raspi dhcpcd[408]: eth0: IAID eb:dc:bb:98
Nov 14 16:09:28 raspi dhcpcd[408]: eth0: adding address
fe80::2d6a:d0f5:b645:f6e9
Nov 14 16:09:28 raspi dhcpcd[408]: eth0: rebinding lease of 192.168.10.18
Nov 14 16:09:28 raspi dhcpcd[408]: wlan0: carrier acquired
Nov 14 16:09:28 raspi dhcpcd[408]: wlan0: IAID eb:89:ee:cd
Nov 14 16:09:28 raspi dhcpcd[408]: wlan0: adding address
fe80::17db:5df7:161:b0aa
Nov 14 16:09:29 raspi dhcpcd[408]: eth0: soliciting an IPv6 router
Nov 14 16:09:29 raspi dhcpcd[408]: wlan0: rebinding lease of 192.168.10.18
Nov 14 16:09:29 raspi dhcpcd[408]: wlan0: soliciting an IPv6 router
Nov 14 16:09:29 raspi dhcpcd[408]: wlan0: probing address 192.168.10.18/24
Nov 14 16:09:30 raspi dhcpcd[408]: eth0: Router Advertisement from
fe80::5054:ff:fe12:3458
Nov 14 16:09:30 raspi dhcpcd[408]: eth0: adding route to
xxxx:yyyy:16e:10::/64
Nov 14 16:09:30 raspi dhcpcd[408]: eth0: adding default route via
fe80::5054:ff:fe12:3458
Nov 14 16:09:30 raspi dhcpcd[408]: eth0: confirming prior DHCPv6 lease
Nov 14 16:09:30 raspi dhcpcd[408]: eth0: REPLY6 received from
fe80::5054:ff:fe12:3458
Nov 14 16:09:30 raspi dhcpcd[408]: eth0: adding address
xxxx:yyyy:16e:10::9986/128
Nov 14 16:09:30 raspi dhcpcd[408]: eth0: renew in 1262690, rebind in
2020304, expire in 2525381 seconds
Nov 14 16:09:33 raspi dhcpcd[408]: wlan0: Router Advertisement from
fe80::5054:ff:fe12:3458
Nov 14 16:09:33 raspi dhcpcd[408]: wlan0: adding route to
xxxx:yyyy:16e:10::/64
Nov 14 16:09:33 raspi dhcpcd[408]: wlan0: adding default route via
fe80::5054:ff:fe12:3458
Nov 14 16:09:33 raspi dhcpcd[408]: wlan0: confirming prior DHCPv6 lease
Nov 14 16:09:33 raspi dhcpcd[408]: eth0: probing for an IPv4LL address
Nov 14 16:09:33 raspi dhcpcd[408]: eth0: DHCP lease expired
Nov 14 16:09:33 raspi dhcpcd[408]: eth0: soliciting a DHCP lease
Nov 14 16:09:33 raspi dhcpcd[408]: eth0: offered 192.168.10.18 from
192.168.10.254
Nov 14 16:09:33 raspi dhcpcd[408]: eth0: ignoring offer of 192.168.10.18
from 192.168.10.254
Nov 14 16:09:33 raspi dhcpcd[408]: eth0: probing address 192.168.10.18/24
Nov 14 16:09:33 raspi dhcpcd[408]: wlan0: REPLY6 received from
fe80::5054:ff:fe12:3458
Nov 14 16:09:33 raspi dhcpcd[408]: wlan0: adding address
xxxx:yyyy:16e:10::9983/128
Nov 14 16:09:33 raspi dhcpcd[408]: wlan0: renew in 1296000, rebind in
2073600, expire in 2592000 seconds
Nov 14 16:09:35 raspi dhcpcd[408]: wlan0: leased 192.168.10.18 for
345600 seconds
Nov 14 16:09:35 raspi dhcpcd[408]: wlan0: adding route to 192.168.10.0/24
Nov 14 16:09:35 raspi dhcpcd[408]: wlan0: adding default route via
192.168.10.1
Nov 14 16:09:36 raspi dhcpcd[408]: wlan0: hardware address
00:00:00:00:00:00 claims 192.168.10.18
Nov 14 16:09:37 raspi dhcpcd[408]: wlan0: hardware address
00:00:00:00:00:00 claims 192.168.10.18
Nov 14 16:09:38 raspi dhcpcd[408]: eth0: using IPv4LL address
169.254.130.238
Nov 14 16:09:38 raspi dhcpcd[408]: eth0: adding route to 169.254.0.0/16
Nov 14 16:09:39 raspi dhcpcd[408]: eth0: leased 192.168.10.18 for 345600
seconds
Nov 14 16:09:39 raspi dhcpcd[408]: eth0: adding route to 192.168.10.0/24
Nov 14 16:09:39 raspi dhcpcd[408]: eth0: adding default route via
192.168.10.1
Nov 14 16:09:41 raspi dhcpcd[408]: eth0: deleting route to 169.254.0.0/16
ip a show all addresses. Running manually my scripts after reboot is OK,
rules are setted.
Are the scripts in /etc/network/if-[up|down].d or if-post-[up|down].d
not used ?
Thanks for your support
Daniel
--
TOOTAi Networks
Archive administrator: postmaster@marples.name