[arch-general] systemd-networkd and netctl with multiple interfaces
Hello! I installed Arch on my new Thinkpad T450s over the weekend. Everything works well, but I have a question: I use systemd-networkd to manage my network interfaces and netctl for the connections. I set everything up according to (this)[0] and (this)[1] to get automatic activation of wifi via netctl-auto and netctl-ifplugd. My question is as follows: I use i3wm, and i3status shows *both* ethernet and wifi as connected if I plug in the cable while having a wifi connection. What does this mean exactly, and how is my traffic routed? Thanks in advance for clearing that up. Cheers, Bennett [0]: https://wiki.archlinux.org/index.php/Systemd-networkd#Wired_and_wireless_ada... [1]: https://wiki.archlinux.org/index.php/Netctl#Automatic_switching_of_profiles -- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
On 11/11/15 09:47, Bennett Piater wrote:
Hello! I installed Arch on my new Thinkpad T450s over the weekend. Everything works well, but I have a question:
I use systemd-networkd to manage my network interfaces and netctl for the connections. I set everything up according to (this)[0] and (this)[1] to get automatic activation of wifi via netctl-auto and netctl-ifplugd.
My question is as follows: I use i3wm, and i3status shows *both* ethernet and wifi as connected if I plug in the cable while having a wifi connection. What does this mean exactly, and how is my traffic routed?
Thanks in advance for clearing that up.
Cheers, Bennett
[0]: https://wiki.archlinux.org/index.php/Systemd-networkd#Wired_and_wireless_ada...
[1]: https://wiki.archlinux.org/index.php/Netctl#Automatic_switching_of_profiles
-- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
Hi, I have exactly the same setup (i3wm, i3status and netctl) and the same behavior. If I plug in the cable i3status shows both connections. I manage it, that I deactivate the wifi-card with the hardware switch after I plugged in the cable and everything ist fine. I couldn't get netctl to deactivate the wifi automatically. Regards, Ludwig -- GPG Fingerprint: 988C DE90 4149 C4A8 AAF1 996A 0450 F6B3 A9B2 6230
On 11 November 2015 at 09:18, Ludwig Zins <lz@luanzi.de> wrote:
On 11/11/15 09:47, Bennett Piater wrote:
Hello! I installed Arch on my new Thinkpad T450s over the weekend. Everything works well, but I have a question:
I use systemd-networkd to manage my network interfaces and netctl for the connections. I set everything up according to (this)[0] and (this)[1] to get automatic activation of wifi via netctl-auto and netctl-ifplugd.
My question is as follows: I use i3wm, and i3status shows *both* ethernet and wifi as connected if I plug in the cable while having a wifi connection. What does this mean exactly, and how is my traffic routed?
Thanks in advance for clearing that up.
Cheers, Bennett
[0]:
https://wiki.archlinux.org/index.php/Systemd-networkd#Wired_and_wireless_ada...
[1]:
https://wiki.archlinux.org/index.php/Netctl#Automatic_switching_of_profiles
-- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
Hi,
I have exactly the same setup (i3wm, i3status and netctl) and the same behavior. If I plug in the cable i3status shows both connections. I manage it, that I deactivate the wifi-card with the hardware switch after I plugged in the cable and everything ist fine. I couldn't get netctl to deactivate the wifi automatically.
Regards, Ludwig
-- GPG Fingerprint: 988C DE90 4149 C4A8 AAF1 996A 0450 F6B3 A9B2 6230
I also would like to know! My laptop is set to start wifi on boot. Sometimes I have to switch to ethernet. I have noticed that if I set the ethernet interface to up and plug a cable in, I have an IP on both interfaces (so i3status says). For good measure I always set the wlan interface to down, but I'm always curious as to what actually happens. I wish I could elaborate more on my set up but I installed it a year ago, it's worked ever since, so I honestly cannot remember what I am using. -- benoliver999.com
On Wed, Nov 11, 2015 at 09:35:05 +0000, Ben Oliver wrote:
On 11 November 2015 at 09:18, Ludwig Zins <lz@luanzi.de> wrote:
On 11/11/15 09:47, Bennett Piater wrote:
Hello! I installed Arch on my new Thinkpad T450s over the weekend. Everything works well, but I have a question:
I use systemd-networkd to manage my network interfaces and netctl for the connections. I set everything up according to (this)[0] and (this)[1] to get automatic activation of wifi via netctl-auto and netctl-ifplugd.
My question is as follows: I use i3wm, and i3status shows *both* ethernet and wifi as connected if I plug in the cable while having a wifi connection. What does this mean exactly, and how is my traffic routed?
Thanks in advance for clearing that up.
Cheers, Bennett
[0]:
https://wiki.archlinux.org/index.php/Systemd-networkd#Wired_and_wireless_ada...
[1]:
https://wiki.archlinux.org/index.php/Netctl#Automatic_switching_of_profiles
-- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
I don't use netctl, but you can usually see what default route it uses with ip route I have made the experience that newly configured interfaces "steal" the default route (although this can usually be configured - again, I don't use netctl). I can imagine the default route passing through the WiFi interface in your scenario. ~Tinu
I don't use netctl, but you can usually see what default route it uses with
ip route
Thanks for that, I didn't know that command. The LAN is shown above WIFI, which (I assume) means that it takes precedence.
I have made the experience that newly configured interfaces "steal" the default route (although this can usually be configured - again, I don't use netctl).
I can imagine the default route passing through the WiFi interface in your scenario.
If I plug in LAN while having an active WIFI connection, it seems to steal the route. I checked it by monitoring steam download speeds. Thanks! Cheers, Bennett -- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
Expanding on the ip route command, you can you see what interface is used to reach the Internet by looking at the default route. The entry that has the destination as 0.0.0.0 and the subnet mask as 0.0.0.0 is the default route. If your LAN is shown above your wifi interface I'm going to assume that the default route is set to the LAN, but this leaves you with definitive proof that it's working how you want it. Also, you'll want to type "ip route -n" so you don't resolve hostnames. Also, if your wireless and LAN networks use a different gateway, you can run a traceroute to an outside address to see what path the packets are taking. Since it only shows the next hop IP address it doesn't work if your networks use the same IP addressing scheme. Regards, Andrew On Wed, Nov 11, 2015, 5:22 AM Bennett Piater <bennett@piater.name> wrote:
I don't use netctl, but you can usually see what default route it uses with
ip route
Thanks for that, I didn't know that command. The LAN is shown above WIFI, which (I assume) means that it takes precedence.
I have made the experience that newly configured interfaces "steal" the default route (although this can usually be configured - again, I don't use netctl).
I can imagine the default route passing through the WiFi interface in your scenario.
If I plug in LAN while having an active WIFI connection, it seems to steal the route. I checked it by monitoring steam download speeds.
Thanks!
Cheers, Bennett
-- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
ip route get 8.8.8.8 ip route get 7.7.7.7 will show the routes for those ip addresses. you can check several to see where they go (in case the 2 default routes have the same metric) On 11 November 2015 at 14:38, Andrew Von Stein <16vonsa@gmail.com> wrote:
Expanding on the ip route command, you can you see what interface is used to reach the Internet by looking at the default route. The entry that has the destination as 0.0.0.0 and the subnet mask as 0.0.0.0 is the default route. If your LAN is shown above your wifi interface I'm going to assume that the default route is set to the LAN, but this leaves you with definitive proof that it's working how you want it. Also, you'll want to type "ip route -n" so you don't resolve hostnames.
Also, if your wireless and LAN networks use a different gateway, you can run a traceroute to an outside address to see what path the packets are taking. Since it only shows the next hop IP address it doesn't work if your networks use the same IP addressing scheme.
Regards, Andrew
On Wed, Nov 11, 2015, 5:22 AM Bennett Piater <bennett@piater.name> wrote:
I don't use netctl, but you can usually see what default route it uses with
ip route
Thanks for that, I didn't know that command. The LAN is shown above WIFI, which (I assume) means that it takes precedence.
I have made the experience that newly configured interfaces "steal" the default route (although this can usually be configured - again, I don't use netctl).
I can imagine the default route passing through the WiFi interface in your scenario.
If I plug in LAN while having an active WIFI connection, it seems to steal the route. I checked it by monitoring steam download speeds.
Thanks!
Cheers, Bennett
-- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
-- damjan
On Wed, Nov 11, 2015 at 09:47:25AM +0100, Bennett Piater wrote:
Hello! I installed Arch on my new Thinkpad T450s over the weekend. Everything works well, but I have a question:
I use systemd-networkd to manage my network interfaces and netctl for the connections. I set everything up according to (this)[0] and (this)[1] to get automatic activation of wifi via netctl-auto and netctl-ifplugd.
My question is as follows: I use i3wm, and i3status shows *both* ethernet and wifi as connected if I plug in the cable while having a wifi connection. What does this mean exactly, and how is my traffic routed?
To point out something that other areas of the discussion have ignored: existing connections. Say you start out on wifi, and open an ssh connection. Then you plug in ethernet. The ssh session will remain on the wifi route until it is closed. There's no way* to make an existing connection "jump ship" from one route to another. If you were to disable the wifi connection as soon as the ethernet connection, your ssh session would die. --Sean * Technically, this is a lie. Interface teaming / bonding can do this, but it requires a very special setup and I'm not sure it would work over wifi. Regardless, it is very difficult to make work properly in most normal networks.
Say you start out on wifi, and open an ssh connection. Then you plug in ethernet. The ssh session will remain on the wifi route until it is closed. There's no way* to make an existing connection "jump ship" from one route to another. If you were to disable the wifi connection as soon as the ethernet connection, your ssh session would die.
Thanks a lot, that is both new and helpful indeed. So does this mean that new connections will use the new network, while old connections retain theirs? Cheers, Bennett -- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
On Thu, Nov 12, 2015 at 12:30:36PM +0100, Bennett Piater wrote:
Say you start out on wifi, and open an ssh connection. Then you plug in ethernet. The ssh session will remain on the wifi route until it is closed. There's no way* to make an existing connection "jump ship" from one route to another. If you were to disable the wifi connection as soon as the ethernet connection, your ssh session would die.
Thanks a lot, that is both new and helpful indeed.
So does this mean that new connections will use the new network, while old connections retain theirs?
Well, it depends on whether wlan0 and eth0 are on different networks. If they are, then the answer is yes, and you are screwed. If both interfaces get the same ip, then you can maintain persistent connection. For example, let's assume that you constantly switch between different interfaces (wlan0 <--> eth0), when you move between buildings on campus. In the latter case, you can bond wlan0 and eth0 (bond0 := wlan0 + eth0) and use bond0 in all your networking scripts (but still, wpa_supplicant runs on physical wlan0). In this case, nothing but the kernel cares what physical interface carries the traffic. Last time I checked about a year ago, systemd-networkd had some obscure bug in this situation, so I'm using netctl that works perfectly. If you need, I can dig out the relevant profiles. HTH, -- Leonid Isaev GPG fingerprints: DA92 034D B4A8 EC51 7EA6 20DF 9291 EE8A 043C B8C4 C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
Well, it depends on whether wlan0 and eth0 are on different networks. If they are, then the answer is yes, and you are screwed.
If both interfaces get the same ip, then you can maintain persistent connection. For example, let's assume that you constantly switch between different interfaces (wlan0 <--> eth0), when you move between buildings on campus.
In the latter case, you can bond wlan0 and eth0 (bond0 := wlan0 + eth0) and use bond0 in all your networking scripts (but still, wpa_supplicant runs on physical wlan0). In this case, nothing but the kernel cares what physical interface carries the traffic. Last time I checked about a year ago, systemd-networkd had some obscure bug in this situation, so I'm using netctl that works perfectly. If you need, I can dig out the relevant profiles.
I mostly just use LAN when I need to download a lot of stuff at home, because WIFI is much slower even at 54 Mb/s, especially since my home network is 1 Gbps. So I could just turn WIFI off in those cases, that would be an acceptable situation. However, I want to understand all of this as fully as possible. So, yes, I would appreciate your profiles - but please take your time digging them out :) Cheers, Bennett -- GPG fingerprint: 871F 1047 7DB3 DDED 5FC4 47B2 26C7 E577 EF96 7808
On Thu, Nov 12, 2015 at 07:52:20PM +0100, Bennett Piater wrote:
I mostly just use LAN when I need to download a lot of stuff at home, because WIFI is much slower even at 54 Mb/s, especially since my home network is 1 Gbps. So I could just turn WIFI off in those cases, that would be an acceptable situation.
You probably don't want to turn off the wifi physically because you will also need to tell daemons like wpa_supplicant to quit gracefully (and then restart when the card is turned back on).
However, I want to understand all of this as fully as possible. So, yes, I would appreciate your profiles - but please take your time digging them out :)
I'd say, the cleanest option is to keep wlan0 interface up and have wpa_supplicant running on it all the time, but configure it a slave to ethernet in the bonding. So, whenever you plug a cable, the kernel will automatically send all traffic through eth. Unplug it, and the traffic will flow over wifi. And your applications shouldn't even notice that. The setup is simple: create a netctl profile, like $ cat bonding0 Description="Bond interface for external NICs" Interface=bond0 Connection=bond BindsToInterfaces=(eth0 wlan0) IP=no Then, enable wpa_supplicant-nl80211@wlan0.service after netctl@bonding0.service, and finally configure IP, firewall, etc using the new bond0 interface. This IP (and routing) will stay stable in between switches between wired and wireless networks. The above ordering of netctl and wpa_supplicant is the only trick here... HTH, -- Leonid Isaev GPG fingerprints: DA92 034D B4A8 EC51 7EA6 20DF 9291 EE8A 043C B8C4 C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
participants (8)
-
Andrew Von Stein
-
Ben Oliver
-
Bennett Piater
-
Damjan Georgievski
-
Leonid 'Beef Marsala' Isaev
-
Ludwig Zins
-
Sean Greenslade
-
Tinu Weber