View previous topic :: View next topic |
Author |
Message |
mieses Tux's lil' helper
Joined: 28 Feb 2004 Posts: 110
|
Posted: Wed Oct 08, 2014 10:50 pm Post subject: Same IP, multiple interfaces using dhcpcd, systemd |
|
|
Is it possible to configure dhcpcd to accept the same IP address on multiple interfaces? For example, consider a laptop where only one interface is enabled at a time with the wired interface having priority over the wireless interface. An OpenWRT router is running dnsmasq and is configured to assign the same IP address to all MAC addresses belonging to this laptop.
OS X, Ubuntu and Windows are able assign the same IP address to multiple interfaces and seem to do this by default. What is the intended behavior in Gentoo for this case when running dhcpcd, NetworkManager, and systemd?
When the Wi-Fi interface comes up on Gentoo, dnsmasq tries to assign the same IP and dhcpcd rejects the lease noting that the wired interface on the same laptop has already claimed it. journalctl reports the following:
Code: | Oct 08 14:55:48 testgentoo dhcpcd[14263]: version 6.4.7 starting
Oct 08 14:55:48 testgentoo NetworkManager[14137]: <info> (wlp3s0): DHCPv4 state changed nbi -> preinit
...
Oct 08 14:55:48 testgentoo dhcpcd[14263]: wlp3s0: soliciting a DHCP lease
Oct 08 14:55:48 testgentoo dhcpcd[14263]: wlp3s0: offered 192.168.0.235 from 192.168.0.10
Oct 08 14:55:48 testgentoo dhcpcd[14263]: wlp3s0: hardware address c8:2a:14:29:b9:2d claims 192.168.0.235
Oct 08 14:55:51 testgentoo dhcpcd[14263]: wlp3s0: soliciting a DHCP lease
Oct 08 14:55:53 testgentoo dhcpcd[14263]: wlp3s0: offered 192.168.0.106 from 192.168.0.10
Oct 08 14:55:58 testgentoo dhcpcd[14263]: wlp3s0: leased 192.168.0.106 for 43200 seconds
Oct 08 14:55:58 testgentoo dhcpcd[14263]: wlp3s0: adding route to 192.168.0.0/24 |
If dhcpcd would allow the same IP (192.168.0.235) to be assigned to both interfaces simultaneously, then dnsmasq would be able to assign the same name to both the wired and wireless interfaces of the same machine.
For comparison, here are the router logs when the Wi-Fi interface is disabled and enabled on this Gentoo machine and OS X.
router log events upon disabling WiFi interface in OS X client.
Code: | Oct 8 22:12:06 router daemon.info hostapd: wlan1: STA 8c:2d:aa:31:ac:99 IEEE 802.11: disassociated
Oct 8 22:12:07 router daemon.info hostapd: wlan1: STA 8c:2d:aa:31:ac:99 IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE) |
router log events upon enabling WiFi interface in OS X client.
Code: | Oct 8 22:20:37 router daemon.info hostapd: wlan1: STA 8c:2d:aa:31:ac:99 IEEE 802.11: authenticated
Oct 8 22:20:37 router daemon.info hostapd: wlan1: STA 8c:2d:aa:31:ac:99 IEEE 802.11: associated (aid 1)
Oct 8 22:20:37 router daemon.info hostapd: wlan1: STA 8c:2d:aa:31:ac:99 WPA: pairwise key handshake completed (RSN)
Oct 8 22:20:38 router daemon.info dnsmasq-dhcp[26283]: DHCPREQUEST(br-lan) 192.168.0.14 8c:2d:aa:31:ac:99
Oct 8 22:20:38 router daemon.info dnsmasq-dhcp[26283]: abandoning lease to a8:20:66:51:ff:45 of 192.168.0.14
Oct 8 22:20:38 router daemon.info dnsmasq-dhcp[26283]: DHCPACK(br-lan) 192.168.0.14 8c:2d:aa:31:ac:99 testmac |
router log events upon enabling WiFi interface in Gentoo client.
Code: | Oct 8 22:14:33 router daemon.info hostapd: wlan1: STA e4:ce:8f:56:1c:2a IEEE 802.11: authenticated
Oct 8 22:14:33 router daemon.info hostapd: wlan1: STA e4:ce:8f:56:1c:2a IEEE 802.11: associated (aid 1)
Oct 8 22:14:33 router daemon.info hostapd: wlan1: STA e4:ce:8f:56:1c:2a WPA: pairwise key handshake completed (RSN)
Oct 8 22:14:34 router daemon.info dnsmasq-dhcp[26283]: DHCPREQUEST(br-lan) 192.168.0.106 e4:ce:8f:56:1c:2a
Oct 8 22:14:34 router daemon.info dnsmasq-dhcp[26283]: DHCPNAK(br-lan) 192.168.0.106 e4:ce:8f:56:1c:2a static lease available
Oct 8 22:14:34 router daemon.info dnsmasq-dhcp[26283]: DHCPDISCOVER(br-lan) e4:ce:8f:56:1c:2a
Oct 8 22:14:34 router daemon.info dnsmasq-dhcp[26283]: DHCPOFFER(br-lan) 192.168.0.235 e4:ce:8f:56:1c:2a
Oct 8 22:14:34 router daemon.info dnsmasq-dhcp[26283]: DHCPREQUEST(br-lan) 192.168.0.235 e4:ce:8f:56:1c:2a
Oct 8 22:14:34 router daemon.info dnsmasq-dhcp[26283]: DHCPACK(br-lan) 192.168.0.235 e4:ce:8f:56:1c:2a testgentoo
Oct 8 22:14:34 router daemon.info dnsmasq-dhcp[26283]: DHCPDECLINE(br-lan) 192.168.0.235 e4:ce:8f:56:1c:2a Duplicate address detected
Oct 8 22:14:34 router daemon.warn dnsmasq-dhcp[26283]: disabling DHCP static address 192.168.0.235 for 10m
Oct 8 22:14:37 router daemon.warn dnsmasq-dhcp[26283]: not using configured address 192.168.0.235 because it was previously declined
Oct 8 22:14:40 router daemon.info dnsmasq-dhcp[26283]: DHCPDISCOVER(br-lan) e4:ce:8f:56:1c:2a
Oct 8 22:14:40 router daemon.info dnsmasq-dhcp[26283]: DHCPOFFER(br-lan) 192.168.0.106 e4:ce:8f:56:1c:2a
Oct 8 22:14:40 router daemon.info dnsmasq-dhcp[26283]: DHCPREQUEST(br-lan) 192.168.0.106 e4:ce:8f:56:1c:2a
Oct 8 22:14:40 router daemon.info dnsmasq-dhcp[26283]: DHCPACK(br-lan) 192.168.0.106 e4:ce:8f:56:1c:2a testgentoo |
router log events upon disabling WiFi interface in Gentoo client.
Code: | (no events reported) |
3 minutes later, router log events upon enabling WiFi interface in Gentoo client.
Code: | Oct 8 22:17:47 router daemon.info hostapd: wlan1: STA e4:ce:8f:56:1c:2a IEEE 802.11: authenticated
Oct 8 22:17:47 router daemon.info hostapd: wlan1: STA e4:ce:8f:56:1c:2a IEEE 802.11: associated (aid 1)
Oct 8 22:17:47 router daemon.info hostapd: wlan1: STA e4:ce:8f:56:1c:2a WPA: pairwise key handshake completed (RSN)
Oct 8 22:17:48 router daemon.info dnsmasq-dhcp[26283]: DHCPREQUEST(br-lan) 192.168.0.106 e4:ce:8f:56:1c:2a
Oct 8 22:17:48 router daemon.info dnsmasq-dhcp[26283]: DHCPACK(br-lan) 192.168.0.106 e4:ce:8f:56:1c:2a testgentoo |
|
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
mieses Tux's lil' helper
Joined: 28 Feb 2004 Posts: 110
|
Posted: Thu Oct 09, 2014 6:18 am Post subject: |
|
|
Thank you. It's good to know that it's working as intended. I will post an issue on your tracker.
Out of pure curiosity, how would the solution work? How is the wireless interface de-prioritized when the wired interface is plugged in and receives the same IP as the wireless interface? Do both interfaces stay up and one is configured to route through the other? |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Tue May 05, 2015 12:30 pm Post subject: |
|
|
UberLord wrote: | If you have say wired and wireless and both are active then the wired interface will have the IP address.
When unplugged, the IP address will move to the wireless interface. |
Lovely. :-) |
|
Back to top |
|
|
|