My router looses network connection after a day or so

Discussion about my Wifi Radio project at http://mightyohm.com/wifiradio/ or my WL-520gU talk at NOTACON.
User avatar
mightyohm
Site Admin
Posts: 1063
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: My router looses network connection after a day or so

Post by mightyohm »

It should have an IP address. This is what mine looks like:

Code: Select all

wl0       Link encap:Ethernet  HWaddr 00:22:15:9A:EB:34
          inet addr:192.168.24.153  Bcast:192.168.24.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:208284 errors:0 dropped:0 overruns:0 frame:578359
          TX packets:179770 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:92043695 (87.7 MiB)  TX bytes:13182543 (12.5 MiB)
          Interrupt:2 Base address:0x5000
Can your share your /etc/config/network and /etc/config/wireless?
tuti76
Posts: 11
Joined: Thu Sep 23, 2010 10:29 pm

Re: My router looses network connection after a day or so

Post by tuti76 »

I thought so. Here are the config files:


root@OpenWrt:~# vi /etc/config/wireless
config wifi-device wl0
option type broadcom
option channel 5

# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1

config wifi-iface
option device wl0
option network lan
option mode sta
option ssid T-Mobile@Home
option encryption psk
option key josswest







root@OpenWrt:~# vi /etc/config/network
#### VLAN configuration
config switch eth0
option vlan0 "1 2 3 4 5*"
option vlan1 "0 5"


#### Loopback configuration
config interface loopback
option ifname "lo"
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0


#### LAN configuration
config interface lan
option type bridge
option ifname "eth0.0"
option proto static
option ipaddr 192.168.0.110
option netmask 255.255.255.0
option gateway 192.168.0.1
option dns 8.8.8.8
#### WAN configuration
config interface wan
option ifname "eth0.1"
option proto dhcp
tuti76
Posts: 11
Joined: Thu Sep 23, 2010 10:29 pm

Re: My router looses network connection after a day or so

Post by tuti76 »

But here is the question: how can I ping it and how can I log into it (wirelessly) ?
The Asus is never hard wired to the network.
User avatar
mightyohm
Site Admin
Posts: 1063
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: My router looses network connection after a day or so

Post by mightyohm »

If you follow the instructions here you should be able to ssh to the router over the wireless network. You'll have to figure out the IP for the wireless interface first.

http://mightyohm.com/blog/2009/05/build ... -and-ends/

Here is my /etc/config/wireless

Code: Select all

config wifi-device  wl0
        option type     broadcom
        option channel  5

        # REMOVE THIS LINE TO ENABLE WIFI:

config wifi-iface
        option device   wl0
        option network  wan
        option mode     sta
        option ssid     MYSSID
        option encryption wep
        option key 123456789
and /etc/config/network

Code: Select all

#### VLAN configuration
config switch eth0
        option vlan0    "1 2 3 4 5*"
        option vlan1    "0 5"


#### Loopback configuration
config interface loopback
        option ifname   "lo"
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0


#### LAN configuration
config interface lan
        #option type    bridge
        option ifname   "eth0.0"
        option proto    static
        option ipaddr   192.168.1.1
        option netmask  255.255.255.0

I think you want to disable bridging on the LAN and move the wireless to "option network wan". Back up your original files in case you need to go back!
tuti76
Posts: 11
Joined: Thu Sep 23, 2010 10:29 pm

Re: My router looses network connection after a day or so

Post by tuti76 »

This is the change I made:


root@OpenWrt:~# vi /etc/config/network
#### VLAN configuration
config switch eth0
option vlan0 "1 2 3 4 5*"
option vlan1 "0 5"


#### Loopback configuration
config interface loopback
option ifname "lo"
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0


#### LAN configuration
config interface lan
#option type bridge
option ifname "eth0.0"
option proto static
option ipaddr 192.168.0.110
option netmask 255.255.255.0
option gateway 192.168.0.1
option dns 8.8.8.8
#### WAN configuration
config interface wan
option ifname "eth0.1"
option proto static
option ipaddr 192.168.0.110
option netmask 255.255.255.0
option gateway 192.168.0.1
option dns 8.8.8.8



I just rebooted the router after applying these changes and now the router is up and running. I'll just have to give it some time see what happens.

Another interesting thing worth mentioning is the fact that when I pinged it all night from a PC, it did not get off line. I will stop the ping now and with the new network config file, I'll wait to see if it goes offline.

I'll let you know.
User avatar
mightyohm
Site Admin
Posts: 1063
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: My router looses network connection after a day or so

Post by mightyohm »

What is your home network like? What wireless router / access point are you using? Anything unusual about the setup?

I suspect that your wireless router is terminating the connection after x hours of inactivity.
tuti76
Posts: 11
Joined: Thu Sep 23, 2010 10:29 pm

Re: My router looses network connection after a day or so

Post by tuti76 »

There is really nothing unusual about the network. The router is a Linksys WRTU54G-TM.
I had it for about 2 years now and no problems whatsoever.
I have a PS3 and a Wii on the network as well and those do not loose connectivity.
Again, as I mentioned in the previous post: The router did not loose wireless while I was pinging it all night (about 12 hours).
Don't you think that's odd?
I think when it is being solicited to respond to something or to run a service it stays online. When I didn't ping it it still ran the MPD, but it lost connection, but pinging it, it was required to respond and it didn't loose it.
What do you think?
User avatar
mightyohm
Site Admin
Posts: 1063
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: My router looses network connection after a day or so

Post by mightyohm »

My suspicion is that there is no (zero) activity on the wireless connection to the WL-520gU if you are not streaming music or pinging, so one side or the other is losing the DHCP lease or dropping the connection. It is not so strange, because usually you will have some kind of periodic network activity that would keep the connection alive. In my case, I never use the radio without it streaming music (I simply turn it off when not in use) so I have not encountered this issue. That said, I left the radio on overnight (with mpd stopped) and I was still able to communicate with it in the morning.

I believe the solution is to either change the DHCP lease time on your WRT54G, or modify the networking settings on the WL-520 to add a keepalive or figure out why it is not periodically renewing the DHCP lease (which I believe it should).
tuti76
Posts: 11
Joined: Thu Sep 23, 2010 10:29 pm

Re: My router looses network connection after a day or so

Post by tuti76 »

I agree, it should keep the DHCP lease as the Linksys's DHCP timer is at 0 (zero) - meaning 7 days.
Remember yesterday I was pinging from the Asus and lost connection. Last night until this morning I was pinging the Asus from my PC at it didn't.
Anyways, how do I add a line and where for a keep alive timer? I think it's worth a try.
User avatar
mightyohm
Site Admin
Posts: 1063
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: My router looses network connection after a day or so

Post by mightyohm »

Hmm. You could try adding the line (make sure the IP is valid for your network)

ping 192.168.0.1 &

to one of the boot scripts, maybe /etc/init.d/done:

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

START=95
boot() {
[ -d /tmp/root ] && {
lock /tmp/.switch2jffs
firstboot switch2jffs
lock -u /tmp/.switch2jffs
}

# set leds to normal state
. /etc/diag.sh
set_state done

# ping forever
ping 192.168.0.1 &

}

Or create a new boot script for it, using one of the existing ones an an example (and create a link in /etc/rc.d)... I'm not sure what the "correct" way to do this is.

Another option would be to create a cron job that runs once every minute or so and executes the ping command. There is lots of info online about using cron.
Post Reply