# Strange behaviour of dhcpcd

## Charlz_Klug

I'm trying to use dhcpcd on installed to hard disk Gentoo operating system, but get this:

```
Sep 22 12:26:35 Scarlett dhcpcd[4400]: enp2s0: carrier acquired

Sep 22 12:26:35 Scarlett dhcpcd[4400]: enp2s0: IAID 72:b3:24:1f

Sep 22 12:26:35 Scarlett dhcpcd[4400]: enp2s0: adding address fe80::d15b:18b6:bbd6:72de

Sep 22 12:26:35 Scarlett dhcpcd[4400]: enp2s0: soliciting a DHCP lease

Sep 22 12:26:36 Scarlett dhcpcd[4400]: enp2s0: soliciting an IPv6 router

Sep 22 12:26:40 Scarlett dhcpcd[4400]: enp2s0: probing for an IPv4LL address

Sep 22 12:26:45 Scarlett dhcpcd[4400]: enp2s0: using IPv4LL address 169.254.242.160

Sep 22 12:26:45 Scarlett dhcpcd[4400]: enp2s0: adding route to 169.254.0.0/16

Sep 22 12:26:45 Scarlett dhcpcd[4400]: enp2s0: adding default route

Sep 22 12:26:49 Scarlett dhcpcd[4400]: enp2s0: no IPv6 Routers available

```

Internet isn't working with 169.254.242.160 IP-address. Then I download and booted with SystemRescueCD and got 

```
root@sysresccd /mnt/var/log % ifconfig enp2s0

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 217.171.157.198  netmask 255.255.252.0  broadcast 217.171.159.255

        inet6 fe80::7a88:6abb:bf6b:1663  prefixlen 64  scopeid 0x20<link>

        ether b8:2a:72:b3:24:1f  txqueuelen 1000  (Ethernet)

        RX packets 51259  bytes 16917500 (16.1 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 10811  bytes 1703044 (1.6 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

 With this IP-address internet is working. How can I fix that? Thank you for your answers.

----------

## bunder

Can we see /etc/conf.d/net and /etc/dhcpcd.conf ?

----------

## P.Kosunen

Driver is propably ok because enp2s0 name, but maybe it lacks firmware and network is not working, "sys-kernel/linux-firmware" package missing?

----------

## Anon-E-moose

Look at the difference between what works (your installation) and sysrescuecd, ie kernel config, modules, how dhcpd is configured, etc.

----------

## Charlz_Klug

 *bunder wrote:*   

> Can we see /etc/conf.d/net and /etc/dhcpcd.conf ?

  Yes, of course:

```
root@sysresccd /mnt/etc/conf.d % cat net

config_enp2s0="dhcp"

config_wlp3s0="dhcp"

#dns_domain_lo="local"

```

```
root@sysresccd /mnt/etc % cat dhcpcd.conf                    

# A sample configuration for dhcpcd.

# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.

#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.

hostname

# Use the hardware address of the interface for the Client ID.

#clientid

# or

# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.

# Some non-RFC compliant DHCP servers do not reply with this set.

# In this case, comment out duid and enable clientid above.

duid

# Persist interface configuration when dhcpcd exits.

persistent

# Rapid commit support.

# Safe to enable by default because it requires the equivalent option set

# on the server to actually work.

option rapid_commit

# A list of options to request from the DHCP server.

option domain_name_servers, domain_name, domain_search, host_name

option classless_static_routes

# Respect the network MTU. This is applied to DHCP routes.

option interface_mtu

# Most distributions have NTP support.

#option ntp_servers

# A ServerID is required by RFC2131.

require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface

#slaac hwaddr

# OR generate Stable Private IPv6 Addresses based from the DUID

slaac private

