Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 04-01-2010, 08:27 AM   #1
LQ Newbie
Registered: Oct 2008
Location: Manchester - UK
Distribution: Debian (Lenny)
Posts: 18

Rep: Reputation: 0
DHCP server auto-detect.


I have a scenario where a Debian (in this case) device will be connected to an existing LAN.

What I then want said box to do, is to query the LAN to see if there is an existing DHCP server present. If there isn't one - then simply use the Debian box as the DHCP server (which works fine atm).

If there is an existing one - I need the Debian box to be able to turn off it's own internal one and get it's details from the existing server (ie. change from server to client).

These action will need to be sat in the background as well - just in case another DHCP server appears on the LAN after this box does. Don't shoot me for saying it - but I know Windoze server does this. Is there a 'script/util' that anyone knows of (I am trying to do this auto-magically)?


PS - Debian Etch if that makes a difference.
Old 04-01-2010, 10:26 AM   #2
never say never
Registered: Sep 2009
Location: Indiana, USA
Distribution: SLES, SLED, OpenSuse, CentOS, ubuntu 10.10, OpenBSD, FreeBSD
Posts: 195

Rep: Reputation: 37
Probably a bad idea

Well it would be easy enough to write a script called by cron to monitor the network using a tool like dhcp_probe or RougeDetect, and that script could of course start and stop your dhcp server.

The problem is that the new dhcp server will not know about current leases.

For example, you plug in your box, it finds no DHCP Server and so it starts up dhcpd and starts serving up IP addresses. What if there are currently leased IPs on the network, your DHCP server will not be aware of them and could re-allocate them, causing duplicate IPs on the network.

The same is true if another device comes on-line after yours and starts serving DHCP, your DHCP server could have allocated say Another DHCP Server starts up, which shuts your DHCP server down, and then a new request comes in it serves, now you have two computers with the same IP address on the same network. NOT GOOD!

If you are trying to provide redundancy you will need a DHCP server that can share information about DHCP allocations use DHCPD as part of a cluster, OR you will need to set up non overlapping IP Ranges (probably within the same subnet) to keep things going. This too of course will have some potential issues such as making sure the Gateway address, Subnet . . . are correct on both servers, and it will cause lease renewals to fail and a subsequent change in IP on a client device.

You may want to take a look at clustering your DHCP Server, so if one server goes down it will fail over to the remaining node(s) in the cluster, maintaining current lease info . . .

If I have missed the reason for wanting to do this, perhaps a more detailed explanation of what you want to accomplish and the reasoning behind it would be useful. I know Windows server with AD can do this as can Novell servers through e-directory, but just plain linux dhcpd doesn't leave the needed bread crumbs to make it seamless.

Hope this is helpful.

Last edited by never say never; 04-01-2010 at 10:31 AM.
1 members found this post helpful.
Old 04-02-2010, 08:14 AM   #3
LQ Newbie
Registered: Oct 2008
Location: Manchester - UK
Distribution: Debian (Lenny)
Posts: 18

Original Poster
Rep: Reputation: 0
Thanks for the in-depth reply

The main reason for the question was the 'debian box [with dhcpd running] on to an existing LAN with an existing DHCP server' scenario.

I think I must have over-complicated the original question . My fault.

The idea is that if I have dhcpd running - it turns itself off if it finds an existing dhcp server somewhere on the same subnet.

The rest was just fluff.

I'll have a look at DHCP_PROBE now.



client, debian, dhcp, etch, networking, server

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto detect proxy ilnli Linux - General 4 03-10-2006 12:44 AM
how to auto detect the service of sendmail server using heartbeat dhanju Linux - Networking 1 10-24-2005 05:05 AM
how linux auto detect thumbdrive cperdana Linux - Hardware 2 03-03-2005 08:34 PM
auto detect disconnect / connect vb7prog Linux - Networking 1 11-18-2004 03:26 AM
X Windows Auto-detect Brother Michael Debian 3 05-13-2004 11:53 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration