# DHCPDC issues

## i_like_penguins

I am at a complete loss as to what is going on here. First, the IP get set to 0.0.5.220/32. However, if I look at the log files, it has the correct lease listed in there. It also has the wrong MTU. I can set the MTU and the IP with ifconfig, and it all works, but as soon as the DHCP lease expires, it all goes back to not working. I tried forcing the MTU in /etc/conf.d/net by adding a line "mtu_eth0"1500"" and that will set the MTU for the first time it pulls and address, but not on any renewals. DHCPCD version is 5.2.8.

----------

## TJNII

So are you trying to set an IP in the range of 0.0.0.0/8?  This is a special range reserved in RFC 1122 / RFC 5735.  Do things work properly is you use one of the address ranges defined in RFC1918 for private networks?

----------

## i_like_penguins

No. The 0.0.5.220 is the IP that DHCPCD sets and is wrong. DHCPCD displays that it is setting the correct IP in the console logs however.

----------

## i_like_penguins

Dug some stuff out from the logs

Here are the messages that DHCPCD leaves in the logs

```
Jan  2 06:44:44 server dhcpcd[4667]: eth0: renewing lease of 71.89.80.101

Jan  2 06:44:44 server dhcpcd[4667]: eth0: acknowledged 71.89.80.101 from 68.114.36.214

Jan  2 06:44:44 server dhcpcd[4667]: eth0: leased 71.89.80.101 for 21299 seconds

Jan  2 06:44:44 server dhcpcd: eth0: MTU set to 576

```

Here is the /etc/conf.d/net minus comments

```
config_eth1=( "192.168.3.1 netmask 255.255.255.0 brd 192.168.3.255")

mtu_eth0="1500"
```

Output of ifconfig after DHCPCD does its thing:

```
eth0      Link encap:Ethernet  HWaddr 00:e0:ed:10:79:be

          inet addr:0.0.5.220  Bcast:255.255.255.255  Mask:255.255.255.255

          UP BROADCAST RUNNING MULTICAST  MTU:576  Metric:1

          RX packets:707249 errors:1849 dropped:0 overruns:0 frame:1849

          TX packets:3898 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:46244722 (44.1 MiB)  TX bytes:509600 (497.6 KiB)

          Interrupt:25

```

And this is what I need to manually configure to make it work and to get on the internet.

```

eth0      Link encap:Ethernet  HWaddr 00:e0:ed:10:79:be

          inet addr:71.89.80.101  Bcast:255.255.255.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:707249 errors:1849 dropped:0 overruns:0 frame:1849

          TX packets:3898 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:46244722 (44.1 MiB)  TX bytes:509600 (497.6 KiB)

          Interrupt:25

```

----------

## i_like_penguins

Dug some stuff out from the logs

Here are the messages that DHCPCD leaves in the logs

```
Jan  2 06:44:44 server dhcpcd[4667]: eth0: renewing lease of 71.89.80.101

Jan  2 06:44:44 server dhcpcd[4667]: eth0: acknowledged 71.89.80.101 from 68.114.36.214

Jan  2 06:44:44 server dhcpcd[4667]: eth0: leased 71.89.80.101 for 21299 seconds

Jan  2 06:44:44 server dhcpcd: eth0: MTU set to 576

```

Here is the /etc/conf.d/net minus comments

```
config_eth1=( "192.168.3.1 netmask 255.255.255.0 brd 192.168.3.255")

mtu_eth0="1500"
```

Output of ifconfig after DHCPCD does its thing:

```
eth0      Link encap:Ethernet  HWaddr 00:e0:ed:10:79:be

          inet addr:0.0.5.220  Bcast:255.255.255.255  Mask:255.255.255.255

          UP BROADCAST RUNNING MULTICAST  MTU:576  Metric:1

          RX packets:707249 errors:1849 dropped:0 overruns:0 frame:1849

          TX packets:3898 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:46244722 (44.1 MiB)  TX bytes:509600 (497.6 KiB)

          Interrupt:25

```

And this is what I need to manually configure to make it work and to get on the internet.

```

eth0      Link encap:Ethernet  HWaddr 00:e0:ed:10:79:be

          inet addr:71.89.80.101  Bcast:255.255.255.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:707249 errors:1849 dropped:0 overruns:0 frame:1849

          TX packets:3898 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:46244722 (44.1 MiB)  TX bytes:509600 (497.6 KiB)

          Interrupt:25

```

----------

## TJNII

Firstly, are you sure that MTU is wrong?  Depending on your Internet connection medium (ATM, for example) you ISP may have reason to lower the MTU.

As for the address being set incorrectly, that is strange.  Have you modified anything in /lib/dhcpcd?  If you "mv /lib/dhcpcd/dhcpcd-hooks/10-mtu /root" does the problem persist?

----------

## i_like_penguins

I know the MTU is wrong. If I toss in a live CD and look at the MTU it is 1500. This is cable internet, so no PPP anything to knock the MTU down. Also, having it set to 576 does not work and 1500 works.  I have not modified anything in /lib/dhcp. The only change I made was to the /etc/conf.d/net file. I will try and move that file and see what happens.

----------

## TJNII

This is sounding more and more like a busted dhcpcd install.  Have you tried rebuilding it with a known-good toolchain?

----------

## i_like_penguins

emerge -av dhcpcd? I will try that and see what happens. I think I emerged DHCPCD as part of the install process.

----------

## 1clue

Hate to ask a dumb question, but are you absolutely positive that this is the only DHCP server on the network?

Make sure you don't have some other device running DHCP.  It could be almost anything.  Switches, wireless routers, firewalls, cable modems.

