You are not logged in.

#1 2018-06-01 14:57:30

Proofrific
Member
Registered: 2008-01-05
Posts: 215

[Solved] Diskless Computers with Different Hostnames

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

#2 2018-06-01 15:38:16

progandy
Member
Registered: 2012-05-17
Posts: 5,304

Re: [Solved] Diskless Computers with Different Hostnames

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

#3 2018-06-01 16:07:25

Proofrific
Member
Registered: 2008-01-05
Posts: 215

Re: [Solved] Diskless Computers with Different Hostnames

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

#4 2018-06-01 16:13:43

progandy
Member
Registered: 2012-05-17
Posts: 5,304

Re: [Solved] Diskless Computers with Different Hostnames

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.

dhcpcd manpage wrote:

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.

https://manned.org/dnsmasq.8

--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

#5 2018-06-01 18:14:02

Proofrific
Member
Registered: 2008-01-05
Posts: 215

Re: [Solved] Diskless Computers with Different Hostnames

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

Board footer

Powered by FluxBB