On Tue, 20 Mar 2007, Kalyan Manchikanti wrote:
> On Mar 20, 1:32 pm, "shcodip" <powe...@gmail.com> wrote:
>> So obviously you have to be using one or the other.
I would like to
>> know the simplest way to determine if a system is using DHCP or not
>> without parsing through the ifcfg scripts.
>
> Check the file called /var/lib/dhcp*/dhclient.<interface>.leases to
> see if it has a recent entry for your ip address or check if dhclient
> is running..
>
>
A machine whose IP was configured from a DHCP server will not necessarily
have an instance of dhclient resident in memory. In addition, the lease
file may be configured to be in different locations. Not to mention that
if an IP is assigned from a DHCP server a fraction of a second before it
is manually configured the lease file would still appear recent. I can't
think of any way to absolutely determine if a machine's IP address had
been configured from a DHCP server. I'd think the only way to do it would
be to monitor the machine as it's IP address is being configured.
--
Sir Jackery