I've had one that was remarkably similar to what I was trying to do once, and since both thought they were authoritative and using the same pools, they kept fighting over leases.  Not the same errors you are getting, but it's something to check.

----------

## UberLord

Use `ip a` to check assigned addresses. Linux ifconfig is broken and only shows the 1st IPv4 address.

----------

## i_like_penguins

Cable modem plugs directly into eth0. Gentoo is acting as the router for my house, so it is running a DHCP server on eth1.

I recompiled DHCPCD, nuked the /var/lib/dhcpcd/dchpcd-eth0.lease file so I would have a clean start and rebooted. All looks good on the first reboot, but when I do a 'dhcpcd -n eth0' the MTU goes back to 576. The IP stays correct, so that part it good. 

Output of 'ip a'. I think I am missing something here....

```

server ~ # ip a

-bash: ip: command not found

```

----------

## UberLord

emerge iproute2

----------

## TJNII

So the IP addressing is fixed now?

As for the MTU, I would sniff the DHCP traffic with WireShark and see if DHCPCD is being told to set that MTU.  You can bypass it by removing the dhcpcd hook, as well.

----------

## UberLord

dhcpcd -U eth0

will print the lease to stdout for eth0. If mtu is set then it will be shown.

----------

## i_like_penguins

MTU is being passed in the DHCP reply, but I believe it is being passed incorrectly. As soon as I can figure out TCPDUMP I am going to see how big the incoming packets are. If they are more then 576, then my ISP has a wrong DHCP config. There is no gui on this box, so wireshark is out. Removing a hook to make something work seems like a hack. The proper way should be to have DHCPCD respect the mtu being set in /etc/conf.d/net. That route seems more logical.

```

server ~ # dhcpcd -U eth0

broadcast_address=255.255.255.255

dhcp_lease_time=79092

dhcp_message_type=5

dhcp_rebinding_time=69205

dhcp_renewal_time=39546

dhcp_server_identifier=68.114.36.214

domain_name=eau.wi.charter.com

domain_name_servers='68.115.71.53 24.196.64.53 24.159.193.40'

host_name=server

interface_mtu=576

ip_address=71.89.80.101

network_number=71.89.80.0

routers=71.89.80.1

subnet_cidr=20

subnet_mask=255.255.240.0

```

```

server ~ # ip a

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 brd 127.255.255.255 scope host lo

    inet6 ::1/128 scope host

       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000

    link/ether 00:e0:ed:10:79:be brd ff:ff:ff:ff:ff:ff

    inet 71.89.80.101/20 brd 255.255.255.255 scope global eth0

3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000

    link/ether 00:e0:ed:10:79:bf brd ff:ff:ff:ff:ff:ff

    inet 192.168.3.1/24 brd 192.168.3.255 scope global eth1

    inet 169.254.155.74/16 brd 169.254.255.255 scope global eth1

    inet6 fe80::2e0:edff:fe10:79bf/64 scope link

       valid_lft forever preferred_lft forever

4: sit0: <NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN

    link/sit 0.0.0.0 brd 0.0.0.0

    inet6 ::192.168.3.1/96 scope global

       valid_lft forever preferred_lft forever

    inet6 ::71.89.80.101/96 scope global

       valid_lft forever preferred_lft forever

    inet6 ::127.0.0.1/96 scope host

       valid_lft forever preferred_lft forever

5: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000

    link/ether 00:0f:1f:f8:35:3b brd ff:ff:ff:ff:ff:ff

```

Edit: Incoming packet payload is 1460 on a full packet. Verified with tcpdump. MTU  of 576 is 100% wrong.

----------

## UberLord

 *i_like_penguins wrote:*   

> The proper way should be to have DHCPCD respect the mtu being set in /etc/conf.d/net. That route seems more logical.

 

dhcpcd doesn't check conf.d/net, nor will it ever.

If you don't want dhcpcd to touch the mtu OR you want to set it statically, make this change in /etc/dhcpcd.conf.

See dhcpcd.conf(5) for more details.

----------

## i_like_penguins

I commented out the option interface_mtu line in dhcpcd.conf. I hope this fixes it.  This is getting rather annoying.

----------

## UberLord

 *i_like_penguins wrote:*   

> This is getting rather annoying.

 

I find it equally annoying that DHCP servers are configured to send out a silly MTU as well.

----------

## gentoo_ram

I get a weird MTU from my ISP as well.  I use the following line in /etc/conf.d/net to prevent dhcpcd from messing with the MTU on my interface:

```
dhcpcd_eth1=( "-L -C mtu" )
```

----------

## i_like_penguins

Been a few days and still going strong. Commenting out the MTU option from the dhcpcd.conf file fixed the MTU problem and recompiling the daemon seemed to fix the strange IP problem. Thinking about it some more 576 was the MTU for a dialup connection. What that is doing on a modern cable internet system is beyond me.

----------

## bssteph

I recently got hit by this too. Those of you with the MTU issue, you don't happen to all be on Charter (US), do you? If we're on the same ISP, we should just contact them, and if not, maybe it is a dhcpcd bug?

----------

## Hu

 *bssteph wrote:*   

> I recently got hit by this too. Those of you with the MTU issue, you don't happen to all be on Charter (US), do you? If we're on the same ISP, we should just contact them, and if not, maybe it is a dhcpcd bug?

 You can prove/disprove it being a dhcpcd bug by checking the response from the DHCP server against what dhcpcd actually does.  I have seen a low MTU problem before, and it was a stupid DHCP server advertising an unreasonably low MTU, which was easily visible in the packet capture.

----------

