# Multiple default gateways

## paully

Hi Folks

Since upgrading to baselayout-2, I now have multiple default gateways in my routing table, on a single wired ethernet connection...

```
thinkpad ~ # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.0.200   0.0.0.0         UG    0      0        0 eth0

0.0.0.0         192.168.0.200   0.0.0.0         UG    2      0        0 eth0

0.0.0.0         192.168.0.200   0.0.0.0         UG    202    0        0 eth0
```

Sure, I can zap the extra ones...

```
thinkpad ~ # route del default netmask 0.0.0.0 metric 202 dev eth0

thinkpad ~ # route del default netmask 0.0.0.0 metric 2 dev eth0
```

...to leave me with what I had before baselayout2...

```
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.0.200   0.0.0.0         UG    0      0        0 eth0
```

...but why I have I got these in the first place?!

Here is my /etc/conf.d/net which is using DHCP...

```
dhcpcd_eth0="-t 5"
```

...and this occurs on any network I join, work or friends.

Thanks.

Paully

----------

## Yuu

Hi,

could you post your /etc/conf.d/net file ?

I think you might have something like : routes_eth0="default gw 192.168.0.200..etc"

----------

## paully

```
thinkpad ~ # cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /usr/share/doc/openrc/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

dhcpcd_eth0="-t 5"
```

----------

## UberLord

What version of dhcpcd are you using?

Can you post output of the following?

dhcpcd -x

dhcpcd -dB

You can CTRL-C the dhcpcd process once you've colleted the data and just restart it with

dhcpcd

----------

## paully

 *UberLord wrote:*   

> What version of dhcpcd are you using?
> 
> ```
> thinkpad ~ # eix -I dhcp
> 
> ...

 

OK...

```
thinkpad ~ # dhcpcd

dhcpcd[3379]: version 5.2.12 starting

dhcpcd[3379]: eth0: rebinding lease of 192.168.1.210

dhcpcd[3379]: wlan0: waiting for carrier

dhcpcd[3379]: eth0: acknowledged 192.168.1.210 from 192.168.1.250

dhcpcd[3379]: eth0: checking for 192.168.1.210

dhcpcd[3379]: eth0: leased 192.168.1.210 for 3600 seconds

dhcpcd[3379]: forked to background, child pid 3442
```

My routing table now reads...

```
thinkpad ~ # route -n

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     202    0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.1.1     0.0.0.0         UG    202    0        0 eth0
```

...which is correct and without the extra default gateways. So, what do I need to do?

I notice there is version ~5.2.12-r1 which I could unmask and try?

Thanks UberLord.

----------

## Dagger

Do you have both /etc/init.d/net.eth0 AND /etc/init.d/network running?

----------

## paully

No, just /etc/init.d/net.eth0 (and /etc/init.d/net.lo) in the boot runlevel.

----------

## paully

Well, I have removed net.eth0 from the boot runlevel and added network instead.

It has not made any difference to the multiple default gateways.

Here is the routing for my wireless connection:-

```
thinkpad ~ # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0

0.0.0.0         192.168.0.1     0.0.0.0         UG    304    0        0 wlan0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

127.0.0.0       -               255.0.0.0       !     0      -        0 -

192.168.0.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0
```

It all works, but can anyone explain why we have this now? Seriously, is there no-one?

 :Confused: 

----------

## boerKrelis

does 

```
egrep -R ' (via|gw) ' /etc/runlevels/*
```

 yield any insights?

----------

