Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check how many DHCP servers in lan segment?

Status
Not open for further replies.

zaccaz

MIS
Aug 10, 2005
270
HK
hi there, is there any tools (freeware preferred, win32 preferred but linux also ok) to check how many DHCP servers in a particular lan segment, & their corresponding ipaddr?

many thx!
 
I'd personally just sniff the network, you can then filter by DHCP requests and responses. Look at ethereal etc for windows or tcpdump in *nix.

"We can categorically state that we have not released man-eating badgers into the area" - Major Mike Shearer
 
You can query AD. This code sniffs ALL DHCP servers in AD and parses the output. From there, you can visually identify those DHCP server on a particular network segment.

'DHCPsniff.vbs
'Daniel M. Jones
'August 27, 2009

strDomainName = "dc=my,dc=domain,dc=com" ' my.domain.com
strFileName = "c:\result.txt"

set objCont = GetObject("LDAP://CN=DhcpRoot,CN=NetServices,CN=Services,CN=Configuration," & strDomainName)
set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile(strFileName, 2, true)
set objShell = WScript.CreateObject("WScript.Shell")

colDHCPServers = objCont.GetEx("dhcpServers")

for each strDHCPServer in colDHCPServers
strIP = mid(strDHCPServer, 2, inStr(strDHCPServer, "$") - 2)
strServerName = right(strDHCPServer, len(strDHCPServer) - inStr(strDHCPServer, "="))
strServerName = left(strServerName, inStr(strServerName, ".") - 1)
objFile.Write strServerName & ": " & strIP & vbNewLine
next

objFile.Close
objShell.Run(strFileName)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top