CREATING DHCP DISCOVER PACKET

Alex Bligh alex at alex.org.uk
Wed Mar 9 07:19:01 UTC 2011



--On 8 March 2011 22:43:20 -0500 Homer Wilson Smith <homer at lightlink.com> 
wrote:

> The problem is that some student routers only respond to DISCOVER
> requests with 0.0.0.0 as the from IP.  The perl script below sends
> the packet with the IP of the sending linux server, and is thus
> ignored by some student routers, making it harder to track them down.
>
>     Is there an easy change to the script below to fix this problem?

I suspect you will need to use something like Net::RawIP. I think
IO::Socket::INET always uses the OS to assemble the UDP packets,
in which case you will never get a 0.0.0.0 source address.

In C, I use libpcap for this sort of thing as it has a little known
feature (pcap_sendpacket) where it can send raw packets, as well as
doing tcpdump packet filtering on receipt. Net::pcap supports
this with the sendpacket method (I haven't tested it). You
may find this is the easiest way to do it, particularly as your
next problem is going to be how to filter responses (the OS won't
help unless you have a real socket).

Note you'll have to construct your own IP packets etc either way.

-- 
Alex Bligh



More information about the dhcp-users mailing list