DHCP: dhtest a tool to send customized packets to a DHCP Server

Hi,

dhtest is a tool to generate DHCP packets and send it to a DHCP server.

A (not complete list) what dhtest can do:

  • Query send a DHCP request by using a MAC other then the Interface of the host
  • Send DHCP release packets for specific MAC to the DHCP Server
  • Set various DHCP options

But use it with care! Your Network administrator may not be amused 🙂 . When you alter the MAC, the switch to which you are connected sees both MAC Addresses. In many enterprise environment only one MAC per Switchport is allowed. Also you kickout the Machine with the given MAC.

dhtest has its home at github.

Installation is easy. Here the way on Debian Linux.
Prepare your build environment.

apt-get update && apt-get -y install build-essential git

Clone the repository dhtest git repository

cd ~
git clone https://github.com/saravana815/dhtest

Compile

make

And test it


root@debdev:~/software/dhtest# ./dhtest -?
Usage: ./dhtest [ options ]
  -m mac_address
  -r, --release                         # Releases obtained DHCP IP for corresponding MAC
  -L, --option51-lease_time [ Lease_time ] # Option 51. Requested lease time in secondes
  -I, --option50-ip     [ IP_address ]  # Option 50 IP address on DHCP discover
  -o, --option60-vci    [ VCI_string ]  # Vendor Class Idendifier string
  -h, --option12-hostname [ hostname_string ] # Client hostname string

Example: This command sends a DHCP release for named MAC to DHCP Server 192.168.56.100

./dhtest -m 08:00:27:8e:a9:a9 --release -S 192.168.56.100
You can also attach tcpdump to the interface in a second shell to see whats happen on the wire (The release is encapsulated in the Request).

tcpdump -vni eth0 port 67
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
12:31:01.972831 IP 255.255.255.255.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 08:00:27:8e:a9:a9, length 250

12:31:28.472611 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 08:00:27:8e:a9:a9, length 300

12:31:28.473457 IP 192.168.56.100.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 548

 
Note: Some parameter (changing MAC) requieres root permissions because dhtest uses raw sockets.
Michael

Advertisment to support michlstechblog.info

Time limit is exhausted. Please reload CAPTCHA.

Original Theme by Schiy · Powered by WordPress