# dhcpcd not sending hostname with dhcp request <SOLVED>

## OrangeToque

I have several gentoo boxes on my network, and they are all configured to receive a specific IP address based upon the hostname of the machine (sent by default with dhcpcd requests, as stated in /etic/network/net.example).   This setup has worked great for over a year, however after a recent upgrade the machines have been receiving the wrong IP address from the DHCP server. 

I have traced the problem to a recent upgrade from dhcpcd 3.0.16-r1 to 3.1, and have temporarily fixed the issue by either masking the latest version of dhcpcd and downgrading to the previous version, or configuring the script to use a different dhcp client (udhcpc).

Although this problem has been effectively solved, I was wondering if there is a way to solve this issue with the newest version of dchpcd?

----------

## thode

Same experience here, same solution.

----------

## UberLord

Works For Me!

You two care to email me wireshark traces of your dhcpcd transactions?

----------

## thode

I've sent you a mail  :Smile: 

seems other people are reporting problems with 3.1.5: https://forums.gentoo.org/viewtopic-t-590885.html

----------

## UberLord

Didn't get any emails :/

----------

## thode

I used the email address under contacts on your homepage, and attached the output file from wireshark.

I'll send a new one to the same address.

----------

## UberLord

Maybe my spam filtering got it!

Send it to uberlord@gentoo.org please.

Thanks!

----------

## thode

done  :Smile: 

----------

## UberLord

OK, got it now. However, I can't analyse it for a few days as my fbsd box is currently emerge -e world with loads of packages. I'll post back here as soon as wireshark works again!

----------

## Sperlock

I think I may have also had this issue.  I could connect to my router, but could not get to the Internet.  The DHCP list on my router showed my laptop but not my desktop (though for whatever reason it now shows my desktop but not my laptop).  I was afraid something happened to my NIC, but downgrading from dhcpcd 3.1.5 to 3.0.16-r1 fixed everything.  Running x86 with an Intel DP965LT motherboard.

----------

## UberLord

 *thode wrote:*   

> I've sent you a mail 
> 
> seems other people are reporting problems with 3.1.5: https://forums.gentoo.org/viewtopic-t-590885.html

 

Looks like to me - what do you think is wrong with it?

----------

## UberLord

 *OrangeToque wrote:*   

> I have several gentoo boxes on my network, and they are all configured to receive a specific IP address based upon the hostname of the machine (sent by default with dhcpcd requests, as stated in /etic/network/net.example).   This setup has worked great for over a year, however after a recent upgrade the machines have been receiving the wrong IP address from the DHCP server. 
> 
> I have traced the problem to a recent upgrade from dhcpcd 3.0.16-r1 to 3.1, and have temporarily fixed the issue by either masking the latest version of dhcpcd and downgrading to the previous version, or configuring the script to use a different dhcp client (udhcpc).
> 
> Although this problem has been effectively solved, I was wondering if there is a way to solve this issue with the newest version of dchpcd?

 

First, it's /etc/conf.d/net.example

Secondly, still expecting the trace.

Thirdly, sure it's not a server configuration issue?

----------

## thode

I'm by no means an expert, but I'll try to elaborate a bit on what I've experienced:

I'm running my home network with a server set up to use dnsmasq, providing me dhcp and dns server functionality.

Int /etc/dnsmasq.conf it states:

```

# Enable the address given for "judge" in /etc/hosts

# to be given to a machine presenting the name "judge" when

# it asks for a DHCP lease.

#dhcp-host=judge

```

What I've configured here is:

```

dhcp-host=twilight

dhcp-host=aurora

```

That's it. Relevant section from the server's /etc/hosts:

```

192.168.1.2     twilight.thode.lir.dk   twilight

192.168.1.3     aurora.thode.lir.dk     aurora

```

And naturally, hostname configurations on both machines are properly configured in their /etc/conf.d/hostname.

This is the only client specific configurations I've done on my server running dnsmasq.

It worked before 3.1.5

It doesn't now.

If this is not a problem relating to the newest dhcpcd, then what could be the cause of the problem?

Naturally, I could do the configuration to provide ip based on specific mac address, but both machines have several nic's, and I like how I'm able to connect them this way, regardless of nic, with a single configuration line pr. machine.

