# dhcpcd timeout problem

## fsanches

Hi,

I have my gentoo connected to a cable modem and I have some problems when the ISP dhcp server fails.

When the ISP dhcp server fails my cable modem starts serving ips in the network 192.168.100.0/24. During that time the dhcpcd gets an address on this network but when the Internet access is restored it fails and stops.

The log shows this:

Jul 31 14:37:36 [dhcpcd] sending DHCP_REQUEST for 213.22.XX.XXX to 212.113.XXX.XX

Jul 31 14:37:37 [dhcpcd] dhcpIPaddrLeaseTime=1800 in DHCP server response.

Jul 31 14:37:37 [dhcpcd] DHCP_ACK received from  (212.113.XXX.XX)

Jul 31 14:52:37 [dhcpcd] sending DHCP_REQUEST for 213.22.XX.XXX to 212.113.XXX.XX

Jul 31 14:54:41 [dhcpcd] dhcpIPaddrLeaseTime=10 in DHCP server response.

Jul 31 14:54:41 [dhcpcd] dhcpT1value is missing in DHCP server response. Assuming 5 sec

Jul 31 14:54:41 [dhcpcd] dhcpT2value is missing in DHCP server response. Assuming 8 sec

Jul 31 14:54:41 [dhcpcd] DHCP_NAK server response received

Jul 31 14:54:41 [dhcpcd] broadcasting DHCP_DISCOVER

Jul 31 14:54:41 [dhcpcd] broadcastAddr option is missing in DHCP server response. Assuming 192.168.100.63

Jul 31 14:54:41 [dhcpcd] dhcpIPaddrLeaseTime=10 in DHCP server response.

Jul 31 14:54:41 [dhcpcd] dhcpT1value is missing in DHCP server response. Assuming 5 sec

Jul 31 14:54:41 [dhcpcd] dhcpT2value is missing in DHCP server response. Assuming 8 sec

Jul 31 14:54:41 [dhcpcd] DHCP_OFFER received from  (192.168.100.1)

Jul 31 14:54:41 [dhcpcd] broadcasting DHCP_REQUEST for 192.168.100.2

Jul 31 14:54:41 [dhcpcd] dhcpIPaddrLeaseTime=10 in DHCP server response.

Jul 31 14:54:41 [dhcpcd] dhcpT1value is missing in DHCP server response. Assuming 5 sec

Jul 31 14:54:41 [dhcpcd] dhcpT2value is missing in DHCP server response. Assuming 8 sec

Jul 31 14:54:41 [dhcpcd] dhcpIPaddrLeaseTime=10 in DHCP server response.

Jul 31 14:54:41 [dhcpcd] dhcpT1value is missing in DHCP server response. Assuming 5 sec

Jul 31 14:54:41 [dhcpcd] dhcpT2value is missing in DHCP server response. Assuming 8 sec

Jul 31 14:54:41 [dhcpcd] DHCP_ACK received from  (192.168.100.1)

Jul 31 14:54:41 [dhcpcd] sending DHCP_REQUEST for 192.168.100.2 to 192.168.100.1

Jul 31 14:54:41 [dhcpcd] dhcpIPaddrLeaseTime=10 in DHCP server response.

Jul 31 14:54:41 [dhcpcd] dhcpT1value is missing in DHCP server response. Assuming 5 sec

Jul 31 14:54:41 [dhcpcd] dhcpT2value is missing in DHCP server response. Assuming 8 sec

Jul 31 14:54:41 [dhcpcd] DHCP_ACK received from  (192.168.100.1)

This is the normal functioning of dhcp and when the ISP fails the cable modem starts it owns dhcp server with a lease time of 10 seconds.

The problem shows up when the ISP comes back online. This is in the logs:

Jul 31 15:08:16 [dhcpcd] sending DHCP_REQUEST for 192.168.100.2 to 192.168.100.1

Jul 31 15:08:16 [dhcpcd] dhcpIPaddrLeaseTime=10 in DHCP server response.

Jul 31 15:08:16 [dhcpcd] dhcpT1value is missing in DHCP server response. Assuming 5 sec

Jul 31 15:08:16 [dhcpcd] dhcpT2value is missing in DHCP server response. Assuming 8 sec

Jul 31 15:08:16 [dhcpcd] DHCP_ACK received from  (192.168.100.1)

Jul 31 15:08:21 [dhcpcd] sending DHCP_REQUEST for 192.168.100.2 to 192.168.100.1

Jul 31 15:08:21 [dhcpcd] dhcpIPaddrLeaseTime=10 in DHCP server response.

Jul 31 15:08:21 [dhcpcd] dhcpT1value is missing in DHCP server response. Assuming 5 sec

Jul 31 15:08:21 [dhcpcd] dhcpT2value is missing in DHCP server response. Assuming 8 sec

Jul 31 15:08:21 [dhcpcd] DHCP_NAK server response received

