Networking Forums

Networking Forums > Computer Networking > Linux Networking > Howto determine if a system is using DHCP or STATIC IP

Reply
Thread Tools Display Modes

Howto determine if a system is using DHCP or STATIC IP

 
 
shcodip
Guest
Posts: n/a

 
      03-20-2007, 05:32 PM
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
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      03-20-2007, 06:03 PM
On 2007-03-20, shcodip <(E-Mail Removed)> 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


If is using dhcp it has either dhcpcd or dhclient running.
Davide

--
We all know Linux is great...it does infinite loops in 5 seconds.
-- Linus Torvalds
 
Reply With Quote
 
Sir Jackery
Guest
Posts: n/a

 
      03-20-2007, 06:03 PM
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
 
Pascal Hambourg
Guest
Posts: n/a

 
      03-20-2007, 06:35 PM
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
 
Kalyan Manchikanti
Guest
Posts: n/a

 
      03-20-2007, 06:54 PM
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
 
Sir Jackery
Guest
Posts: n/a

 
      03-20-2007, 07:06 PM
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
 
Mark Hobley
Guest
Posts: n/a

 
      03-20-2007, 08:03 PM
shcodip <(E-Mail Removed)> 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
 
lisa.powell@gmail.com
Guest
Posts: n/a

 
      03-20-2007, 10:09 PM
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
 
Balwinder S \bsd\ Dheeman
Guest
Posts: n/a

 
      03-21-2007, 03:21 AM
On 03/21/2007 02:33 AM, Mark Hobley wrote:
> shcodip <(E-Mail Removed)> 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
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
determine IP r without DHCP rmc Wireless Internet 5 05-17-2006 08:15 AM
how to determine the dhcp servers within the network OM Windows Networking 1 11-24-2005 11:09 AM
What's the right way to switch a system from DHCP client to static IP# ? Al Dykes Linux Networking 4 05-14-2005 06:21 PM
DHCP HOWTO Rich Grise Linux Networking 0 02-20-2004 05:25 AM
howto determine souce of hack attempt Eric Linux Networking 1 12-19-2003 06:54 AM



1 2 3 4 5 6 7 8 9 10 11