Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Auto wireless reconnect [Band-Aid]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1338
Location: Sweating in South Florida

PostPosted: Fri Aug 05, 2005 12:38 am    Post subject: Auto wireless reconnect [Band-Aid] Reply with quote

I have my wireless network running just fine at home. The only problem I have is that the wireless network interface gets disconnected somehow. I am usually at work and using ssh to connect when all of a sudden my connection drops. I can still access my windows system via rdp, but I am unable to access my gentoo box. I am using wpa_supplicant with ndiswrapper, and for the most part, everything works great. I was just wondering if anyone out there has any similar experiences, or better yet, a solution.

Everything is static, no DHCP.

/etc/wpa_supplicant.conf:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
fast_reauth=1
ap_scan=1

network={
ssid="DavieJones"
scan_ssid=1
proto=WPA
key_mgmt=WPA-PSK
psk="OIWISHIWEREANOSCARMEYERWEINER"
}

/etc/conf.d/net:
iface_wlan0="192.168.10.5 broadcast 192.168.10.255 netmask 255.255.255.0"
...
modules=( "!iwconfig" "wpa_supplicant" )
iwconfig_wlan0="essid Mapuche"
wpa_supplicant_wlan0="-Dndiswrapper"


Last edited by msalerno on Fri Aug 05, 2005 3:39 pm; edited 2 times in total
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Fri Aug 05, 2005 10:28 am    Post subject: Reply with quote

baselayout-1.12.0 supports wpa_supplicant-0.4.x re-associating and bringing the network back up.

1.12.0_pre3-r2 is masked presently due to a serious hanging bug that some people are experiencing, but we hope to have this resolved soon :)
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1338
Location: Sweating in South Florida

PostPosted: Fri Aug 05, 2005 3:37 pm    Post subject: Reply with quote

Thanks for the feedback and time spent getting wireless working for all of us.

In the mean time, I just wrote a little script to take care of restarting the wireless network for me. It's pretty basic, it pings the wireless router or any device on your network that will always be up, if it fails 4 times, it restarts my wlan0 adapter. I just put it in a cron job and run it every 5 minutes.

Code:
#!/usr/bin/perl -w
use strict;
use Net::Ping;

my $ipofrouter = "192.168.10.1";
my $wirelessnic = "192.168.10.5";
my $restartcmd = qq|/bin/killall wpa_supplicant; /etc/init.d/net.wlan0 pause; /etc/init.d/net.wlan0 start|;
my $restartlogpth = "/var/log/wlanstart.log";

# No need to change anything below this line

open(LOG, ">> $restartlogpth") || die "Cannot Write to \"$restartlogpth\"";
my $now = localtime;

my $netping = Net::Ping->new("icmp");
$netping->bind($wirelessnic);

my $result = 0;
for ( my $i = 0; $i <= 3; $i++){
        $result-- if $netping->ping($ipofrouter,1);
        $result++ if !$netping->ping($ipofrouter,1);
}

if ($result == 4){
        print LOG "$now - Wireless adapter \"$wirelessnic\" is down - Restarting Net\n";
        system($restartcmd) == 0 || print LOG "$now - [ERROR] Unable to restart wireless adapter \"$wirelessnic\": Verify the command \"$restartcmd\"\n";
        }
else {
        print LOG "$now - Wireless adapter \"$wirelessnic\" is up\n";
        }

close LOG;
$netping->close();


Last edited by msalerno on Fri Aug 05, 2005 4:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Fri Aug 05, 2005 4:22 pm    Post subject: Reply with quote

Nice script :)

baselayout-1.12.0_pre4 is now in portage if you want to test that too :)
Back to top
View user's profile Send private message
lostlogic
Retired Dev
Retired Dev


Joined: 03 Oct 2002
Posts: 7
Location: IL, USA

PostPosted: Fri Sep 16, 2005 3:11 am    Post subject: Reply with quote

What about services stopped because of the network going down? Is there any automated way to get them back up? Really there is no reason for the net.ath0 service to be stopped just because the wireless connection dropped. This has been causing me major headaches since it started happening, because my wireless network goes out every time I use my microwave, and this would cause my mail and other servers to be down until I noticed what was going on and remembered to manually restart them after a network drop.
_________________
--Brandon
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1338
Location: Sweating in South Florida

PostPosted: Fri Sep 16, 2005 1:48 pm    Post subject: Reply with quote

In my situation, it was easier for me to just restart the wlan0 service.

lostlogic wrote:
What about services stopped because of the network going down?

When my wlan goes down, I don't need to restart any other services, they just start working when I bring wlan0 back up.

When I restart the wireless adapter, I use "pause" rather than "stop", since "pause" does not stop any dependant services.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Fri Sep 16, 2005 2:09 pm    Post subject: Reply with quote

lostlogic wrote:
What about services stopped because of the network going down? Is there any automated way to get them back up?


conf.d/net
Code:

postup() {
   rc
}


:)

Quote:
Really there is no reason for the net.ath0 service to be stopped just because the wireless connection dropped.


It's marked as "inactive" when this happens. As it's no longer "started" any services that depend on it get stopped. This is behaviour by design.

Quote:
This has been causing me major headaches since it started happening, because my wireless network goes out every time I use my microwave, and this would cause my mail and other servers to be down until I noticed what was going on and remembered to manually restart them after a network drop.


So use the above bit of code in conf.d/net then :)
Or change RC_STRICT_NET_CHECKING in conf.d/rc to "lo"
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
wafer_overflow
n00b
n00b


Joined: 08 Sep 2005
Posts: 4
Location: ITALY

PostPosted: Fri Sep 16, 2005 2:26 pm    Post subject: Reply with quote

Hi! I've the same kind of problem!
I'm using an ipw2200 on my laptop with the latest drivers and iwconfig. The network seems to stop continuosly and restart when any internet traffic is detected!

What could it be?

I've disabled power management!

Thanks, Alberto.
_________________
Registered Linux User n.° 324313
Back to top
View user's profile Send private message
lostlogic
Retired Dev
Retired Dev


Joined: 03 Oct 2002
Posts: 7
Location: IL, USA

PostPosted: Mon Sep 19, 2005 3:16 am    Post subject: Reply with quote

Cool, setting RC_STRICT_NET_CHECKING will do the job for me!

Thanks.
_________________
--Brandon
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum