# Multiple WAN DHCP problem (not a DHCP server issue)

## dbishop

Hi all,

I have a multi-homed host with three NICs.  Each NIC successfully gets a DHCP address from its respective WAN-side DHCP server, but the interfaces aren't getting set up correctly.  If I set one to DHCP and the others to static from withing conf.d/net it all works the way I think it should.  I've tried overriding a lot of DHCP options but still won't work if all the NICs are configured for DHCP.  I am using iproute2-2.6.35-r2 and dhcpcd-5.2.12. Kernel is 2.6.38-gentoo-r6. Please note that these are two different DHCP servers on two different NICs coming from two different ISPs with two different physical infrastructures.  I can find toms of help for the server side but not for the dhcpcd client side.

my confd.net:

```
dhcpcd_eth0="-t 60"

dhcpcd_eth1="-t 60 release nodns nontp nonis nogateway nosendhost"

dhcpcd_eth2="-t 60 release nodns nontp nonis nogateway nosendhost"

```

gets me this on reboot network startup:

```
gentoo01 ~ # ip route 

172.16.3.128/25 dev eth0  proto kernel  scope link  src 172.16.3.223  metric 5 

127.0.0.0/8 via 127.0.0.1 dev lo 

default via 172.16.3.129 dev eth0  metric 5 

gentoo01 ~ # ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 00:1b:21:9a:1b:d0 brd ff:ff:ff:ff:ff:ff

    inet6 fe80::21b:21ff:fe9a:1bd0/64 scope link 

       valid_lft forever preferred_lft forever

3: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000

    link/ether 00:1b:21:9a:1b:d3 brd ff:ff:ff:ff:ff:ff

4: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN 

    link/ether ee:7f:29:11:64:e4 brd ff:ff:ff:ff:ff:ff

5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 1c:6f:65:a5:40:78 brd ff:ff:ff:ff:ff:ff

    inet 172.16.3.223/25 brd 172.16.3.255 scope global eth0

    inet6 fe80::1e6f:65ff:fea5:4078/64 scope link 

       valid_lft forever preferred_lft forever

6: tunl0: <NOARP> mtu 1480 qdisc noop state DOWN 

    link/ipip 0.0.0.0 brd 0.0.0.0

7: sit0: <NOARP> mtu 1480 qdisc noop state DOWN 

    link/sit 0.0.0.0 brd 0.0.0.0

gentoo01 ~ # /etc/init.d/net.eth1 status 

 * status: started
```

So, eth0 gets configured correctly via DHCP from WAN DHCP server #1, but eth1 is not showing its IP address.  eth1 is definitely started and got an IP via the WAN DHCP server (totally different ISP than eth0)

When I try to restart net.eth1, I get variations on this:

```
gentoo01 ~ # /etc/init.d/net.eth1 restart

 * Bringing up interface eth1

 *   No configuration specified; defaulting to DHCP

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[6576]: dhcpcd already running on pid 2656 (/var/run/dhcpcd.pid)                                                                                                                                          [ !! ]

 * ERROR: net.eth1 failed to start

gentoo01 ~ # /etc/init.d/net.eth1 stop   

 * WARNING: net.eth1 is already stopped

gentoo01 ~ # /etc/init.d/net.eth1 start

 * Bringing up interface eth1

 *   No configuration specified; defaulting to DHCP

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[6724]: dhcpcd already running on pid 2656 (/var/run/dhcpcd.pid)                                                                                                                                          [ !! ]

 * ERROR: net.eth1 failed to start

gentoo01 ~ # chk dhcpcd

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

root      2490  0.0  0.0   2028   332 ?        Ss   11:06   0:00 dhcpcd -t 60 -m 5 eth0

root      2656  0.0  0.0   2028   652 ?        Ss   11:06   0:00 dhcpcd -t 60 release nodns nontp nonis nogateway nosendhost -m 2 eth1

gentoo01 ~ # /etc/init.d/net.eth1 stop 

 * WARNING: net.eth1 is already stopped

gentoo01 ~ # chk dhcpcd

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

root      2490  0.0  0.0   2028   332 ?        Ss   11:06   0:00 dhcpcd -t 60 -m 5 eth0

root      2656  0.0  0.0   2028   652 ?        Ss   11:06   0:00 dhcpcd -t 60 release nodns nontp nonis nogateway nosendhost -m 2 eth1

gentoo01 ~ # kill 2656

gentoo01 ~ # chk dhcpcd

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

root      2490  0.0  0.0   2028   332 ?        Ss   11:06   0:00 dhcpcd -t 60 -m 5 eth0

gentoo01 ~ # /etc/init.d/net.eth1 start

 * Bringing up interface eth1

 *   No configuration specified; defaulting to DHCP

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[9436]: version 5.2.12 starting

dhcpcd[9436]: release: interface not found or invalid

dhcpcd[9436]: nodns: interface not found or invalid

dhcpcd[9436]: nontp: interface not found or invalid

dhcpcd[9436]: nonis: interface not found or invalid

dhcpcd[9436]: nogateway: interface not found or invalid

dhcpcd[9436]: nosendhost: interface not found or invalid

dhcpcd[9436]: eth1: rebinding lease of 192.168.0.6

dhcpcd[9436]: eth1: acknowledged 192.168.0.6 from 192.168.0.1 `ÿ'

