FS#17223 - [dhcpcd] send hostname to DHCP server / router
Attached to Project:
Arch Linux
Opened by Suraj N. Kurapati (sunaku) - Saturday, 21 November 2009, 00:34 GMT
Last edited by Ronald van Haren (pressh) - Thursday, 04 March 2010, 21:18 GMT
Opened by Suraj N. Kurapati (sunaku) - Saturday, 21 November 2009, 00:34 GMT
Last edited by Ronald van Haren (pressh) - Thursday, 04 March 2010, 21:18 GMT
|
Details
Description:
For the longest time, the default ArchLinux networking setup had one deficiency: it would not send the machine hostname to the DHCP server / router when acquiring a DHCP lease. As a result, I was never able to ping/ssh my ArchLinux system by its hostname from other machines in my home network --- instead, I was always forced to type out my ArchLinux system's IP address in full. I looked high and low across the 'net before I finally found the answer in the dhcpcd.conf man page: the solution was to add the following line to my /etc/dhcpcd.conf file: hostname I request the developers in charge of the default ArchLinux networking setup to make the above change, so that ArchLinux systems send their hostnames to the DHCP server (and therefore can be pinged/ssh'ed/accessed by their hostname) out of the box! Thanks for your consideration. P.S. The following line in the default /etc/dhcpd.conf file confused me: # dhcpcd-run-hooks uses these options. option domain_name_servers, domain_name, domain_search, host_name The "option host_name" part *seems* like it would send your machine's hostname to the DHCP server, but it really doesn't. Maybe that's a bug? Additional info: I am using this version of dhcpcd: core/dhcpcd 5.1.3-1 [installed] (base) RFC2131 compliant DHCP client daemon And the default version of /etc/rc.d/network on a wired (eth0) connection to my router. Here is the relevant portion of my /etc/rc.conf file: # ----------------------------------------------------------------------- # NETWORKING # ----------------------------------------------------------------------- # # HOSTNAME: Hostname of machine. Should also be put in /etc/hosts # HOSTNAME="yantram" # Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces. # # Interfaces to start at boot-up (in this order) # Declare each interface then list in INTERFACES # - prefix an entry in INTERFACES with a ! to disable it # - no hyphens in your interface names - Bash doesn't like it # # DHCP: Set your interface to "dhcp" (eth0="dhcp") # Wireless: See network profiles below # #eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" eth0="dhcp" INTERFACES=(eth0) # Routes to start at boot-up (in this order) # Declare each route then list in ROUTES # - prefix an entry in ROUTES with a ! to disable it # gateway="default gw 192.168.0.1" ROUTES=(!gateway) # Enable these network profiles at boot-up. These are only useful # if you happen to need multiple network configurations (ie, laptop users) # - set to 'menu' to present a menu during boot-up (dialog package required) # - prefix an entry with a ! to disable it # # Network profiles are found in /etc/network.d # # This now requires the netcfg package # #NETWORKS=(main) Steps to reproduce: 1. Run `/etc/rc.d/network start` on your ArchLinux machine 2. Go to a different machine on your network 3. Try to ping your ArchLinux machine by its hostname (will not work) 4. Try to ping your ArchLinux machine by its IP address (will work) |
This task depends upon
Closed by Ronald van Haren (pressh)
Thursday, 04 March 2010, 21:18 GMT
Reason for closing: Fixed
Additional comments about closing: upstream has added 'hostname' to the config file
Thursday, 04 March 2010, 21:18 GMT
Reason for closing: Fixed
Additional comments about closing: upstream has added 'hostname' to the config file
As for the host_name option in dhcpcd.conf: if the DHCP server sends out a hostname for the client, dhcpcd will set the client hostname on the system in that case.
The question is: Do we want this by default or as a user-configuration? Just adding "-h ''" to the options in /etc/config/dhcpcd should help. The same also works in netcfg profiles (or the netcfg interface config file) with the DHCP_OPTIONS/DHCP_OPTS option or similar.
As for the usefulness: Some cool DHCP server, like dnsmasq, add the hostname sent by the dhcp client to the DNS, which is very very useful. But as I said, you can easily configure this behaviour in Arch.
Thanks for your consideration.
$ bsdtar xOf /var/cache/pacman/pkg/dhcpcd-5.1.3-1-x86_64.pkg.tar.gz etc/dhcpcd.conf | grep hostname
# Inform the DHCP server of our hostname for DDNS.
hostname
# A hook script is provided to lookup the hostname if not set by the DHCP
nohook lookup-hostname