Re: Arping and profiles
Roy Marples
Fri Dec 13 09:40:49 2013
Hi David
On 12/12/2013 23:05, David McGurty wrote:
I'm having trouble configuring dhcpcd to use arping and assign a
static ip address depeding on which profile matches. This is the
relevant part of my configuration:
interface bond0
arping 192.168.1.1 192.168.3.1
profile 00:11:22:33:44:55
static ip_address=192.168.1.2/24
static routers=192.168.1.1
static domain_name_servers=208.67.222.222 208.67.220.220 192.168.1.1
profile 55:44:33:22:11:00
static ip_address=192.168.3.70/24
static routers=192.168.3.1
static domain_name_servers=208.67.222.222 208.67.220.220 192.168.3.1
This does almost work as expected, in that it selects the correct
profile when I'm connected to the router that has the matching MAC
address. However it only ever works for the first IP that is listed in
the "arping"-line
So when 192.168.1.1 is first in line, it will load the
00:11:22:33:44:55 profile when I'm connected to that router, but it
won't load the 55:44:33:22:11:00 profile when I'm connected to the
other router.
When I try to connect to the 55:44:33:22:11:00 router with the above
configuration, it will fall back to acquiring a lease through DHCP
after sending ARP probes for the first profile's MAC:
Dec 13 00:02:27 host dhcpcd[24965]: version 6.1.0 starting
Dec 13 00:02:27 host dhcpcd[24965]: bond0: executing
`/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
Dec 13 00:02:27 host dhcpcd[24965]: bond0: executing
`/usr/lib/dhcpcd/dhcpcd-run-hooks' CARRIER
Dec 13 00:02:27 host dhcpcd[24965]: bond0: soliciting an IPv6 router
Dec 13 00:02:27 host dhcpcd[24965]: bond0: sending Router Solicitation
Dec 13 00:02:27 host dhcpcd[24965]: bond0: using ClientID
ff:00:00:00:04:00:01:00:01:19:f6:85:31:a0:88:b4:a4:68:d8
Dec 13 00:02:28 host dhcpcd[24965]: bond0: searching for 192.168.3.1
Dec 13 00:02:28 host dhcpcd[24965]: bond0: sending ARP probe (1 of 3),
next in 1.40 seconds
Dec 13 00:02:29 host dhcpcd[24965]: bond0: sending ARP probe (2 of 3),
next in 1.67 seconds
Dec 13 00:02:31 host dhcpcd[24965]: bond0: sending ARP probe (3 of 3),
next in 2.00 seconds
Dec 13 00:02:31 host dhcpcd[24965]: bond0: sending Router Solicitation
Dec 13 00:02:33 host dhcpcd[24965]: bond0: soliciting an IPv6 router
Dec 13 00:02:33 host dhcpcd[24965]: bond0: sending Router Solicitation
Dec 13 00:02:33 host dhcpcd[24965]: bond0: using ClientID
ff:00:00:00:04:00:01:00:01:19:f6:85:31:a0:88:b4:a4:68:d8
Dec 13 00:02:33 host dhcpcd[24965]: bond0: soliciting a DHCP lease
Dec 13 00:02:33 host dhcpcd[24965]: bond0: sending DISCOVER (xid
0x5e84babf), next in 3.23 seconds
Dec 13 00:02:33 host dhcpcd[24965]: bond0: offered 192.168.1.101 from
192.168.1.1
Dec 13 00:02:33 host dhcpcd[24965]: bond0: sending REQUEST (xid
0x5e84babf), next in 4.00 seconds
Dec 13 00:02:33 host dhcpcd[24965]: bond0: acknowledged 192.168.1.101
from 192.168.1.1
Dec 13 00:02:33 host dhcpcd[24965]: bond0: checking for 192.168.1.101
Dec 13 00:02:33 host dhcpcd[24965]: bond0: sending ARP probe (1 of 3),
next in 1.75 seconds
Dec 13 00:02:34 host dhcpcd[24965]: bond0: sending ARP probe (2 of 3),
next in 1.69 seconds
Dec 13 00:02:36 host dhcpcd[24965]: bond0: sending ARP probe (3 of 3),
next in 2.00 seconds
Dec 13 00:02:37 host dhcpcd[24965]: bond0: sending Router Solicitation
Dec 13 00:02:38 host dhcpcd[24965]: bond0: leased 192.168.1.101 for
604800 seconds
Dec 13 00:02:38 host dhcpcd[24965]: bond0: renew in 302400 seconds,
rebind in 529200 seconds
Dec 13 00:02:38 host dhcpcd[24965]: bond0: adding IP address
192.168.1.101/24
Dec 13 00:02:38 host dhcpcd[24965]: bond0: adding host route to
192.168.1.101 via 127.0.0.1
Dec 13 00:02:38 host dhcpcd[24965]: bond0: adding route to
192.168.1.0/24
Dec 13 00:02:38 host dhcpcd[24965]: bond0: adding default route via
192.168.1.1
Dec 13 00:02:38 host dhcpcd[24965]: bond0: writing lease
`/var/lib/dhcpcd/dhcpcd-bond0.lease'
Dec 13 00:02:38 host dhcpcd[24965]: bond0: executing
`/usr/lib/dhcpcd/dhcpcd-run-hooks' BOUND
Dec 13 00:02:38 host dhcpcd[24965]: forking to background
If is do a switcheroo and change the "arping"-line to read: "arping
192.168.3.1 192.168.1.1", it works. However it then won't work for the
other router.
The example in the manpage suggests to use the router's IP address in
the "profile" line instead of using the MAC. I tried that and it
doesn't work at all. It just always falls back to using DHCP.
Am I missing something here? Any help is appreciated!
Heh, you must be the 2nd person to use the very nice but underused
feature ;)
Fixed here:
http://roy.marples.name/cgi-bin/gitweb.cgi?p=dhcpcd.git;a=commitdiff;h=c53d79103a91e70f473d17df3caa301be615d25a
If you can't apply the patch then just specify the arping ip's on
different lines like so:
interface bond0
arping 192.168.1.1
arping 192.168.3.1
And it should work
Thanks
Roy
Archive administrator: postmaster@marples.name