{"id":2869,"date":"2019-12-25T04:54:08","date_gmt":"2019-12-25T04:54:08","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=2869"},"modified":"2019-12-25T05:12:56","modified_gmt":"2019-12-25T05:12:56","slug":"ubiquiti-renewing-dhcp-client-lease-from-command-line","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/ubiquiti-renewing-dhcp-client-lease-from-command-line\/","title":{"rendered":"Ubiquiti &#8211; Renewing DHCP client lease from command line"},"content":{"rendered":"\n<p>AirOS uses udhcpc for the DHCP client on Ubiquiti Radios.  To renew the DHCP address you can kill the udhcpc process and it&#8217;ll automatically restart and get a new address.<\/p>\n\n\n\n<p><strong>Renew DHCP lease<\/strong><\/p>\n\n\n\n<p>Kill udhcpc with the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">killall udhcpc<\/pre>\n\n\n\n<p><strong>Other info<\/strong><\/p>\n\n\n\n<p>Print info about the DHCP lease.  May need to change &#8220;info.br1&#8221; to &#8220;info.eth0&#8221; or some other interface.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cat \/etc\/udhcpc\/info.eth0 <\/pre>\n\n\n\n<p>Example output.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">XW.v6.2.0# cat \/etc\/udhcpc\/info.br1 \nu_interface=\"br1\"\nu_broadcast=\"\"\nu_subnet=\"255.255.255.0\"\nu_ip=\"10.93.0.10\"\nu_router=\"10.93.0.1\"\nu_dns=\"8.8.8.8 1.1.1.1\"\nu_hostname=\"\"\nu_serverid=\"10.93.0.1\"\nu_domain=\"\"\nu_leasetime=600\nu_timestamp=\"1143249941\"\nu_started=1142593\nu_pid=936\nXW.v6.2.0# <\/pre>\n\n\n\n<p>Command arguments that udhcp is run with.  Info was collected by running the &#8220;ps | grep udhcp&#8221; command.  Note that the interface &#8220;eth0&#8221; can be different if the device is in bridge mode.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/sbin\/udhcpc -f -i eth0 -s \/etc\/udhcpc\/udhcpc -p \/var\/run\/udhcpc.eth0.pid -h device_name<\/pre>\n\n\n\n<p>udhcpc help output<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">XW.v6.2.0# udhcpc --help\nBusyBox v1.24.2 (2019-07-03 11:13:35 EEST) multi-call binary.\n\nUsage: udhcpc &#91;-fbqvRB] &#91;-t N] &#91;-T SEC] &#91;-A SEC\/-n]\n        &#91;-i IFACE] &#91;-s PROG] &#91;-p PIDFILE]\n        &#91;-oC] &#91;-r IP] &#91;-V VENDOR] &#91;-F NAME] &#91;-x OPT:VAL]... &#91;-O OPT]...\n\n        -i,--interface IFACE    Interface to use (default eth0)\n        -s,--script PROG        Run PROG at DHCP events (default \/usr\/share\/udhcpc\/default.script)\n        -p,--pidfile FILE       Create pidfile\n        -B,--broadcast          Request broadcast replies\n        -t,--retries N          Send up to N discover packets (default 3)\n        -T,--timeout SEC        Pause between packets (default 3)\n        -A,--tryagain SEC       Wait if lease is not obtained (default 20)\n        -n,--now                Exit if lease is not obtained\n        -q,--quit               Exit after obtaining lease\n        -R,--release            Release IP on exit\n        -f,--foreground         Run in foreground\n        -b,--background         Background if lease is not obtained\n        -S,--syslog             Log to syslog too\n        -r,--request IP         Request this IP address\n        -o,--no-default-options Don't request any options (unless -O is given)\n        -O,--request-option OPT Request option OPT from server (cumulative)\n        -x OPT:VAL              Include option OPT in sent packets (cumulative)\n                                Examples of string, numeric, and hex byte opts:\n                                -x hostname:bbox - option 12\n                                -x lease:3600 - option 51 (lease time)\n                                -x 0x3d:0100BEEFC0FFEE - option 61 (client id)\n        -F,--fqdn NAME          Ask server to update DNS mapping for NAME\n        -V,--vendorclass VENDOR Vendor identifier (default 'udhcp VERSION')\n        -C,--clientid-none      Don't send MAC as client identifier\n        -v                      Verbose\nSignals:\n        USR1    Renew lease\n        USR2    Release lease\nXW.v6.2.0# <\/pre>\n\n\n\n<div class=\"wp-block-group is-layout-flow wp-block-group-is-layout-flow\"><div class=\"wp-block-group__inner-container\"><\/div><\/div>\n\n\n\n<p>Note that you can also send a signal to the PID of udhcpc and have it renew the address.  To do that use the following command, replacing pidofudhcpc to pid of udhcp.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">kill -s USR1 pidofudhcpc<\/pre>\n\n\n\n<p>or use the following command to find the pid for you.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">kill -s SIGUSR1 $(pgrep udhcpc)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>AirOS uses udhcpc for the DHCP client on Ubiquiti Radios. To renew the DHCP address you can kill the udhcpc process and it&#8217;ll automatically restart and get a new address. Renew DHCP lease Kill udhcpc with the following command. killall &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/ubiquiti-renewing-dhcp-client-lease-from-command-line\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[129],"tags":[642,744,131,132],"class_list":["post-2869","post","type-post","status-publish","format-standard","hentry","category-ubiquiti","tag-airos","tag-dhcp","tag-ubiquiti-2","tag-ubnt"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=2869"}],"version-history":[{"count":7,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2869\/revisions"}],"predecessor-version":[{"id":2902,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2869\/revisions\/2902"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=2869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=2869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=2869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}