Howto determine if a system is using DHCP or STATIC IP

This is a discussion on Howto determine if a system is using DHCP or STATIC IP within the Linux Networking forums, part of the Linux Forums category; So obviously you have to be using one or the other. :) I would like to know the simplest way to ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-20-2007
shcodip
 
Posts: n/a
Default Howto determine if a system is using DHCP or STATIC IP

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.

Reply With Quote
  #2 (permalink)  
Old 03-20-2007
Sir Jackery
 
Posts: n/a
Default Re: Howto determine if a system is using DHCP or STATIC IP

On Tue, 20 Mar 2007, shcodip 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.
>


DHCP is dynamic host configuration protocol. This does not necessarily
mean that the IP is dynamic. DHCP servers can assign static IPs. If you
want to know if a host has been configured from a DHCP server check the
logs in /var/log. If you want to know if a host is assigned a dynamic IP
address you would need to examine the configuration on the DHCP server
assigning it.

--
Sir Jackery
Reply With Quote
  #3 (permalink)  
Old 03-20-2007
Pascal Hambourg
 
Posts: n/a
Default Re: Howto determine if a system is using DHCP or STATIC IP

Hello,

shcodip a écrit :
> So obviously you have to be using one or the other.


No.
An IP address can be assigned using IPCP on PPP links, stateless
autoconfiguration, Zeroconf, and probably other methods.
Reply With Quote
  #4 (permalink)  
Old 03-20-2007
Kalyan Manchikanti
 
Posts: n/a
Default Re: Howto determine if a system is using DHCP or STATIC IP

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..

Reply With Quote
  #5 (permalink)  
Old 03-20-2007
Sir Jackery
 
Posts: n/a
Default Re: Howto determine if a system is using DHCP or STATIC IP

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
Reply With Quote
  #6 (permalink)  
Old 03-20-2007
Mark Hobley
 
Posts: n/a
Default Re: Howto determine if a system is using DHCP or STATIC IP

shcodip <powellj@gmail.com> wrote:
> I would like to know the simplest way to determine if a system is using DHCP
> or not without parsing through the ifcfg scripts.


Why not parse the /etc/network/interfaces file?

--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/

Reply With Quote
  #7 (permalink)  
Old 03-21-2007
lisa.powell@gmail.com
 
Posts: n/a
Default Re: Howto determine if a system is using DHCP or STATIC IP

interface files may or may not exist for me. I could require that they
exist however.

Thanks for your suggestions.

On Mar 20, 2:03 pm, markhob...@hotpop.deletethisbit.com (Mark Hobley)
wrote:
> shcodip <powe...@gmail.com> wrote:
> > I would like to know the simplest way to determine if a system is using DHCP
> > or not without parsing through the ifcfg scripts.

>
> Why not parse the /etc/network/interfaces file?
>
> --
> Mark Hobley
> 393 Quinton Road West
> QUINTON
> Birmingham
> B32 1QE
>
> Telephone: (0121) 247 1596
> International: 0044 121 247 1596
>
> Email: markhobley at hotpop dot donottypethisbit com
>
> http://markhobley.yi.org/



Reply With Quote
  #8 (permalink)  
Old 03-21-2007
Balwinder S \bsd\ Dheeman
 
Posts: n/a
Default Re: Howto determine if a system is using DHCP or STATIC IP

On 03/21/2007 02:33 AM, Mark Hobley wrote:
> shcodip <powellj@gmail.com> wrote:
>> I would like to know the simplest way to determine if a system is using DHCP
>> or not without parsing through the ifcfg scripts.

>
> Why not parse the /etc/network/interfaces file?


1. It can easily be bypassed by a command line request.
2. It is Debian specific.

--
Dr Balwinder S "bsd" Dheeman Registered Linux User: #229709
Anu'z Linux@HOME Machines: #168573, 170593, 259192
Chandigarh, UT, 160062, India Gentoo, Fedora, Knoppix/FreeBSD/XP
Home: http://cto.homelinux.net/~bsd/ Visit: http://counter.li.org/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:50 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0