Re: [CentOS] Set hostname via DHCP ?

2009-06-29 Thread Andreas Pedersen
If your trying to make CentOS/Fedora boxes to get hostname remember you need
to have localhost.localdomain in /etc/sysconfig/network.
HOSTNAME=localhost.localdomain

see around line 252-261
/etc/sysconfig/network-scripts/network-functions
need_hostname ()
{
CHECK_HOSTNAME=`hostname`
if [ $CHECK_HOSTNAME = (none) -o $CHECK_HOSTNAME = localhost -o
\
$CHECK_HOSTNAME = localhost.localdomain ]; then
return 0
else
return 1
fi
}


__
Andreas Pedersen


On Sun, Jun 28, 2009 at 11:35 PM, Rob Townley rob.town...@gmail.com wrote:

 # i do NOT have any kind of use-host-decl-names on; entry.  Do you use
 dnsmasq or dhcpd?
 # /etc/dhcpd.conf   Not sure if a dnsmasq entry would be the same anymore.
 host babasse {
hardware ethernet 00:0d:61:ae:6b:8f;
fixed-address 192.168.1.249;
 option host-name
 PutClientHostNameHereNotSureIfItHasToBeSameAsAbove-babasse;
 }

 #Don't remember what happens when a linux client machine has already
 been configured.
 #But know for a fact that all pxe booted and live linux booted and
 Windows Vista and WinXP
 #machines use the hostname from the dhcpd entry.

 On Sun, Jun 28, 2009 at 10:38 AM, Niki Kovacscont...@kikinovak.net
 wrote:
  Hi.
 
  I just setup one of my machines as a DHCP server. I'd like it to handle
  the hostnames of clients. Don't know if this is an orthodox thing to do
  (feel free to add your comments :oD). Here's the server's relevant lines
  of dhcpd.conf:
 
  --8---
  ...
  # Envoyer les noms d'hôtes aux clients
  use-host-decl-names on;
 
  # Adresses statiques
  host babasse {
hardware ethernet 00:0d:61:ae:6b:8f;
fixed-address 192.168.1.249;
  }
  --8---
 
  Now the question is: how should the configuration look like on the
  client side, so the hostname gets effetively fetched from the DHCP
  server? During the initial install, I assigned hostnames manually to
  every machine.
 
  Cheers,
 
  Niki Kovacs
  ___
  CentOS mailing list
  CentOS@centos.org
  http://lists.centos.org/mailman/listinfo/centos
 
 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Set hostname via DHCP ?

2009-06-29 Thread Niki Kovacs
Rob Townley a écrit :
 # i do NOT have any kind of use-host-decl-names on; entry.  Do you use
 dnsmasq or dhcpd?

I'm using DHCPD. I took two spare machines this morning and played 
around with them to make some tests. Here's what I got.

a) Server-side, static IP configuration of course, here's what 
dhcpd.conf looks like:

# 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-address192.168.1.255;
option subnet-mask  255.255.255.0;
option routers  192.168.1.254;
option domain-name-servers  62.4.16.70, 62.4.17.69;
option domain-name  local;

# Plage d'adresses dynamiques
subnet 192.168.1.0 netmask 255.255.255.0 {
   range 192.168.1.1 192.168.1.240;
}

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

b) on the client side, just a plain (default) DHCP client configuration. 
Now the client (raymonde) gets his pre-defined address OK. And even 
the hostname gets transmitted. Now the question is: how do I also assign 
the domain name (local) to the client?

If I take a look at /var/lib/dhclient/dhclient-eth0.leases (on the 
client), here's a summary of the lease:

lease {
   interface eth0;
   fixed-address 192.168.1.2;
   option subnet-mask 255.255.255.0;
   option routers 192.168.1.254;
   option dhcp-lease-time 86400;
   option dhcp-message-type 5;
   option domain-name-servers 62.4.16.70,62.4.17.69;
   option dhcp-server-identifier 192.168.1.252;
   option broadcast-address 192.168.1.255;
   option host-name raymonde;
   option domain-name local;
   renew 1 2009/6/29 17:04:30;
   rebind 2 2009/6/30 04:47:44;
   expire 2 2009/6/30 07:47:44;
}

Here's what 'hostname' returns:

