Package: dora-dhcp-client
DORA The DHCP ClientVersion 0.1.3A Python command line DHCP client that was designed for troubleshooting. Provides an interface for sending tailored DHCP packets to a DHCP server and inspect the response.InstallationPythonRun directly with Python3.8, install using pip:pip install dora-dhcp-clientAlternate InstallationAlternately install and run as a Docker image.sudocurl-L--failhttps://raw.githubusercontent.com/vfrazao-ns1/dora_dhcp_client/master/run.sh-o/usr/local/bin/dora
sudochmod+x/usr/local/bin/doraRequirementsPython 3.8.0 or higherDocker (Optional)NOTE: This has been tested on Ubuntu 18.04 and Windows WSL. May or may not work on other platforms.Basic UsageCheck if port 68 (and port 67 if relay field is set) is currently bound to by another program (for example with:sudo netstat -tulpn). If there is anything bound to these ports they must first be killed, and prevented from restarting.Rundora.pywith a-h/--helpflag to see all the available options:$sudodora.py-h
usage:dora.py[-h][-iINTERFACE][-aMAC_ADDR][-d][-u][-sSERVER][-rRELAY][-v][-oOPTIONS][-pPORT][--target_portTARGET_PORT][-@TARGET]optionalarguments:-h,--helpshowthishelpmessageandexit-iINTERFACE,--interfaceINTERFACEInterfacetobindtoandmakeDHCPrequests-aMAC_ADDR,--mac_addrMAC_ADDRMACaddresstouse(defaultrandom)-d,--debugPrintdebugstatements-u,--unicastSendDHCPpacketsoverunicasttospecifiedserver-sSERVER,--serverSERVERServertosendDHCPpackets.Requiredforunicastandforrelayuse.-rRELAY,--relayRELAYAddresstosetthegiaddrfieldto-v,--verboseVerbositylevel(v:showackpacket,vv:showallpackets,vvv:showdebug)-oOPTIONS,--optionsOPTIONSJSONbodyofoptionstoincludeinrequests-pPORT,--portPORTPorttosendpacketsfromonclientmachine--target_portTARGET_PORTPorttosendtoontargetmachine-@TARGETGivenanIPaddressofaDHCPserver,sendsunicastrequestsNOTE: dora.py must be able to bind to port 68 (and 67 under certain circumstances) in order to function properly. This may require the use ofsudo. This may also require stopping any services (e.g., systemd-networkd) that are already bound to those ports.Runningdora.pywithout supplying any options just binds to an arbitrary interface and sends out broadcast UDP packets.-iallows selection of the interface to bind to (e.g., "eth0")-aallows the MAC address to be set in both the client identifier option and the chaddr field-dPrints very low level debug statements and includes any Python tracebacks-usets the unicast flag in the DHCP packet-sspecifies an unicast address to send the packets to, the-uflagshouldbe selected but doesnt need to be-rsets the giaddr field of the packet-vsets the verbosity level of the output. Novflags means that the client will just report success or failure to obtain a lease. A singlevflag (-v) will pretty print  a human readable form of the DHCPACK packet. This will show the set of options that the DHCP server has sent us back. Twovflags (-vv) will pretty print the all four packets in the lease handshake (DHCPDISCOVER, DHCPOFFER, DHCPREQUEST, DHCPACK). Threevflags will print everything stated before and it will enable the debug output (same as setting the-dflag).-psets the client port (default: 68)--target_portsets the server port (default: 67)-@is a convenience flag that sets the unicast flag, sets the giaddr field to the IP of the current machine, and sends unicast packets to the server specifiedNOTE the DHCP RFC 2131 sets the client port to 68 and the server port to 67 options that set different client or server ports are not expected to work with an RFC compliant server