You are not logged in.

#1 2016-10-14 20:51:16

wenugo
Member
Registered: 2016-10-14
Posts: 4

Netctl: Search interval for connecting automatically with known WiFi

Hi,

I'm using "netctl enable <ssid>" to connect automatically after rebooting with a wireless network. Sometimes the wireless network is down or not in range, so netctl can't establish a connection. When the network is available again, it doesn't connect to it instantly(/at all (?)).
How do I adjust the time interval to search again for known networks? It's a RaspberryPi running Arch Linux ARM headless, I need the wifi connection to login over SSH. Screen or LAN-Cable isn't available always. Rebooting isn't an option.
I didn't found something related to this by using the search function. If you know another thread a simple link would be also great. wink

Thx!

Last edited by wenugo (2016-10-14 21:30:33)

Offline

#2 2016-10-15 02:36:12

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: Netctl: Search interval for connecting automatically with known WiFi

You are doing it wrong... Don't use netctl at all for starting wpa_supplicant and/or dhcp, use it only for interface config, like MAC address. Instead, run plain wpa_supplicant, like wpa_supplicant-nl80211@.service and your favourite dhcp client preferrably with a disabled timeout (for dhcpcd, add -t0 to its command line in dhcpcd@.service) so it doesn't give up on a lease before the access point is available. In the corresponding configuration file for wpa_supplicant, add all known wifi networks. This way, wpa_supplicant will always be running and will handle roaming/reconnections, as well as interface up/down events. Dhcpcd will re-obtain leases.

With the above config, my laptop seamlessly reconnects between a tethered phone and  a usual wifi AP...

EDIT: In fact, on a simple dhcp setup, you don't need netctl at all. You only need it to set up bridges/bond or for static IPs. Just don't forget to disable all netctl@ services if the above setup works for you. I can give more details about it when I get to my laptop...

Last edited by Leonid.I (2016-10-15 02:39:09)


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#3 2016-10-20 21:37:56

wenugo
Member
Registered: 2016-10-14
Posts: 4

Re: Netctl: Search interval for connecting automatically with known WiFi

Thx a lot for the quick answer!
Until now I never worked directly with wpa_supplicant, so I will have get to know this first in the next time before testing this solution.
I thought netctl would have been working seamlessly on my laptop (just netctl, maybe I was wrong), so I thought it would be just some configuration work...

Last edited by wenugo (2016-10-20 21:40:31)

Offline

#4 2016-10-20 22:49:35

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: Netctl: Search interval for connecting automatically with known WiFi

Well, there is netctl-auto:

$ pacmain -Qi netctl
...
Optional Deps   :
...
wpa_actiond: for automatic wireless connections through netctl-auto

The script /usr/bin/netctl-auto builds a wpa_supplicant config file with the wifi profiles that you want to use (located in /etc/netctl/). Then wpa_supplicant and wpa_actiond are started. wpa_actiond uses wpa_cli to connect/disconnect when a given access point is in range/out of range.

However, I found this scheme to be too complicated, especially because wpa_supplicant can switch networks automatically. So, I just maintain /etc/wpa_supplicant/wpa_supplicant-nl80211.conf that contains all my desired wireless networks. On top of that, netctl always correlated dhcpcd (or dhclient) and wpa_supplicant state change. This is not necessary...

If you want, I can share my config as soon as I get to my laptop...


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

Board footer

Powered by FluxBB