LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Connectivity fails (with WN111v2) during high traffic (https://www.linuxquestions.org/questions/linux-networking-3/connectivity-fails-with-wn111v2-during-high-traffic-4175466374/)

MultiSith 06-17-2013 01:21 PM

Connectivity fails (with WN111v2) during high traffic
 
I'm trying to make-do with a Netgear (WN111v2) USB wifi card ...and I'm frustrated. The connection seems to work out-of-the-box with the carl9170 module. Low-bandwidth internet access seems fine and can endure for semi-long periods of time. But, during periods of high through-put, connectivity eventually ceases. The interface remains up but I cannot ping the gateway interface. (Wireshark shows some LLC stuff. If anyone thinks that will be helpful, ask.)

My first solution included disconnecting/reconnecting the nic. In the past, I've also remedied the problem by creating a cron job to unload/reload the module forcing the connection to reset. The best solution I found was a 50-ft ethernet cable--but wifi-alternatives are longer an option. So, I'm looking for a fix or help with my work-around script.

The best solution would prevent the lapse in connectivity. I haven't researched about this in several months but I believe it boils down to firmware/module issues--something I'm not really too comfortable addressing in detail. If you're familiar with the problem and know of a permanent solution, I'd be happy to implement it. But I am hesitant to experiment with it when I KNOW work arounds will suffice.

My plan-b solution is to create a script (to be run via cron, unless someone has a better idea) to check connectivity and reset the connection (original credit goes to some thread I found weeks ago, but I've been tweaking...):
Code:

# restart wifi if lacking connectivity
dest=192.168.0.1
limit=50
loss=100

loss=$(ping -c 3 -i 3 -W 15 $dest | grep -o "[0-9]*%" | tr -d %) > /dev/null 2>&1
if [ "$loss" -gt "$limit" ]; then
        logger "pinger: packet loss ($loss%) exceeded $limit, restarting network-manager ..."
        service network-manager restart
fi

...which causes cron to mail me...
Code:

/usr/bin/service: 127: /usr/bin/service: stop: not found
/usr/bin/service: 128: exec: start: not found

I thought maybe "service" might be having permission issues, so I did 'chown root:root' and 'chmod +s' to the script. (I also tried "sudo service network-manager restart" in the script but both got me a long block of something like this:
Code:

stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.138" (uid=1001 pid=15151 comm="stop network-manager ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.139" (uid=1001 pid=15148 comm="start network-manager ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")

...which, I think, is the same thing I get by executing "service network-manager restart" (as a user). FYI, "sudo service network-manager restart" does the trick--if only I could automate this!

I know I'm close! Can anyone offer some suggestions?

Advice and URLs on permissions in the context of cron would be welcome. I'm not sure I understand that thoroughly and most of the stuff I've found has to do with either cron or permissions; it doesn't seem complicated but maybe I'm missing something.

(I don't know that a hammer is the right tool for this job but its sounding like a better and better plan.:D)

nini09 06-19-2013 03:52 PM

The working directory could be different when cron tool launch the script. Maybe you should change current directory when you run service.

MultiSith 06-20-2013 01:55 AM

Quote:

Originally Posted by nini09 (Post 4974939)
change current directory when you run service

Thanks for the suggestion! I added "cd /path/to/script" but I'm still having trouble.
I thought it worked but my authentication from sudo was still a factor when I tested. I am receiving
Code:

sudo: no tty present and no askpass program specified
from cron via mail.

So, I tried removing "sudo" from "service network-manager restart" but, in that case, I still get:
Code:

stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.49" (uid=1001 pid=11812 comm="stop network-manager ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.50" (uid=1001 pid=11809 comm="start network-manager ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")

The script belongs to root and the permissions are: rwxrwxrwt. It works if I run the script with sudo ...so why not as cron with sticky bit? Is there another way to restart the wireless that might be more effective?

MultiSith 06-20-2013 02:01 PM

Alright, my script solution is implemented. I ended up putting /usr/sbin/service into /etc/sudoers for my account and reseting the file permissions to mine (751). HERE is a link for more information about running a script as root. I'm open to alternatives if anyone can suggest a better way.

Meanwhile, I have an every-two-minute cron job for a script to ping and possibly restart network manager. Its a solution but the key issue is losing connectivity to begin-with. I'll keep the thread open in the interest of an actual solution. (And, call me picky, but... I would prefer not to make the hdd's arm dance every 120-seconds for the rest of its understandably-short life. This is an old desktop, not a production server. Poor thing deserves to sleep if it can. )

I'm not sure if it is related to the lapse in connectivity but I do occasionally see this in my syslog:
Code:

ieee80211 phy0: invalid plcp cck rate (0).
I wonder if this is the reason for the disconnection or indicative of self-correction...? Otherwise, I haven't noticed anything I don't understand to be normal. Is there another log file I could be monitoring?

nini09 06-20-2013 03:40 PM

For CRON issue, they have configuration file. You should check these files and content, such as environment macro, like PATH. The following link may help you.
http://www.cyberciti.biz/faq/how-do-...-or-unix-oses/

For root cause, WiFi driver issue, you can check patch or new version. The message you got should be from WiFi driver. It tell you driver got trouble. Some driver can recover itself and some need reset.

MultiSith 06-21-2013 01:09 AM

Quote:

Originally Posted by nini09 (Post 4975585)

Sweet, very good link. Thank you!

I currently have the script working */2 * * * * with crontab (as user via sudoers) but I had also tried using /etc/crontab, thinking it would execute as root. I believe that's where I got confused. In any case, it seems to be working now. I'm looking into driver version to see if I have the latest...


All times are GMT -5. The time now is 09:51 AM.