```

----------

## Charlz_Klug

 *P.Kosunen wrote:*   

> Driver is propably ok because enp2s0 name, but maybe it lacks firmware and network is not working, "sys-kernel/linux-firmware" package missing?

 For test I tried to get an IP-address from my TP-LINK router and I had got an address from router. I cannot just get address from provider's patch cord.

----------

## Hu

In the failing case, you are getting an IPv4 link-local address because the DHCP server does not respond within the time allotted.  You do not say how long systemrescuecd requires to obtain an address.  I would use this decision tree:Is the DHCP server too slow to respond to the failed system, or does the DHCP server never respond at all?If it is too slow, determine whether systemrescuecd is more patient or if systemrescuecd receives a faster response.If systemrescuecd is more patient, try making the installed dhcp client more patient.If the DHCP server never responds at all, determine why it ignores the failed system and responds to systemrescuecd.One bit you quoted from the configuration file offers a possibility, though this might be irrelevant. *Charlz_Klug wrote:*   

> 
> 
> ```
> root@sysresccd /mnt/etc % cat dhcpcd.conf                    
> 
> ...

 Check that systemrescuecd also uses DUID, or check whether the failed system works better when you disable DUID.  Since the comment specifically says broken DHCP servers do not reply, and your problem is consistent with not receiving a response, this seems to me to be a good place to start.

----------

## bunder

Is this a cable modem?  Some modems hold a MAC table and are limited to a small handful of devices (somewhere in the range of 1-3).  If you've used all your MACs you won't be able to get a new IP until you reboot the modem to flush the table.

----------

## Logicien

In principle if, on the same machine with the same Ethernet wired card, you get an IP address from SystemRescueCD and not from Gentoo, the problem is not the modem who deny you to connect because of non authorised MAC address. It have been already registrated by SystemRescueCD and/or Gentoo. You can even reset the modem if you want before booting Gentoo, it should not change the result.

I see that in /etc/conf.d/net you ask for a dhcp request on both enp2s0 and wlp3s0 interfaces. If your Internet connexion pass through enp2s0 you should not ask for a dhcp request on wlp3s0, unless you need a specific configuration for wlp3s0. I would try to get only enp2s0 well configure by Dhcpcd for test.

Anyway to get a dynamic IP address with Dhcpcd managing alone a wireless interface without Wpa_supplicant started by an other mean,  you need to tell to Dhcpcd to start Wpa_supplicant what need to copy or link /usr/share/dhcpcd/hooks/10-wpa_supplicant to /lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant. In plus you may need to configure /etc/dhcpcd.conf as well for the wireless interface.

----------

## Charlz_Klug

 *Hu wrote:*   

> Check that systemrescuecd also uses DUID, or check whether the failed system works better when you disable DUID.  Since the comment specifically says broken DHCP servers do not reply, and your problem is consistent with not receiving a response, this seems to me to be a good place to start.

 I disabled DUID and enabled CLIENTID. And got IP-address successfully. My dhcpcd.conf:

```
charlzk@Scarlett ~ $ cat /etc/dhcpcd.conf 

# A sample configuration for dhcpcd.

# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.

#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.

hostname

# Use the hardware address of the interface for the Client ID.

clientid

# or

# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.

# Some non-RFC compliant DHCP servers do not reply with this set.

# In this case, comment out duid and enable clientid above.

#duid

# Persist interface configuration when dhcpcd exits.

persistent

# Rapid commit support.

# Safe to enable by default because it requires the equivalent option set

# on the server to actually work.

option rapid_commit

# A list of options to request from the DHCP server.

option domain_name_servers, domain_name, domain_search, host_name

option classless_static_routes

# Respect the network MTU. This is applied to DHCP routes.

option interface_mtu

# Most distributions have NTP support.

#option ntp_servers

# A ServerID is required by RFC2131.

require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface

#slaac hwaddr

# OR generate Stable Private IPv6 Addresses based from the DUID

slaac private

```

Problem solved. Thank you for advices!

----------

## UberLord

Whilst the problem is solved, be sure to email the responsible party for the DHCPv6 server that their setup is not RFC compliant so they can fix it.

----------

