You are not logged in.
I'm setting up several diskless clients according to https://wiki.archlinux.org/index.php/Diskless_system. How do I configure the clients to have different hostnames if they all use the same files /srv/arch/etc/hostname and /srv/arch/etc/hosts? Thanks!
Last edited by Proofrific (2018-06-01 18:12:50)
Offline
If your dhcp server can distribute hostnames, then it should probably work if you leave /etc/hostname empty.
Otherwise, you could symlink these files to a tmpfs that you populate during boot.
Then you can grab the hostname from dhcp or dns and write it to the hosts and hostname files. Alternatively you can create your own list of mac addresses associated with hostnames and use that to set the hostname.
Last edited by progandy (2018-06-01 15:42:04)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Thanks for the reply. I'm using dnsmasq as the DHCP and TFTP server. I don't think it can distribute hostnames, so I'll look into some of the other options you suggested.
Offline
With dnsmasq you should be able to assign hostname and ip for a specific mac address. dhcpcd should take the hostname offered if it is currently blank.
If the hostname is currently blank, (null) or localhost,
or force_hostname is YES or TRUE or 1 then dhcpcd sets the hostname to the
one supplied by the DHCP server.
--dhcp-host=[<hwaddr>][,id:<client_id>|*][,set:<tag>][,<ipaddr>][,<hostname>][,<lease_time>][,ignore]Last edited by progandy (2018-06-01 16:16:48)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Thanks! I changed the hostname in /srv/arch/etc/hostname and /srv/arch/etc/hosts to localhost, and then added entries to /etc/dnsmasq.conf to assign different hostnames based on the MAC address of the NIC. Marked as solved.
Offline