Jul 31 15:08:21 [dhcpcd] broadcasting DHCP_REQUEST for 192.168.100.2

Jul 31 15:08:21 [dhcpcd] dhcpIPaddrLeaseTime=10 in DHCP server response.

Jul 31 15:08:21 [dhcpcd] dhcpT1value is missing in DHCP server response. Assuming 5 sec

Jul 31 15:08:21 [dhcpcd] dhcpT2value is missing in DHCP server response. Assuming 8 sec

Jul 31 15:08:21 [dhcpcd] DHCP_NAK server response received

Jul 31 15:08:21 [dhcpcd] broadcasting DHCP_DISCOVER

Jul 31 15:08:22 [dhcpcd] broadcastAddr option is missing in DHCP server response. Assuming 213.22.XX.255

Jul 31 15:08:22 [dhcpcd] dhcpIPaddrLeaseTime=1800 in DHCP server response.

Jul 31 15:08:22 [dhcpcd] DHCP_OFFER received from  (212.113.XXX.XX)

Jul 31 15:08:22 [dhcpcd] broadcasting DHCP_REQUEST for 213.22.XX.XXX

Jul 31 15:08:26 [dhcpcd] timed out waiting for a valid DHCP server response

Jul 31 17:02:39 [dhcpcd] broadcasting DHCP_REQUEST for 192.168.100.2

The problem is the timeout at 15:08:26. At 17:02:39 I restart the dhcpcd (/etc/init.d/net.eth1 restart)

----------

## fsanches

I had this problem one time before and so I read RFC2131 (Dynamic Host Configuration Protocol) to learn about the dhcp protocol.

I did a 'man dhcpcd' and found this setting:

       -t <timeout>

              Specifies (in seconds ) for how long dhcpcd will try to get an IP address. The default is  60  sec-

              onds.   dhcpcd  will not fork into background until it gets a valid IP address in which case dhcpcd

              will return 0 to the parent process.  In a case dhcpcd  times  out  before  receiving  a  valid  IP

              address from DHCP server dhcpcd will return exit code 1 to the parent process.

So I changed /etc/conf.d/net

iface_eth1="dhcp"

dhcpcd_eth1="-R -N -d -t 18000"

But has you can see in the logs the dhcpcd doesn't wait 60 seconds or 18000 seconds (5 hours).

Doing a 'ps -fC dhcpcd' I verified that dhcpcd was running like:

/sbin/dhcpcd -R -N -d -t 18000 eth1

Anyone can give me a hint?

----------

## carbon

1) does your ISP give you dynamic or static IP2?

2) you sure you already loaded the driver needed for your network card? (u know tulip or something)

3) what does it say when you do /etc/init.d/net.eth1 restart  ( i mean error message)

4) why is it eth1, not eth0?

----------

## fsanches

1) static ip through dhcp

2) the situation I am refering occurs during normal operation of the server, so there is no problem with the drivers (8139too)

3) it does a normal restart

4) eth0 is the internal network card, no problem there  :Smile: 

The problem that seems to be occuring is a situation where the dhcpcd stops or breaks. After the error if you search the processes in memory you won't find it there.

One thing I am doing already is running a script to verify that dhcpcd is running and if not found it restart the dhcpcd. For me this is a way of minimizing the problem it is not a solution. The dhcpcd shouldn't behave like this.

----------

## linux_weenie

 *Quote:*   

>  -t <timeout>
> 
> Specifies  (in  seconds ) for how long dhcpcd will try to get an
> 
> IP address. The default is 60 seconds.   dhcpcd  will  not  fork
> ...

 

it looks like dhcpcd is behaving according to programmer defined procedure. the problem looks to be your ISP not dhcpcd.

-Will

----------

## fsanches

 *Quote:*   

> it looks like dhcpcd is behaving according to programmer defined procedure. the problem looks to be your ISP not dhcpcd. 
> 
> -Will

 

If you look into the logs you see that dhcpcd only waits 4 seconds. The default is 60 seconds and on the options I have specified 18000 seconds.

How come you say it is working accordingly???

Am I missing something?[/quote]

----------

## To

fsanches we have the same ISP.

The only option I have is:

 *Quote:*   

> iface_eth1="dhcp"
> 
> dhcpcd_eth1=" -R"

 

That's only to prevent dhcpcd to overwrite resolv.conf, you should have this option too, with other you may have;)

Those are the only messages I've in my logs related with dhcpcd

 *Quote:*   

> Jun  7 15:37:09 gandalf dhcpcd[741]: terminating on signal 1
> 
> Jun 10 14:08:00 gandalf dhcpcd[750]: terminating on signal 1
> 
> Jun 16 22:51:39 gandalf dhcpcd[1005]: timed out waiting for a valid DHCP server response
> ...

 

btw, I had strange probs about 8 months ago cause I had poor signal for the cable.

Tó

----------