dhcpcd[9436]: eth1: checking for 192.168.0.6

dhcpcd[9436]: eth1: leased 192.168.0.6 for 86400 seconds

dhcpcd[9456]: eth1: eth1: MTU set to 576

dhcpcd[9436]: forked to background, child pid 9476                                                                                                                                                              [ ok ]

 *     received address 192.168.0.6/24                                                                                                                                                                          [ ok ]

gentoo01 ~ # ip route 

172.16.3.128/25 dev eth0  proto kernel  scope link  src 172.16.3.223  metric 5 

127.0.0.0/8 via 127.0.0.1 dev lo 

default via 172.16.3.129 dev eth0  metric 5 

gentoo01 ~ # ip addr  

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 00:1b:21:9a:1b:d0 brd ff:ff:ff:ff:ff:ff

    inet6 fe80::21b:21ff:fe9a:1bd0/64 scope link 

       valid_lft forever preferred_lft forever

3: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000

    link/ether 00:1b:21:9a:1b:d3 brd ff:ff:ff:ff:ff:ff

4: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN 

    link/ether ee:7f:29:11:64:e4 brd ff:ff:ff:ff:ff:ff

5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 1c:6f:65:a5:40:78 brd ff:ff:ff:ff:ff:ff

    inet 172.16.3.223/25 brd 172.16.3.255 scope global eth0

    inet6 fe80::1e6f:65ff:fea5:4078/64 scope link 

       valid_lft forever preferred_lft forever

6: tunl0: <NOARP> mtu 1480 qdisc noop state DOWN 

    link/ipip 0.0.0.0 brd 0.0.0.0

7: sit0: <NOARP> mtu 1480 qdisc noop state DOWN 

    link/sit 0.0.0.0 brd 0.0.0.0
```

So, on reboot, the interfaces start correctly, dhcpcd gets addresses from each respective WAN DHCP server, but only interface (eth0) shows an IP.

When I have set eth0 to the IP it gets from the WAN in conf.d/net (i.e., config_eth0="172.16.3.223/25", dhcpcd works for eth1, and if I set eth1 in conf.d/net, eth0 works correctly vis dhcpcd.

I'm sure it's something basic, but I can't see what it is.  Any help is appreciated.

----------

## dbishop

Hi All,

Well I figured it out, it was something simple, just not something I expected.  Embarrassingly I have been bitten by this before, albeit a long time ago, around 2007 if memory serves...

The fix is simple:  Use any other dhcp client besides dhcpcd !

Both pump and dhclient work perfectly and exactly as expected.  There's just something about dhcpcd that isn't quite right (no offense to the developers, please).  After hours and hours of tcpdumps, iproute2 gymnastics, postup and predown juju, and various other whatnot, I finally just emerged pump and dhcp and both worked first time, no fuss, no muss..  No changes to conf.d/net needed:  Using udhcpcd -- regardless of the options and config settings -- nothing works; Using pump or dhclient, the IP's and routes are all perfect.

I guess I oughta file a bug.

Thanks for those who took the time to read this.  Hope it helps someone...[/i]

----------

