Default gateway is lost

1

1

A weird thing is happening here.

I am using TPLINK WDR3600 as server, which is connected through Ethernet with a modem in bridge mode.

I use 2 PCs and a cell phone on my LAN.

Something is happening and the default gateway (192.168.1.1, which is TPLINK's address) is lost and then the connection is lost from one PC. Then, after a while (or maybe not), the connection from the other PC is lost, but I can still connect to the Internet through the cell phone!

I did:

route add default gw 192.168.1.1 wlan0

to the PC which had the problem. When I do that, the connection comes back immediately. And also the connection comes back to the other PC!

But after some time, the 192.168.1.1 is lost again! and, along with it, the connection.

The route -n (without the 192.168.1.1):

Kernel IP routing table
Destination    Gateway        Genmask          Flags  Metric  Ref    Use  Iface
192.168.1.0    0.0.0.0        255.255.255.0    U      9       0        0  wlan0
192.168.1.151  127.0.0.1      255.255.255.255  UGH    304     0        0  lo

route -n (after adding it):

Kernel IP routing table
Destination    Gateway        Genmask          Flags  Metric  Ref    Use  Iface
0.0.0.0        192.168.1.1    0.0.0.0          UG     0       0        0  wlan0
192.168.1.0    0.0.0.0        255.255.255.0    U      9       0        0  wlan0
192.168.1.151  127.0.0.1      255.255.255.255  UGH    304     0        0  lo

Also, adding the route gateway doesn't make it permanent as I saw. Maybe that is the problem and it is lost again during time? How can I do it permanently?

I am using Linux Sabayon.

My /etc/conf.d/net in desktop:

    ...
    ###### Connection Configuration ######
#----------------------------------
nis_domain_eth1="localdomain"
dns_domain_eth1="localdomain"
dhcp_eth1="nosendhost"

    dns_search_eth2="193.92...."
    auto_eth2="true"
    config_eth2="192.168.1.2/24"
    dns_servers_eth2="194.219...."
    routes_eth2="default via 194.168.1.1"
    enable_ipv6_eth2="false"
    ...
----------------------------------
mac_0....C="0......F"
dns_servers_0x...C="192.168...."
enable_ipv6_0x...C="true"
auto_0x4....="true"
config_0x...C="
dhcp
dhcp6
"
#----------------------------------
nis_domain_wlan0="localdomain"
dns_domain_wlan0="localdomain"
dhcp_wlan0="nosendhost"
#----------------------------------
nis_domain_eth0="localdomain"
dns_domain_eth0="localdomain"
dhcp_eth0="nosendhost"

Why does it have eth2 and not wlan0?

ifconfig -a:

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00....33  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 0.....5  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 469  bytes 61541 (60.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 469  bytes 61541 (60.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.151  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe....df  prefixlen 64  scopeid 0x20<link>
        ether 00....f  txqueuelen 1000  (Ethernet)
        RX packets 2054  bytes 742929 (725.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2759  bytes 524901 (512.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I just saw that in my laptop the /etc/conf.d/net file:

nis_domain_wlan0="localdomain"
dns_domain_wlan0="localdomain"
dhcp_wlan0="nosendhost"
#----------------------------------
nis_domain_eth0="localdomain"
dns_domain_eth0="localdomain"
dhcp_eth0="nosendhost"

contains only this info instead of the net file in my desktop.

George

Posted 2014-01-08T22:32:58.740

Reputation: 167

Answers

2

Linux Sabayon is based on Linux Gentoo.

Also, adding the route gateway doesn't make it permanent as I saw.

Correct. To make permanent configuration, per the Gentoo networking manual:

In file /etc/conf.d/net

Create a row

routes_wlan0="default via 192.168.1.1"

Restart you network interface. Depending on your configuration it could be:

/etc/init.d/net.wlan0 restart

EDIT

Anyway, in this file which you found replace

routes_eth2="default via 194.168.1.1"

with

routes_wlan0="default via 192.168.1.1"

eth2 and wlan0 are names of your network interfaces. By saying routes_wlan0 you specifying that this configuration is for interface wlan0.

VL-80

Posted 2014-01-08T22:32:58.740

Reputation: 3 867

:I checked net file and it contains routes_eth2="default via 194.168.1.1" !I don't know what it is or what I should do now.Do I have to delete that?(I updated my post to see the net file).Thank you – George – 2014-01-08T22:49:11.747

:Can I reset somehow this file?And do you thing that is my problem?That the gateway is lost after some time? – George – 2014-01-08T22:50:29.080

@George, And do you thing that is my problem?, most likely - yes. Could you edit your question and include output of command ifconfig -a. This will help us to do correct thing. – VL-80 – 2014-01-08T23:23:27.427

:I included ifconfig.Please tell me if I must replace all 'eth2' with 'wlan0' or if we can reset this file.Thanks! – George – 2014-01-09T08:07:36.937

:I also uploaded all the 'net' file in my desktop and in my laptop.And they are a lot different! – George – 2014-01-09T08:28:12.210

@NikolayL:Sorry for the messages but I encounter problems.I added the route 192.168.1.1 in net file ,ok with the connection with the desktop but suddenly the connection of laptop cut off.It asked me a lot of times "The network myOpenWrt requires authentication" .And after some tries the connection came back.So,it is not a problem of adding the gateway?I don't know..I need help.:). – George – 2014-01-09T08:38:40.940

:A strange thing happened.When I took my laptop near to router it connected immediately (even though I had 50%signal at my office and I hadn't any problem befora (with my modem only)).Maybe somehow TPLINK WDR3600 can't forward route? – George – 2014-01-09T09:30:07.093

:I thing for some reason , the router signal drops and this results in losing the default gateway?I am not sure.. – George – 2014-01-09T15:53:55.650

Did you do changes I told you to do - routes_wlan0="default via 192.168.1.1"? This will save default gateway settings. – VL-80 – 2014-01-09T16:06:50.287

:Yes (and I left everything else as _eth2 nad I tried _wlan0) but still the problem.For some reason the signal drops I thing and then it messes with route.(I have 20db signal though).Can I do sth?If this is the case. – George – 2014-01-09T16:27:56.897

:Sorry for disturbing..Do you have any ideas for that?It doesn't hold the route "routes_wlan0="default via 192.168.1.1".Is there sth else I can do about that?Thank you – George – 2014-01-10T11:43:51.023

OK. I do not have full picture of your situation and what is happening, so there can be many other reasons why your connection does not work properly. Your /etc/conf.d/net should not have anything with eth2 suffix. You do not have interface eth2. So replace anything that says eth2 to wlan0. These settings will be applied to your wireless connection. – VL-80 – 2014-01-10T14:03:03.593

:Ok,I understand.I erased all net file and left only the last portion from "nis_domain_wlan0="localdomain".....And it seems to work fine now!The disconnections maybe where from this configuration maybe from the routers signal.Thanks! – George – 2014-01-10T15:22:50.560

:Hello , if you could help me with this,I will appreciate.http://superuser.com/questions/699972/vpn-connected-but-no-internet-openwrt-router-as-server . Thanks

– George – 2014-01-10T21:04:35.717