# hostname
raymonde

But when I go for the domain name, I get this:

# hostname -d
hostname: Hôte inconnu -- means 'Unknown host' in french :o)

Any idea what I'm doing wrong here?

Cheers,

Niki

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Set hostname via DHCP ?

2009-06-29 Thread Niki Kovacs
Niki Kovacs a écrit :
 
 If I take a look at /var/lib/dhclient/dhclient-eth0.leases (on the 
 client), here's a summary of the lease:
 
 lease {
interface eth0;
fixed-address 192.168.1.2;
option subnet-mask 255.255.255.0;
option routers 192.168.1.254;
option dhcp-lease-time 86400;
option dhcp-message-type 5;
option domain-name-servers 62.4.16.70,62.4.17.69;
option dhcp-server-identifier 192.168.1.252;
option broadcast-address 192.168.1.255;
option host-name raymonde;
option domain-name local;
renew 1 2009/6/29 17:04:30;
rebind 2 2009/6/30 04:47:44;
expire 2 2009/6/30 07:47:44;
 }
 
 Here's what 'hostname' returns:
 
 # hostname
 raymonde
 
 But when I go for the domain name, I get this:
 
 # hostname -d
 hostname: Hôte inconnu -- means 'Unknown host' in french :o)
 
 Any idea what I'm doing wrong here?

OK, I think I got my mistake. When I specify a domain name (with 'option 
domain-name'), this is in fact what gets written to the client's 
/etc/resolv.conf in the 'search' line. But to handle the fully qualified 
domain name centrally, I have to use DNS.

Correct me if I'm wrong.

Niki
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Set hostname via DHCP ?

2009-06-29 Thread Tsai Li Ming


Niki Kovacs wrote:
 Niki Kovacs a écrit :
 If I take a look at /var/lib/dhclient/dhclient-eth0.leases (on the 
 client), here's a summary of the lease:

 lease {
interface eth0;
fixed-address 192.168.1.2;
option subnet-mask 255.255.255.0;
option routers 192.168.1.254;
option dhcp-lease-time 86400;
option dhcp-message-type 5;
option domain-name-servers 62.4.16.70,62.4.17.69;
option dhcp-server-identifier 192.168.1.252;
option broadcast-address 192.168.1.255;
option host-name raymonde;
option domain-name local;
renew 1 2009/6/29 17:04:30;
rebind 2 2009/6/30 04:47:44;
expire 2 2009/6/30 07:47:44;
 }

 Here's what 'hostname' returns:

 # hostname
 raymonde

 But when I go for the domain name, I get this:

 # hostname -d
 hostname: Hôte inconnu -- means 'Unknown host' in french :o)

 Any idea what I'm doing wrong here?
 
 OK, I think I got my mistake. When I specify a domain name (with 'option 
 domain-name'), this is in fact what gets written to the client's 
 /etc/resolv.conf in the 'search' line. But to handle the fully qualified 
 domain name centrally, I have to use DNS.
 
 Correct me if I'm wrong.
 

In our environment, our dhcp client machines (rhel or centos) gets their 
hostname by dns lookups (Not sure why).

Our dhcp server generally just provides the usual configurations like 
dns/search optionse/etc. The ip addresses for our dhcp range have both 
forward and reverse mappings on our dns server and the clients obtain 
the proper fully qualified host name upon dhcp request.


HTH,
Liming


___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Set hostname via DHCP ?

2009-06-29 Thread Filipe Brandenburger
Hi,

On Mon, Jun 29, 2009 at 04:00, Niki Kovacscont...@kikinovak.net wrote:
 host raymonde {
   hardware ethernet 00:20:ed:b8:e8:ec;
   fixed-address 192.168.1.2;
   option host-name raymonde;
 }
[...]
 lease {
   option host-name raymonde;
   option domain-name local;
 }
 Here's what 'hostname' returns:
 # hostname
 raymonde
 But when I go for the domain name, I get this:
 # hostname -d
 hostname: Hôte inconnu -- means 'Unknown host' in french :o)
 Any idea what I'm doing wrong here?

I guess you have to use this in dhcpd.conf:

option host-name raymonde.local;

At least, in my dhclient-eth0.leases file I have option host-name with
the fully qualified host name...

