You are not logged in.

#1 2011-01-11 08:37:54

kikinovak
Member
From: Montpezat (South France)
Registered: 2005-12-07
Posts: 96
Website

[Solved] Managing hostnames centrally?

Hi,

I'm running a small LAN with CentOS, and I'm currently replacing everything with Arch (excellent docs, more fresh, sufficiently stable, ...). On the existing system (CentOS), hostnames are managed centrally with a DHCP and DNS server. On the DHCP server side, hostnames are to be given out according to MAC addresses, like this :

# /etc/dhcpd.conf
#
# Options globales
ddns-update-style interim;
authoritative;
default-lease-time  86400; # un jour
max-lease-time      86400; # un jour

# Données du réseau local
option broadcast-address    192.168.1.255;
option subnet-mask          255.255.255.0;
option routers              192.168.1.254;
option domain-name-servers  192.168.1.1;
option domain-name          "presbytere.montpezat";

# Plage d'adresses dynamiques
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.2 192.168.1.250;
}

host bernadette {
  hardware ethernet 00:0d:61:a6:e7:1e;
  fixed-address 192.168.1.2;
  option host-name "bernadette";
}

host raymonde {
  hardware ethernet 00:20:ed:b8:e8:ec;
  fixed-address 192.168.1.3;
  option host-name "raymonde";
}

host jukebox {
  hardware ethernet 00:50:8b:fa:8a:66;
  fixed-address 192.168.1.4;
  option host-name "jukebox";
}

host buzz-wireless {
  hardware ethernet 00:13:ce:ee:20:3a;
  fixed-address 192.168.1.6;
  option host-name "buzz";
}

host buzz-wired {
  hardware ethernet 00:0b:97:96:3c:e1;
  fixed-address 192.168.1.6;
  option host-name "buzz";
}

Bind is configured so machines can reach each other by their hostnames.

On the CentOS client side, no hostname is hardcoded. The configuration looks like this :

# /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
# /etc/hosts
127.0.0.1 localhost.localdomain localhost
# /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

Thus, when a client boots, it gets its hostname by DHCP, and 'hostname --fqdn' returns something like 'raymonde.presbytere.montpezat'.

Question : how can I achieve something similar on Arch clients? Anybody here having a similar setup?

Last edited by kikinovak (2011-01-11 08:56:09)


Dyslexics have more fnu.

Offline

#2 2011-01-11 08:55:35

kikinovak
Member
From: Montpezat (South France)
Registered: 2005-12-07
Posts: 96
Website

Re: [Solved] Managing hostnames centrally?

's OK, I fiddled around with it, and the obvious solution worked surprisingly.

# /etc/rc.conf
...
HOSTNAME="localhost"
...
# /etc/hosts
127.0.0.1 localhost.localdomain localhost

After rebooting, here's what I get :

$ hostname
raymonde
$ hostname --fqdn
raymonde.presbytere.montpezat

Dyslexics have more fnu.

Offline

Board footer

Powered by FluxBB