[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fw: How does a linux dhcp client know it's name?



Icebiker wrote:


----- Original Message ----- From: "Alan Chandler" <alan@chandlerfamily.org.uk>
To: <debian-user@lists.debian.org>
Sent: Monday, October 11, 2004 15:37
Subject: Re: How does a linux dhcp client know it's name?


On Monday 11 October 2004 14:59, Icebiker wrote:


/etc/hostname said "flipper". I tried pasting the local domain name on (my DLink router has a field for local domain name), but that didn't seem to do
anything.

I can't figure out how:

- the resolver gets the host name from /etc/hostname, if that's what's
supposed to happen.


I "think" that

/etc/init.d/hostname.sh calls "hostname" to set the name from /etc/hostname

the domain name comes from either /etc/hosts or from bind according to the
setting in /etc/host.conf

This gives the order (although /etc/nsswitch.conf comes in somewhere too)

If dns then looks in /etc/resolv.conf to find out where the dns is. If file,
it looks up /etc/hosts

dhcp3-client sets the info in /etc/resolv.conf.

You can cause a dhcp request to recognise the MAC address of the ethernet card
and to use that to always issue the same ip address to your box.

[NOT for your DLINK router - see why below] In fact - better than that - the dhcp server can look up which ip address it wants to give you by looking up
the name on a dns server.


- the router gets the hostname from the box (it can get the hostname for all my Windows boxes). Does the dhcp request pass the name to the router,
or does the router query for the name from the computer.


I can't image how it does this other than potentially using NETBUI



Does anybody know what package contains the resolv+ man page? Is it still
called resolv+


man hostname
man resolv.conf
man host.conf

are all useful


I suppose I could set up static IP addresses, but that seems like giving
up.


This is the way I do it

I have my own dhcp server and nameserver running on a linux box. This is
master for the rest of the network.  Its own ip address is static
(/etc/network/interfaces). 192.168.0.10 is the DLINK router and 192.168.0.20
is this linux box.  I use both as nameservers

The /etc/dhcp3/dhcpd.conf

shared-network home-net {
 option domain-name "home";
 option domain-name-servers 192.168.0.20, 192.168.0.10;

 option subnet-mask 255.255.255.0;
 default-lease-time 21600;
 max-lease-time 86400;
 authoritative;
 subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.40 192.168.0.59;
   option routers 192.168.0.10;
 }

# The following are hosts which require a fixed ip-address (for instance
#  so that NAT can direct things to them)
#

 host roo {
   hardware ethernet 00:50:da:ec:83:9a;
   fixed-address roo.home;
 }
 host rabbit {
   hardware ethernet 00:06:5b:b7:9c:35;
   fixed-address rabbit.home;
 }
 host piglet {
   hardware ethernet 00:0b:cd:a9:f2:62;
   hardware ethernet 00:06:25:2a:fa:25;
   fixed-address piglet.home;
 }
 host eeyore {
   hardware ethernet 00:0b:cd:32:77:75;
   hardware ethernet 00:20:e0:5e:18:67;
   fixed-address eeyore.home;
 }
 host kanger {
   hardware ethernet 00:50:DA:CF:A5:06;
   fixed-address kanger.home;
 }
 host pooh {
   hardware ethernet 00:30:1B:11:32:11;
   fixed-address pooh.home;
 }
 host small {
   hardware ethernet 00:06:25:57:19:5D;
   fixed-address small.home;
 }
 host owl  {
   hardware ethernet 00:09:5b:24:f1:12;
   fixed-address owl.home;
 }
}

subnet 82.43.0.0 netmask 255.255.0.0 {
 not authoritative;
}


--
Alan Chandler
alan@chandlerfamily.org.uk
First they ignore you, then they laugh at you,
then they fight you, then you win. --Gandhi


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org




This helped a lot. If understand this, the only way gethostbyname can find it's local ip address is either through the name server, or /etc/hosts.

It looks then that I'm expecting too much from from my router as a name server (well, it was only $30), and that /etc/hosts is really the only way to go for my configuration (which is probably what just about everybody does anyway, but I wanted to do it the hard way).

Thanks - icebiker



Reply to: