By lucky, I accidentally find a solution today, by blinking the on board ACT LED.
It should also work for any network interface, even it's a virtual interface like a bridge.
This solution is not tested thoroughly by myself, so if it's not working, or blow up your Pi, post back and blame luck.
More information about the solution could be found on "man iptables-extensions", at the LED target extension clause.
Step 1: Create a new text file at /etc/dhcpcd.exit-hook
Step 2: Put these into it:
Code: Select all
#!/bin/sh
LED_ON_INTERFACE="wlan0"
LED_OPTIONS="--led-trigger-id led --led-delay 100"
IPTABLES="/sbin/iptables"
$IPTABLES --check INPUT --in-interface "$LED_ON_INTERFACE" --jump LED $LED_OPTIONS
check=$?
if [ "$check" -eq 1 ]
then
$IPTABLES --insert INPUT --in-interface "$LED_ON_INTERFACE" --jump LED $LED_OPTIONS
fi
$IPTABLES --check FORWARD --in-interface "$LED_ON_INTERFACE" --jump LED $LED_OPTIONS
check=$?
if [ "$check" -eq 1 ]
then
$IPTABLES --insert FORWARD --in-interface "$LED_ON_INTERFACE" --jump LED $LED_OPTIONS
fi
$IPTABLES --check FORWARD --out-interface "$LED_ON_INTERFACE" --jump LED $LED_OPTIONS
check=$?
if [ "$check" -eq 1 ]
then
$IPTABLES --insert FORWARD --out-interface "$LED_ON_INTERFACE" --jump LED $LED_OPTIONS
fi
$IPTABLES --check OUTPUT --out-interface "$LED_ON_INTERFACE" --jump LED $LED_OPTIONS
check=$?
if [ "$check" -eq 1 ]
then
$IPTABLES --insert OUTPUT --out-interface "$LED_ON_INTERFACE" --jump LED $LED_OPTIONS
fi
echo netfilter-led > /sys/class/leds/led0/trigger
exit 0