# eth0 lost default gateway

## magowiz

Hi,

I'm having the following problem : If I launch amule, after some time I get the whole connection unusable: for example I cannot ping www.google.it neither using directly its ip (so it isn't a resolving issue). I thought it was a buffer problem but also if I close amule and wait some minutes I get nothing, after the ping command I get no output at all (but ping keeps running). So I tried to run ifconfig to check it's all right and I have an output similar to other pc that works. So I tried to have a look to route table :

```

#route 

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     *               255.255.255.240 U     0      0        0 eth0

2.1.21.0        *               255.255.255.0   U     0      0        0 eth0

loopback        *               255.0.0.0       U     0      0        0 lo

default         *               0.0.0.0         U     0      0        0 eth0

```

it seems somehow I lost default gateway that should be 2.1.21.1 , infact if I do :

```
#route add default gw 2.1.21.1 eth0 

#ping www.google.it

PING google.navigation.opendns.com (208.67.217.230) 56(84) bytes of data.

64 bytes from google.navigation.opendns.com (208.67.217.230): icmp_seq=1 ttl=50 time=100 ms

64 bytes from google.navigation.opendns.com (208.67.217.230): icmp_seq=2 ttl=50 time=100 ms

64 bytes from google.navigation.opendns.com (208.67.217.230): icmp_seq=3 ttl=50 time=100 ms

64 bytes from google.navigation.opendns.com (208.67.217.230): icmp_seq=4 ttl=50 time=100 ms

64 bytes from google.navigation.opendns.com (208.67.217.230): icmp_seq=5 ttl=50 time=100 ms

64 bytes from google.navigation.opendns.com (208.67.217.230): icmp_seq=6 ttl=50 time=100 ms

64 bytes from google.navigation.opendns.com (208.67.217.230): icmp_seq=7 ttl=50 time=100 ms

```

Mine network configuration is :

```

config_eth0=("dhcp"

      "192.168.1.2 netmask 255.255.255.240 broadcast 192.168.1.255" 

   )

dhcp_eth0="release nodns"

routes_eth0=("default")

```

What should it be ?

Obviously also if I restart net.eth0 service I get back connection.

----------

## Helena

what a strange network configuration...

why don't you use a simple blank configuration - since you seem to use DHCP - or a simple static configuration like

```
config_eth0=( "192.168.1.100/24" )

routes_eth0=( "default via 192.168.1.1" )
```

I always use one of these and never had that problem.

----------

## magowiz

 *Helena wrote:*   

> what a strange network configuration...
> 
> why don't you use a simple blank configuration - since you seem to use DHCP - or a simple static configuration like
> 
> ```
> ...

 

Mine configuration is like this because I use dhcp and ip aliasing, the real ip is given by dhcp and 192.168.1.2 is the alias IP I use for example for have static references to machines to use ssh on my LAN.

----------

## Helena

So you're performing NAT by hand, are you? Network configuration is tricky. It seems that you have a ISP with DHCP (as I do). Do you use a router (you have a LAN you said)? Does this router (or another active component like a WiFi accesspoint) also perform DHCP? Is there any chance that your IP alias is also used by another DHCP server? Etc.etc.

I wonder if this has a particular Gentoo origin or is general network problem.

----------

## magowiz

 *Helena wrote:*   

> So you're performing NAT by hand, are you? Network configuration is tricky. It seems that you have a ISP with DHCP (as I do). Do you use a router (you have a LAN you said)? Does this router (or another active component like a WiFi accesspoint) also perform DHCP? Is there any chance that your IP alias is also used by another DHCP server? Etc.etc.
> 
> I wonder if this has a particular Gentoo origin or is general network problem.

 

Mine ISP is a big NAT , each one gets a IP in a preset of 5 private fixed IP assigned via dhcp , is not a proper router anyway it performs dhcp . The problem comes out only with amule, I have other machines with the same configuration and I have no problems.

EDIT : And also in this pc I get no problems if I don't start amule so I don't think mine configuration is wrong.

----------

## magowiz

It happened again but this time I found the cause , it is the buffer saturation. 

Amule fills the buffer space, then when dhcpd tries to renew the lease it gets a "no buffer space available" and fall backs with ipv4ll that assigns a random IP and perhaps alters the route table as described above. I tried to disable ipv4ll support in dhcpd appending the -L option to dhcp_eth0 parameters in /etc/conf.d/net but I don't know if it will work.

Is there a way if a lease fails to preserve ip and routing table ?

----------

## magowiz

It seems that options -A and -E suite me, I added them to dhcp_eth0 into /etc/conf.d/net and I hope it will work.

----------

## magowiz

It didn't work, is there a way to add statically a route to eth0 in /etc/conf.d/net ? I would like that this route will be kept and dhcpcd doesn't delete it.

----------

