Auto-reconnect to wifi

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

Auto-reconnect to wifi

Postby KingDuckZ » Fri Sep 28, 2012 9:14 am

Hello, I start my Raspberry connection at startup using wpa_supplicant@wlan0.service and dhcpcd-wifi-wpa@wlan0.service, which is a customized version of dhcpcd, like this:
$this->bbcode_second_pass_code('', '[Unit]
Description=dhcpcd for WPA-protected wifi on %I
Wants=network.target
Requires=wpa_supplicant@%I.service
After=wpa_supplicant@%I.service
Before=network.target

[Service]
Type=forking
PIDFile=/run/dhcpcd-%I.pid
ExecStart=/sbin/dhcpcd -A -q -w %I
ExecStop=/sbin/dhcpcd -k %I

[Install]
Alias=multi-user.target.wants/dhcpcd-wifi-wpa@wlan0.service')
This works just fine, but sometimes I can't ping my raspberry anymore. I suspect the router I connect to (I don't have access to it) is of low quality and the network sometimes goes down. Is there a way to make sure my raspberry tries to reconnect and obtain an IP everytime the connection is lost?
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: Auto-reconnect to wifi

Postby Kurlon » Fri Sep 28, 2012 2:18 pm

I'm using network manager (bit thicker setup than you're using) and it seems to handle glitches decently.
Kurlon
 
Posts: 132
Joined: Fri Jan 06, 2012 10:05 pm

Re: Auto-reconnect to wifi

Postby WarheadsSE » Fri Sep 28, 2012 3:10 pm

Have you considered net-auto-wireless ?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Auto-reconnect to wifi

Postby KingDuckZ » Fri Sep 28, 2012 3:23 pm

Sort of, I think I've seen another post from you where you mention that. Can you explain me what it is please? I have nothing like net-auto-wireless.service in my /usr/lib/systemd/system and pacman -Ss net-auto-wireless returns nothing.

Edit: I just got disconnected again, but this time I tried to login through eth0 (ie with a cable). The system was still running, and ifconfig still reported wlan0 to have the expected ip. In turn restarting dhcpcd and wpa_supplicant failed, as well as pinging some www address. And of course I couldn't ping my raspberry from the outside.
Last edited by KingDuckZ on Fri Sep 28, 2012 3:31 pm, edited 1 time in total.
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: Auto-reconnect to wifi

Postby WarheadsSE » Fri Sep 28, 2012 3:29 pm

Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Auto-reconnect to wifi

Postby KingDuckZ » Fri Sep 28, 2012 3:48 pm

I think I'm a bit confused now. My raspberry is using systemd, so rc.conf is deprecated, no? Here's what I found from the page you linked: https://wiki.archlinux.org/index.php/Ne ... o-wireless
In fact, I don't even have an rc.* in my /etc. Isn't there a systemd way to run this net-auto-wireless? (btw locate net-auto-wireless didn't find anything either)
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: Auto-reconnect to wifi

Postby WarheadsSE » Fri Sep 28, 2012 3:55 pm

it is part of the netcfg package.
$this->bbcode_second_pass_code('', 'systemctl enable net-auto-wireless.service')
Also:
$this->bbcode_second_pass_code('', 'ls /usr/lib/systemd/system/')
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Auto-reconnect to wifi

Postby Lugz » Fri Sep 28, 2012 8:07 pm

Use network manager. It will auto reconnect and auto connects on startup. I switched from wpa supplicant as it works consistently.
Lugz
 
Posts: 8
Joined: Thu Nov 03, 2011 5:58 pm

Re: Auto-reconnect to wifi

Postby KingDuckZ » Sat Sep 29, 2012 7:26 pm

@WarheadsSE: I tried the netcfg package, but right after starting the service I lost the connection. I tried unlinking the newly created link manually from the SD card but I still have no connection on boot.
Can you tell me what services I need to enable exactly please? I'll double check the wiki page you gave me but all that rc.conf stuff was confusing me.

@Lugz: Thanks but I'd like to avoid network manager for now if possible.
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: Auto-reconnect to wifi

Postby WarheadsSE » Sat Sep 29, 2012 8:28 pm

Sure.

1) use disable.
$this->bbcode_second_pass_code('', 'systemctl disable <blarg>')
2) Read the netcfg wiki page.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Next

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 6 guests