Re: How does dhcp(d) choose an IP address?



Timothy Murphy wrote:
I was reading the thread on "Determining IP information for lo"
and it reminded of a strange phenomena I noticed on my system.

The laptop I am using now, which should be 192.168.2.11
(according to /etc/hosts)
has been given the address 192.168.2.101,
although I don't see any mention of this address
anywhere on the desktop running dhcpd,
or on the laptop,
except in /var/lib/dhclient/dhclient-eth0.leases .
(The correct MAC address for the laptop, and its desired IP address,
is given in /etc/dhcpd.conf , but for some reason this is ignored.)

I should say that WiFi works perfectly well with this wrong address.
But it has made me realize that I am very hazy about how dhcp works,
and how exactly dhcpd determines the addresses it will give out.
Is there a reasonably clear account of this anywhere?

I saw incidentally that something or someone
(I assume a yum update)
had moved /etc/dhclient.conf to dhclient.conf.bak ,
just leaving what looked like a fairly useless dhclient.conf.sample ,
confirming my view that the people who write sample files for Fedora
are somewhat lacking in common sense.

The answer to the Q in the subject line is fairly complicated, but basically, the DHCP server has a range from which it can issue IP addresses, as in this para:

subnet 192.168.8.0 netmask 255.255.255.0 {
range 192.168.8.150 192.168.8.169;
option domain-name-servers 192.168.9.4;
option routers 192.168.8.4;

}

DHCP clients generally ask for their previous IP address, and if it's available to them they probably get it.

The server can be configured to hand out fixed IP address thus:
host printer {
hardware ethernet 00:40:8c:10:7d:3a;
fixed-address 192.168.9.2;
}
A client configured for a fixed IP address won't receive one from the range, or the address it requests (unless it's the fixed one).

If, considering the above points the client hasn't an address, the server selects one from the range, tests whether it's available, and if so, offers it.

Check your server logs for messages containing DHCP for more illumination.

There are possible complications; I can offer different information to one machine depending on whether it's the BIOS, Anaconda, Debian's installer, (probably) Windows or something else requesting



--

Cheers
John

-- spambait
1aaaaaaa@xxxxxxxxxxxxxxxx Z1aaaaaaa@xxxxxxxxxxxxxxxx

Please do not reply off-list

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: Application Hang
    ... Back to DHCP, what about the client ipconfig without the DG ip address? ... When the old server crashed, it required a new motherboard and CPU. ... You should see at least,006 DNS servers, 003 Router. ...
    (microsoft.public.windows.server.networking)
  • Re: Windows Server 2003 DHCP server - Does not release IP Addresses
    ... on the SWITCH or the ROUTER. ... the clients will not know which server to go for DHCP REQUEST. ... And, if that Switch had some issues, how will the other DHCP server ... This error is usually received when the client booting up via PXE is ...
    (microsoft.public.windows.server.general)
  • Re: DHCP handles Naks one one vlan differently
    ... If the problem is on the network with the DHCP server, ... Frame 156 ... Your (client) IP address: 0.0.0.0 ...
    (comp.dcom.sys.cisco)
  • Re: Sending hostname with DHCP
    ... default route and the default dns host. ... Below is my /etc/resolv.conf created by the dhcp client. ... > This seems to depend on the client as much as the server. ...
    (Fedora)
  • Re: DHCP server not responding to clients on other subnets
    ... When I do my tests I shutdown the other DHCP server (or I disconnect it from ... client workstation I get the message "DHCP server unreachable". ... Hardware type: Ethernet ...
    (microsoft.public.windows.server.networking)