FS#41359 - [netctl] ExecDownPre lines do not run with netctl-ifplugd/netctl-auto
Attached to Project:
Arch Linux
Opened by John (graysky) - Sunday, 27 July 2014, 07:53 GMT
Last edited by Jouke Witteveen (jouke) - Tuesday, 05 August 2014, 12:33 GMT
Opened by John (graysky) - Sunday, 27 July 2014, 07:53 GMT
Last edited by Jouke Witteveen (jouke) - Tuesday, 05 August 2014, 12:33 GMT
|
Details
I'm using a wireless/wired profile pair with netctl-ifplugd
and netctl-auto. I'd like active sshd connections to get
killed when the switch from wired to wireless or from
wireless to wired takes place. I have a line in both
profiles to do this, via ExecDownPre but it doesn't happen.
Should I be using a different prefix since the wireless
network is never actually taken down?
ls -l /etc/systemd/system/multi-user.target.wants/netctl* lrwxrwxrwx 1 root root 44 Jul 24 16:09 netctl-auto@wlp4s0.service -> /usr/lib/systemd/system/netctl-auto@.service lrwxrwxrwx 1 root root 47 Jul 24 16:11 netctl-ifplugd@enp0s10.service -> /usr/lib/systemd/system/netctl-ifplugd@.service Wired profile: # cat /etc/netctl/dhcp Description='A basic dhcp ethernet connection' Interface=enp0s10 Connection=ethernet IP=dhcp ExecUpPost='/usr/bin/ethtool -s enp0s10 wol g' ExecDownPre='/usr/bin/pkill sshd' Wireless profile: # cat /etc/netctl/wireless Description='A simple WPA encrypted wireless connection' Interface=wlp4s0 Connection=wireless Security=wpa IP=dhcp ESSID='mysiddgoeshere' Key='mykeygoeshere' ExecDownPre='/usr/bin/pkill sshd' Additional info: * package version(s) 1.8-1 |
This task depends upon
I have both of these enabled:
netctl-auto@wlp4s0.service
netctl-ifplugd@enp0s10.service
What happens now on a boot up with the WIRED plugged in is netctl connects me to both the 'wireless' and the 'dhcp' (wired) profile at the same time. I can ssh into the wired IP address and open a 2nd term and ssh into the wireless IP address both assigned by my router. Do I have something incorrectly configured?
1. https://wiki.archlinux.org/index.php/Netctl#Automatic_switching_of_profiles
The $ExecDownPre command should be called when you unplug your cable, or move out of the range of your wireless network. I presume it is?
Link to discussion thread you requested that does not mention the kill issue but does focus on the wired vs wireless issue: https://bbs.archlinux.org/viewtopic.php?pid=1440595
Here is a good test case:
* Booting with the cable DISCONNECTED has just the wireless up, but booting with the cable CONNECTED has both interfaces up.
* Fresh boot with cable DISCONNECTED.
* I ssh'ed into the wireless IP address.
* Note that the wired network 'enp0s10' is DOWN and wireless 'wlp4s0' is UP:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp0s10: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 01:2a:34:12:a9:b7 brd ff:ff:ff:ff:ff:ff
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 01:12:42:29:21:ad brd ff:ff:ff:ff:ff:ff
inet 10.1.1.233/24 brd 10.1.1.255 scope global wlp4s0
valid_lft forever preferred_lft forever
* Now I plug the cable in and my ssh session that was connected via the wireless IP address is frozen.
* I can ssh into the wired IP address.
* I can no longer ssh into the wireless IP address BUT as you see, the interface is still UP. It should be DOWN I think.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp0s10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 01:2a:34:12:a9:b7 brd ff:ff:ff:ff:ff:ff
inet 10.1.1.105/24 brd 10.1.1.255 scope global enp0s10
valid_lft forever preferred_lft forever
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 01:12:42:29:21:ad brd ff:ff:ff:ff:ff:ff
inet 10.1.1.233/24 brd 10.1.1.255 scope global wlp4s0
valid_lft forever preferred_lft forever
* If I reverse things, and reboot the machine with the cable CONNECTED, both interfaces are up and I can ssh into either IP address (wired or wireless).
* As you can see, both interfaces are UP.
* This should not be the case I think.
* The wired interface should have priority over the wireless.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp0s10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 01:2a:34:12:a9:b7 brd ff:ff:ff:ff:ff:ff
inet 10.1.1.105/24 brd 10.1.1.255 scope global enp0s10
valid_lft forever preferred_lft forever
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 01:12:42:29:21:ad brd ff:ff:ff:ff:ff:ff
inet 10.1.1.233/24 brd 10.1.1.255 scope global wlp4s0
valid_lft forever preferred_lft forever
What you want should be done through bonding. In case you just want to prioritize one network interface over the other, you should use metrics. The freezing of your SSH connection could indicate a routing misconfiguration.
As I am a bit busy at the moment, here is a collection of links that might help you:
https://wiki.archlinux.org/index.php/Netctl#Wired_to_wireless_failover
http://unix.stackexchange.com/questions/35713/adding-two-default-gateways-in-debian-interfaces-file (in netctl, there is the Routes= variable)
http://www.linuxhorizon.ro/iproute2.html
http://www.policyrouting.org/iproute2.doc.html#ss9.5
http://www.policyrouting.org/iproute2.doc.html#ss9.16
It is best to take this to the forums and open a new bug if there is room for improvement in netctl. This bug will be closed shortly.