Colleagues, could you please tell me what I need to do to get dhclient hooks working?
I created the directories /etc/dhclient-enter-hooks and /etc/dhclient-exit-hooks. (That's how they're named in /sbin/dhclient-script. Without the ".d")
Then, I placed a test file in each of them, with the following content:
Set the required permissions.
I ran the files manually - entries appeared in /var/log/messages.
In theory, everything should work automatically.
I plugged a USB Wi-Fi adapter into the computer and connected it to the base.
It receives network settings via DHCP.
Theoretically, while the interface is receiving its lease, the hooks should be triggered, and I imagine more than once.
After rebooting the machine, the interface initializes normally, but there's no sign of any test hooks.
Did I do something wrong, or has this mechanism been inactive for a long time?
I'd appreciate any answers to my question,
Ogogon.
I created the directories /etc/dhclient-enter-hooks and /etc/dhclient-exit-hooks. (That's how they're named in /sbin/dhclient-script. Without the ".d")
Then, I placed a test file in each of them, with the following content:
sh:
#!/bin/sh
# This script will be executed when dhclient enters a new state (e.g., BOUND, RENEW).
# The 'reason' variable indicates the current state.
# The 'interface' variable indicates the network interface.
logger "my_custom_script $reason"
Set the required permissions.
ogogon@devel:/% ls -alg /etc/dhclient-enter-hooks/test /etc/dhclient-exit-hooks/test
-rwxr-xr-x 1 wheel 245 Oct 12 02:24 /etc/dhclient-enter-hooks/test
-rwxr-xr-x 1 wheel 120 Oct 12 02:24 /etc/dhclient-exit-hooks/test
I ran the files manually - entries appeared in /var/log/messages.
In theory, everything should work automatically.
I plugged a USB Wi-Fi adapter into the computer and connected it to the base.
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=0
ether aa:bb:cc:dd:ee:ff
inet 192.168.2.112 netmask 0xffffff00 broadcast 192.168.2.255
groups: wlan
ssid XXXXXXXX channel 3 (2422 MHz 11g ht/20) bssid ff:ee:dd:cc:bb:aa
regdomain FCC country US authmode WPA2/802.11i privacy ON
deftxkey UNDEF TKIP 2:128-bit TKIP 3:128-bit txpower 30 bmiss 7
scanvalid 60 protmode CTS ht20 ampdulimit 64k ampdudensity 8 -stbc
-ldpc -uapsd wme roaming MANUAL
parent interface: run0
media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
status: associated
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
It receives network settings via DHCP.
670 - Is 0:00.01 dhclient: system.syslog (dhclient)
673 - Is 0:00.01 dhclient: wlan0 [priv] (dhclient)
735 - ICs 0:00.01 dhclient: wlan0 (dhclient)
Theoretically, while the interface is receiving its lease, the hooks should be triggered, and I imagine more than once.
After rebooting the machine, the interface initializes normally, but there's no sign of any test hooks.
Did I do something wrong, or has this mechanism been inactive for a long time?
I'd appreciate any answers to my question,
Ogogon.