Re: DHCP connection time
- From: Bit Twister <BitTwister@xxxxxxxxxxxxxxxx>
- Date: 29 Mar 2007 05:01:45 GMT
On Wed, 28 Mar 2007 19:58:52 -0500, Rehceb Rotkiv wrote:
On Wed, 28 Mar 2007 22:21:46 +0000, Bit Twister wrote:
That is kinda funny question.
Why?
You asked
"where can I see how long my DHCP internet connection is already running"
and I was refering to /how long has the connection been running/ part
of the question.
Doing an "uptime" on my box shows
23:04:54 up 16 days, 11:05,
So for me, the dhcp connection has been up 16 days, 11 hours, minutes,
because I have yet to reboot the network.
But checking time stamp on the lease file
ls -al /var/lib/dhcp/dhclient-eth1.leases
-rw-r--r-- 1 root root 8702 Mar 28 13:05 /var/lib/dhcp/dhclient-eth1.leases
and using it's contents we see
Obtained Wed Mar 28 13:05:58 CDT 2007
Renewal 2007/3/29 04:55:22;
Rebind 2007/3/29 15:05:56;
Expires 2007/3/29 18:05:56;
with a option dhcp-lease-time 86400; which is like yours, a 24 hour
lease time.
<snip>I'll guess you look at the lease file and
current date/time and do some math.
man dhclient for location of lease file. hint: ls /var/lib/dhcp/*
The content of the relevant file makes no sense to me:
lease {
interface "eth1";
expire 2 2007/3/27 22:22:54;
}
The connection is definitely not from 2007-03-27 as I switched on the PC
a few hours ago, that is on 2007-03-28. After a reconnect the file looks
like this:
Lease file is looking pretty normal as far as it goes.
You get a new "lease" stanza every time you get a new lease.
The last stanza is normally the one of interest, assuming it is within
the lease time as the dhcp server is concerned.
lease {
interface "eth1";
fixed-address 192.168.0.5;
option subnet-mask 255.255.255.0;
option routers 192.168.0.1;
option dhcp-lease-time 86400;
option dhcp-message-type 5;
option domain-name-servers 192.168.0.1;
option dhcp-server-identifier 192.168.0.1;
option dhcp-renewal-time 43200;
option dhcp-rebinding-time 75600;
renew 4 2007/3/29 10:04:03;
rebind 4 2007/3/29 21:45:52;
expire 5 2007/3/30 00:45:52;
}
Now I see the correct lease time (00:45), strangely in GMT and not in my
local timezone.
Curious, how do you know it is in GMT. :)
Then again it would depend on what time your router/dhcp server has.
"Expire 5" is also clear, it's the expiration time
(+24h). But I do not understand what the other times are supposed to
mean, as they refer to the past!?
I guess you are talking about the lease { } stanza times.
They are the old dhcp lease event stanzas.
The /option dhcp*time/ lines are seconds to their event relative to the last
lease obtained from the dhcp server.
And why didn't I get the correct lease time before the reconnect?
I maintain you received the correct lease time and did not know the
stanzas are the old values from network/bootup/renew events.
I would be glad if you could shed some light on this!
In a nutshell, your dhcp client will contact the dhcp server to renew the
"lease". The renew, rebind and expire times are when they need/may happen.
The client can attempt to get a renewal 43200 seconds from the last
renewal time. See that is a relative value and is not going to be
easy to get the /how long has the connection been running/ time. :)
Looking at the lease { } data all you know is the lease was renewed
sometime before the "expire" date/time. :(
If you are wanting to keep the same ip address, you need to renew the
"lease" before the rebind time expires and if you want to keep the
connection you need to renew before the expire time.
.
- Follow-Ups:
- Re: DHCP connection time
- From: Rehceb Rotkiv
- Re: DHCP connection time
- From: Joe Feise
- Re: DHCP connection time
- References:
- DHCP connection time
- From: Rehceb Rotkiv
- Re: DHCP connection time
- From: Bit Twister
- Re: DHCP connection time
- From: Rehceb Rotkiv
- DHCP connection time
- Prev by Date: Re: DHCP connection time
- Next by Date: Re: DHCP connection time
- Previous by thread: Re: DHCP connection time
- Next by thread: Re: DHCP connection time
- Index(es):
Relevant Pages
|