I am getting host names from DNS with get-lease-hostnames on; in
dhcpd.conf, so I think it does what I expect (sending FQDNs) in that
case...

HTH,
Filipe
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


[CentOS] Set hostname via DHCP ?

2009-06-28 Thread Niki Kovacs
Hi.

I just setup one of my machines as a DHCP server. I'd like it to handle 
the hostnames of clients. Don't know if this is an orthodox thing to do 
(feel free to add your comments :oD). Here's the server's relevant lines 
of dhcpd.conf:

--8---
...
# Envoyer les noms d'hôtes aux clients
use-host-decl-names on;

# Adresses statiques
host babasse {
   hardware ethernet 00:0d:61:ae:6b:8f;
   fixed-address 192.168.1.249;
}
--8---

Now the question is: how should the configuration look like on the 
client side, so the hostname gets effetively fetched from the DHCP 
server? During the initial install, I assigned hostnames manually to 
every machine.

Cheers,

Niki Kovacs
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Set hostname via DHCP ?

2009-06-28 Thread Ron Loftin

On Sun, 2009-06-28 at 17:38 +0200, Niki Kovacs wrote:
 Hi.
 
 I just setup one of my machines as a DHCP server. I'd like it to handle 
 the hostnames of clients. Don't know if this is an orthodox thing to do

I really don't know if it's orthodox or not, but I've been doing it
like this for years. ;^

  
 (feel free to add your comments :oD). Here's the server's relevant lines 
 of dhcpd.conf:
 
 --8---
 ...
 # Envoyer les noms d'hôtes aux clients
 use-host-decl-names on;
 
 # Adresses statiques
 host babasse {
hardware ethernet 00:0d:61:ae:6b:8f;
fixed-address 192.168.1.249;
 }
 --8---

This config is just about identical to mine.

 
 Now the question is: how should the configuration look like on the 
 client side, so the hostname gets effetively fetched from the DHCP 
 server? During the initial install, I assigned hostnames manually to 
 every machine.

Unless you have modified the DHCP client config, the machine SHOULD get
the hostname by default.  You can verify this by checking the contents
of /var/lib/dhclient/dhclient-eth0.leases to see the data that the
client has gotten from the server.

Since I let my client machines get all this from DHCP during
installation, I'm not completely sure what you need to do to make the
manually-assigned hostname go away.  I THINK that if you comment out the
line for the host's IP address in /etc/hosts the system will use the
hostname from DHCP, but I haven't exercised that stuff in years.

 
 Cheers,
 
 Niki Kovacs
 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos
-- 
Ron Loftin  relof...@twcny.rr.com

God, root, what is difference ?   Piter from UserFriendly

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Set hostname via DHCP ?

2009-06-28 Thread Rob Townley
# i do NOT have any kind of use-host-decl-names on; entry.  Do you use
dnsmasq or dhcpd?
# /etc/dhcpd.conf   Not sure if a dnsmasq entry would be the same anymore.
host babasse {
hardware ethernet 00:0d:61:ae:6b:8f;
fixed-address 192.168.1.249;
option host-name
PutClientHostNameHereNotSureIfItHasToBeSameAsAbove-babasse;
}

#Don't remember what happens when a linux client machine has already
been configured.
#But know for a fact that all pxe booted and live linux booted and
Windows Vista and WinXP
#machines use the hostname from the dhcpd entry.

On Sun, Jun 28, 2009 at 10:38 AM, Niki Kovacscont...@kikinovak.net wrote:
 Hi.

 I just setup one of my machines as a DHCP server. I'd like it to handle
 the hostnames of clients. Don't know if this is an orthodox thing to do
 (feel free to add your comments :oD). Here's the server's relevant lines
 of dhcpd.conf:

 --8---
 ...
 # Envoyer les noms d'hôtes aux clients
 use-host-decl-names on;

 # Adresses statiques
 host babasse {
   hardware ethernet 00:0d:61:ae:6b:8f;
   fixed-address 192.168.1.249;
 }
 --8---

 Now the question is: how should the configuration look like on the
 client side, so the hostname gets effetively fetched from the DHCP
 server? During the initial install, I assigned hostnames manually to
 every machine.

 Cheers,

 Niki Kovacs
 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos