Everyone knows DHCP. Yes your PC gets something like a lease for a time...
Do you know how to ask your PC, when this lease expires?
This is not very difficult:
On Windows:
On Linux you can configure your client very easy:
Add inside /etc/dhclient.conf the following line
There is a nice starting point provided by Microsoft: http://support.microsoft.com/kb/121005. But with this information you only know that you have to add the following key inside the registry:
Do you know how to ask your PC, when this lease expires?
This is not very difficult:
On Windows:
ipconfig /allOn Linux:
Ethernetadapter Drahtlose Netzwerkverbindung:
Verbindungsspezifisches DNS-Suffix: mydomain.me
Beschreibung. . . . . . . . . . . : Intel(R) PRO/Wireless 2200BG Network Connection
Physikalische Adresse . . . . . . : 00-12-34-56-78-90
DHCP aktiviert. . . . . . . . . . : Ja
Autokonfiguration aktiviert . . . : Ja
IP-Adresse. . . . . . . . . . . . : 192.168.18.21
Subnetzmaske. . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : 192.168.18.1
DHCP-Server . . . . . . . . . . . : 192.168.18.1
DNS-Server. . . . . . . . . . . . : 192.168.18.1
Lease erhalten. . . . . . . . . . : Dienstag, 22. September 2009 20:58:40
Lease läuft ab. . . . . . . . . . : Freitag, 2. Oktober 2009 20:58:40
cat /var/lib/dhcp3/dhclient.leasesThis is ok, but what if you use a black box as router, where you can not adjust the dhcpd parameters? Something like changing the lease time, because 756000s=210h=8.75d is really to long for a network, where you use computers only on a hourly base...
lease {
interface "eth1";
fixed-address 192.168.18.21;
option subnet-mask 255.255.255.0;
option routers 192.168.18.1;
option dhcp-lease-time 864000;
option dhcp-message-type 5;
option domain-name-servers 192.168.18.1;
option dhcp-server-identifier 192.168.18.1;
option dhcp-renewal-time 432000;
option ntp-servers 192.168.18.1;
option broadcast-address 192.168.18.255;
option dhcp-rebinding-time 756000;
option domain-name "mydomain.me";
renew 6 2009/09/26 15:58:34;
rebind 3 2009/09/30 12:17:44;
expire 4 2009/10/01 18:17:44;
}
On Linux you can configure your client very easy:
Add inside /etc/dhclient.conf the following line
send dhcp-lease-time 3600;After this little change start dhcp with
dhclient -cf /etc/dhclient.confand your lease details show:
option dhcp-lease-time 3600;On Windows this is nearly impossible:
option dhcp-renewal-time 1800;
option dhcp-rebinding-time 3150;
There is a nice starting point provided by Microsoft: http://support.microsoft.com/kb/121005. But with this information you only know that you have to add the following key inside the registry:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Dhcp\Parameters\Options\51With the explanation given there
Lease Time (51): This option is used in a client request (DHCPDISCOVER or DHCPREQUEST) to allow the client to request a lease time for the IP address. In a server reply (DHCPOFFER), a DHCP server uses this option to specify the lease time it is willing to offer. The time is in seconds, and is specified as a 32-bit unsigned integer. The code for this option is 51, and its length is 4.it is not possible without any futher documentation to create the appropriate keys and values ... ;-(