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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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.. |
|
|||
|
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 |
|
|||
|
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/ |
|
|||
|
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/ |
|
|||
|
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/ |