I'll post more of my configuration files, should it be needed.

Regards

Christian

----------

## OrangeToque

Pretty much the exact same problem with my config. (dnsmasq + /etc/hosts)

works with udhcpc and dhcpcd < 3.15 but not with dhcpcd=3.15

----------

## UberLord

 *thode wrote:*   

> If this is not a problem relating to the newest dhcpcd, then what could be the cause of the problem?

 

A rough guess is because dhcpcd-3.1 sends an IAID+DUID for a ClientID whereas <dhcpcd-3.1 just sent a MAC address. Your server had already leased the address for "aurora" to the MAC address client ID and thus either a new one or no one to the IAID+DUID client ID.

As you can control the server, could you stop the server, punt the leases file, start it again and then restest dhcpcd? It should work fine then.

----------

## thode

That did indeed resolve the problem  :Smile: 

Thanks for the fast replies, and a very good description of the dhcp mechanics, it's always nice to get a deeper insight into what's going on!

----------

## Cypr

I think I might have the same problem, except that the dhcp server is a Zonet router.

Before upgrading, the router said that the mac address of my computer was 00:0F:..., the same as ifconfig gives.

After upgrading to 3.1.5, the router says that the mac address of my computer is 65:74:.... (And complains about the address, when I try to set a static ip for it, and refuses.)

My computer is connected via a switch, in case that's relevant.

I don't understand what punting the leases file means (or what IAID/DUID means). I've tried unplugging the router (and plugging it in again), but that didn't help.

----------

## UberLord

 *Cypr wrote:*   

> Before upgrading, the router said that the mac address of my computer was 00:0F:..., the same as ifconfig gives.
> 
> After upgrading to 3.1.5, the router says that the mac address of my computer is 65:74:.... (And complains about the address, when I try to set a static ip for it, and refuses.)

 

See, your DHCP server *requires* the MAC address in the ClientID field.

Not only is this field *optional* as per all relevant RFCs, but you've never been required to put the MAC address in there either.

So what we have here is a buggy DHCP server

 *Quote:*   

> I think I might have the same problem, except that the dhcp server is a Zonet router.
> 
> I don't understand what punting the leases file means (or what IAID/DUID means). I've tried unplugging the router (and plugging it in again), but that didn't help.

 

So you can only upgrade the DHCP server by a firmware upgrade, which I won't recommend.

You can, however, revert dhcpcd to the old behaviour by using the -I ''

```
dhcpcd_eth0="-I ''"
```

Like so.

Or emerge dhcpcd with the vram USE flag.

----------

## UberLord

 *thode wrote:*   

> That did indeed resolve the problem 
> 
> Thanks for the fast replies, and a very good description of the dhcp mechanics, it's always nice to get a deeper insight into what's going on!

 

Now you've fixed dhcpcd-3.1 and are using this new feature, let me explain one of the benefits.

You can swap the network card out and use a different one, or change the MAC address of the card your using because you already have your DUID. So you get the same ip address  :Smile: 

----------

## Cypr

 *UberLord wrote:*   

>  *Cypr wrote:*   Before upgrading, the router said that the mac address of my computer was 00:0F:..., the same as ifconfig gives.
> 
> After upgrading to 3.1.5, the router says that the mac address of my computer is 65:74:.... (And complains about the address, when I try to set a static ip for it, and refuses.) 
> 
> See, your DHCP server *requires* the MAC address in the ClientID field.
> ...

 

Ok.

 *Quote:*   

>  *Quote:*   I think I might have the same problem, except that the dhcp server is a Zonet router.
> 
> I don't understand what punting the leases file means (or what IAID/DUID means). I've tried unplugging the router (and plugging it in again), but that didn't help. 
> 
> So you can only upgrade the DHCP server by a firmware upgrade, which I won't recommend.
> ...

 

Thanks, adding dhcpcd_eth0="-I ''" to /etc/conf.d/net worked. (After re-reading your post and putting the exact right string in /etc/conf.d/net.)

----------

## agent_jdh

I was having this problem as well, dual booting Gentoo/XP and connecting to my Gentoo server running dnsmasq.  The modification to /etc/conf.d/net.eth0 appears to have fixed the problem here.  Many thanks to all!  This has had me scratching my head for a few days until I found this thread.

----------

