dhclient

I have noticed that when switching LAN cables from one router to another the IP address gets automatically reassigned and am just curious as to how this gets triggered. Can anyone explain?
 
Your DHCP server issues DHCP leases in the form of IP's.
These leases have a lifetime which is a setting within the DHCP server. Common values are 24hr.,48hr.,72hr.
So the DHCP server keeps a list of the leases it issues and when you change routers your lease follows your MAC address.
If your using pfSense then it is your networks DHCP server.
 
Thanks for the explanation, but what I actually looking for is what is it on the client that monitors that the cable has been changed and that it is connected to a diiferent dhcp server? Does dhclient constantly monitor the state of the connection?
 
Well dhclinet is a daemon that is always running in the backround.
root@E6420:~ # ps -ax|grep dhclient
861 - Is 0:00.00 dhclient: wlan0 [priv] (dhclient)
919 - Is 0:00.00 dhclient: wlan0 (dhclient)

I would think that the signal that the connection is up/down would be handled at a lower level.
Like the network interface level, then that would signal to dhclinet -IF UP/DOWN

Doing some reading it may be handled by network sockets. Run netstat and this shows the network sockets.
 
/etc/devd.conf
Code:
#
# Try to start dhclient on Ethernet-like interfaces when the link comes
# up.  Only devices that are configured to support DHCP will actually
# run it.  No link down rule exists because dhclient automatically exits
# when the link goes down.
#
notify 0 {
        match "system"          "IFNET";
        match "type"            "LINK_UP";
        media-type              "ethernet";
        action "/etc/rc.d/dhclient quietstart $subsystem";
};
 
Back
Top