# DHCP does not send hostname

## saki

I am really sorry to ask two questions in two days - but I have searched the docs and archives and can't find an answer to this.

I have a home network using a DSL modem/router for DHCP and DNS.   My main box is currently SuSE and when I tell it to use DHCP it gets an IP address from the router and communicates the hostname to the router.  I can therefore ping that box from itself and from other boxes on the network.  SuSE uses dhclient, which does not appear to be available under Gentoo - I don't know if this is relevant though.

My test installation of Gentoo is on a spare machine.  I have /etc/hostname "foo" and /etc/conf.d/net has iface_eth0="dhcp" and gateway="10.0.0.138" (ie my router). DHCP works to the extent that an IP address is allocated, but the hostname is never communicated to the router.   I can't ping "foo" and nor can other boxes on the network see it, - I just get "unknown host".

As it happens, the box in question in dual-boot Win 98.  If I fire up Win 98 it sends the "foo" name to the modem/router and this persists if I then re-boot Gentoo.

So ... it seems that SuSE and Win98 communicate the hostname to the modem/router, but Gentoo does not.  Am I missing something?

Sorry for the lengthy post .. maybe it should be in a different forum, but I am such a newbie at Gentoo that I thought I should start here.

Thanks,

Saki

----------

## klieber

edit your /etc/conf.d/net file and look for the line similar to:

```
#dhcpcd_eth0="..."
```

uncomment that line and change it to read:

```
dhcpcd_eth0="-h <yourhostname>"
```

and that will pass the correct hostname to your router.  man dhcpcd for more info.

--kurt

----------

## saki

Thank-you Kurt.

I had, in fact, already read man dhcpcd and tried the -h <hostname> option, but it had not worked.  However, when I tried it before I also used dhcpd -k to stop the daemon then restarted.  After reading your post I decided to try again, and to reboot after editing /etc/conf.d/net.  It seems that the reboot was necessary because it is working now.  I suppose that there is some lower-level network restart command which I could have given to avoid the reboot - but I can work that out later.

Thanks again,

Saki

----------

## klieber

 *saki wrote:*   

> I suppose that there is some lower-level network restart command which I could have given to avoid the reboot - but I can work that out later.

 

You can use:

```
/etc/init.d/net.eth0 restart
```

--kurt

----------

## saki

Thanks ... two days into Gentoo and my education is proceeding nicely.  Next task is to see if I can (1) install my old VMware 2.0.4 stuff and (2) set up a faxgetty and run Hylafax / SuSEfax.   Watch this space .......   :Very Happy: 

Regards,

Saki

----------

## pjp

 *saki wrote:*   

> Next task is to see if I can (1) install my old VMware 2.0.4 stuff and (2) set up a faxgetty and run Hylafax / SuSEfax.   Watch this space .......  

 Actually, if you have problems not related to this thread topic, please give each problem a seperate thread in an appropriate forum.  After you search for the answer first  :Very Happy: 

----------

## saki

Understood .. I will, of course, observe the protocol.  With a little luck I won't need to ask in any case.

Regards,

Saki

----------

