{"id":3664,"date":"2016-04-13T21:48:17","date_gmt":"2016-04-13T19:48:17","guid":{"rendered":"http:\/\/michlstechblog.info\/blog\/?p=3664"},"modified":"2016-04-14T12:49:09","modified_gmt":"2016-04-14T10:49:09","slug":"dhcp-dhtest-a-tool-to-send-customized-packets-to-a-dhcp-server","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/dhcp-dhtest-a-tool-to-send-customized-packets-to-a-dhcp-server\/","title":{"rendered":"DHCP: dhtest a tool to send customized packets to a DHCP Server"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_3664 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_3664')){$('.twoclick_social_bookmarks_post_3664').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"DHCP%3A%20dhtest%20a%20tool%20to%20send%20customized%20packets%20to%20a%20DHCP%20Server\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0Adhtest%20is%20a%20tool%20to%20generate%20DHCP%20packets%20and%20send%20it%20to%20a%20DHCP%20server.%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/dhcp-dhtest-a-tool-to-send-customized-packets-to-a-dhcp-server\\\/\",\"post_id\":3664,\"post_title_referrer_track\":\"DHCP%3A+dhtest+a+tool+to+send+customized+packets+to+a+DHCP+Server\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>dhtest is a tool to generate DHCP packets and send it to a DHCP server.<br \/>\n<!--more--><br \/>\nA (not complete list) what dhtest can do:<\/p>\n<ul>\n<li>Query send a DHCP request by using a MAC other then the Interface of the host<\/li>\n<li>Send DHCP release packets for specific MAC to the DHCP Server<\/li>\n<li>Set various DHCP options<\/li>\n<li>&#8230;<\/li>\n<\/ul>\n<p>But use it with care! Your Network administrator may not be amused \ud83d\ude42 . 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.<\/p>\n<p>dhtest has its home at<a title=\"dhtest at github\" href=\"https:\/\/github.com\/saravana815\/dhtest\" target=\"_blank\"> github<\/a>.<\/p>\n<p>Installation is easy. Here the way on Debian Linux.<br \/>\nPrepare your build environment.<br \/>\n<code><br \/>\napt-get update &amp;&amp; apt-get -y install build-essential git<br \/>\n<\/code><br \/>\nClone the repository dhtest git repository<br \/>\n<code><br \/>\ncd ~<br \/>\ngit clone https:\/\/github.com\/saravana815\/dhtest<br \/>\n<\/code><br \/>\nCompile<br \/>\n<code><br \/>\nmake<br \/>\n<\/code><br \/>\nAnd test it<\/p>\n<pre><code>\r\nroot@debdev:~\/software\/dhtest# .\/dhtest -?\r\nUsage: .\/dhtest [ options ]\r\n  -m mac_address\r\n  -r, --release                         # Releases obtained DHCP IP for corresponding MAC\r\n  -L, --option51-lease_time [ Lease_time ] # Option 51. Requested lease time in secondes\r\n  -I, --option50-ip     [ IP_address ]  # Option 50 IP address on DHCP discover\r\n  -o, --option60-vci    [ VCI_string ]  # Vendor Class Idendifier string\r\n  -h, --option12-hostname [ hostname_string ] # Client hostname string\r\n<\/code><\/pre>\n<p>Example: This command sends a DHCP release for named MAC to DHCP Server 192.168.56.100<br \/>\n<code><br \/>\n.\/dhtest -m 08:00:27:8e:a9:a9 --release -S 192.168.56.100<br \/>\n<\/code>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).<br \/>\n<code><br \/>\n<strong>tcpdump -vni eth0 port 67<\/strong><br \/>\ntcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes<br \/>\n12: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<\/p>\n<p>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<\/p>\n<p>12:31:28.473457 IP 192.168.56.100.67 > 255.255.255.255.68: BOOTP\/DHCP, Reply, length 548<br \/>\n<\/code><br \/>\n&nbsp;<br \/>\nNote: Some parameter (changing MAC) requieres root permissions because dhtest uses raw sockets.<br \/>\nMichael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, dhtest is a tool to generate DHCP packets and send it to a DHCP server.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[715,832,651,224,833,831],"class_list":["post-3664","post","type-post","status-publish","format-standard","hentry","category-linux","tag-dhcp","tag-fake","tag-generate","tag-linux-2","tag-packets","tag-troubleshooting"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/3664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=3664"}],"version-history":[{"count":9,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/3664\/revisions"}],"predecessor-version":[{"id":3673,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/3664\/revisions\/3673"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=3664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=3664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=3664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}