Skip to content

Instantly share code, notes, and snippets.

@carbolymer

carbolymer/41-var-test Secret

Last active Mar 7, 2018
Embed
What would you like to do?
dhcpcd profile not propagating env value from the hook.
if [ "$interface" = "eth0" ]; then
echo "[VAR-TEST] if: $interface"
echo "[VAR-TEST] is set: <${var_test}>"
fi
debug
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
noipv4ll
noarp
interface eth0
arping 16.54.52.1 192.168.0.1
profile 00:0B:00:00:AD:D0
env var_test=WORKS
dhcpcd-7.0.1 starting
dev: loaded udev
eth0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
[PROXY] if: eth0
[PROXY] is set: <>
[VAR-TEST] if: eth0
[VAR-TEST] is set: <>
eth0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' CARRIER
[PROXY] if: eth0
[PROXY] is set: <>
[VAR-TEST] if: eth0
[VAR-TEST] is set: <>
wlan0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
wlan0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER
vmnet1: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
vmnet1: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' CARRIER
vmnet8: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
vmnet8: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' CARRIER
docker_gwbridge: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
docker_gwbridge: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER
docker0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
docker0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER
br-0d0a2bb41282: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
br-0d0a2bb41282: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER
br-ab5f9354c8f3: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
br-ab5f9354c8f3: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER
br-acee32ddf7e6: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
br-acee32ddf7e6: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' NOCARRIER
DUID 00:01:00:01:22:1d:89:a2:5c:b9:01:fc:aa:b5
eth0: IAID 01:fc:aa:b5
eth0: delaying IPv6 router solicitation for 0.2 seconds
eth0: delaying IPv4 for 0.2 seconds
vmnet1: IAID 56:c0:00:01
vmnet1: delaying IPv6 router solicitation for 0.7 seconds
vmnet1: delaying IPv4 for 0.0 seconds
vmnet8: IAID 56:c0:00:08
vmnet8: delaying IPv6 router solicitation for 0.9 seconds
vmnet8: delaying IPv4 for 0.0 seconds
docker_gwbridge: waiting for carrier
docker0: waiting for carrier
br-0d0a2bb41282: waiting for carrier
br-ab5f9354c8f3: waiting for carrier
br-acee32ddf7e6: waiting for carrier
wlan0: waiting for carrier
vmnet1: reading lease `/var/lib/dhcpcd/vmnet1.lease'
vmnet1: rebinding lease of 172.16.44.1
vmnet1: ARP announcing 172.16.44.1 (1 of 2), next in 2.0 seconds
vmnet1: sending REQUEST (xid 0x58c932de), next in 4.4 seconds
vmnet8: reading lease `/var/lib/dhcpcd/vmnet8.lease'
vmnet8: rebinding lease of 192.168.187.1
vmnet8: ARP announcing 192.168.187.1 (1 of 2), next in 2.0 seconds
vmnet8: sending REQUEST (xid 0x4646dfd5), next in 4.5 seconds
vmnet1: acknowledged 172.16.44.1 from 172.16.44.254
vmnet1: leased 172.16.44.1 for 1800 seconds
vmnet1: renew in 900 seconds, rebind in 1575 seconds
vmnet1: writing lease `/var/lib/dhcpcd/vmnet1.lease'
vmnet1: IP address 172.16.44.1/24 already exists
vmnet1: adding route to 172.16.44.0/24
vmnet1: ARP announcing 172.16.44.1 (1 of 2), next in 2.0 seconds
vmnet1: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' REBOOT
vmnet8: wrong xid 0x58c932de (expecting 0x4646dfd5) from 172.16.44.254
vmnet8: redirecting DHCP message to vmnet1
vmnet8: acknowledged 192.168.187.1 from 192.168.187.254
vmnet8: leased 192.168.187.1 for 1800 seconds
vmnet8: renew in 900 seconds, rebind in 1575 seconds
vmnet8: writing lease `/var/lib/dhcpcd/vmnet8.lease'
vmnet8: IP address 192.168.187.1/24 already exists
vmnet8: adding route to 192.168.187.0/24
vmnet8: ARP announcing 192.168.187.1 (1 of 2), next in 2.0 seconds
vmnet8: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' REBOOT
eth0: soliciting an IPv6 router
eth0: sending Router Solicitation
eth0: probing for 16.54.52.1
eth0: ARP probing 16.54.52.1 (1 of 3), next in 1.3 seconds
vmnet1: soliciting an IPv6 router
vmnet1: sending Router Solicitation
vmnet8: soliciting an IPv6 router
vmnet8: sending Router Solicitation
eth0: ARP probing 16.54.52.1 (2 of 3), next in 1.4 seconds
vmnet1: ARP announcing 172.16.44.1 (2 of 2)
vmnet8: ARP announcing 192.168.187.1 (2 of 2)
eth0: ARP probing 16.54.52.1 (3 of 3), next in 2.0 seconds
eth0: sending Router Solicitation
vmnet1: sending Router Solicitation
vmnet8: sending Router Solicitation
eth0: probing for 192.168.0.1
eth0: ARP probing 192.168.0.1 (1 of 3), next in 1.3 seconds
eth0: hardware address 00:0b:00:00:ad:d0 claims 192.168.0.1
eth0: no profile 00:0b:00:00:ad:d0
eth0: no profile 192.168.0.1
eth0: IAID 01:fc:aa:b5
eth0: delaying IPv6 router solicitation for 0.0 seconds
eth0: reading lease `/var/lib/dhcpcd/eth0.lease'
eth0: rebinding lease of 192.168.0.19
eth0: ARP announcing 192.168.0.19 (1 of 2), next in 2.0 seconds
eth0: sending REQUEST (xid 0xdb604b71), next in 4.4 seconds
eth0: soliciting an IPv6 router
eth0: sending Router Solicitation
eth0: acknowledged 192.168.0.19 from 192.168.0.1
eth0: leased 192.168.0.19 for 86400 seconds
eth0: renew in 43200 seconds, rebind in 75600 seconds
eth0: writing lease `/var/lib/dhcpcd/eth0.lease'
eth0: IP address 192.168.0.19/24 already exists
eth0: adding route to 192.168.0.0/24
eth0: adding default route via 192.168.0.1
eth0: ARP announcing 192.168.0.19 (1 of 2), next in 2.0 seconds
eth0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' REBOOT
[PROXY] if: eth0
[PROXY] is set: <>
[VAR-TEST] if: eth0
[VAR-TEST] is set: <>
eth0: ARP announcing 192.168.0.19 (2 of 2)
vmnet1: sending Router Solicitation
vmnet8: sending Router Solicitation
eth0: sending Router Solicitation
vmnet1: sending Router Solicitation
vmnet1: no IPv6 Routers available
vmnet8: sending Router Solicitation
vmnet8: no IPv6 Routers available
eth0: sending Router Solicitation
eth0: sending Router Solicitation
eth0: no IPv6 Routers available
wlan0: new hardware address: 8a:28:06:66:8d:8e
received SIGINT, stopping
wlan0: removing interface
wlan0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
br-acee32ddf7e6: removing interface
br-acee32ddf7e6: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
br-ab5f9354c8f3: removing interface
br-ab5f9354c8f3: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
br-0d0a2bb41282: removing interface
br-0d0a2bb41282: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
docker0: removing interface
docker0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
docker_gwbridge: removing interface
docker_gwbridge: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
vmnet8: removing interface
vmnet8: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
vmnet1: removing interface
vmnet1: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
eth0: removing interface
eth0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' STOPPED
[PROXY] if: eth0
[PROXY] is set: <>
[VAR-TEST] if: eth0
[VAR-TEST] is set: <>
dev: unloaded udev
dhcpcd exited
20:40:24 [root:/etc] # dhcpcd -d -B &> /tmp/dhcpcd.test.log
^C#
20:42:37 [root:/etc] 1 # arping -I eth0 192.168.0.1
ARPING 192.168.0.1 from 192.168.0.19 eth0
Unicast reply from 192.168.0.1 [00:0B:00:00:AD:D0] 0.944ms
Unicast reply from 192.168.0.1 [00:0B:00:00:AD:D0] 0.961ms
Unicast reply from 192.168.0.1 [00:0B:00:00:AD:D0] 0.912ms
^CSent 3 probes (1 broadcast(s))
Received 3 response(s)
20:43:42 [root:/etc] # dhcpcd --version
dhcpcd 7.0.1
Copyright (c) 2006-2018 Roy Marples
Compiled in features: INET ARP ARPing IPv4LL INET6 DHCPv6 AUTH
20:44:39 [root:/etc] #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment