{"id":2926,"date":"2020-01-08T18:14:45","date_gmt":"2020-01-08T18:14:45","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=2926"},"modified":"2020-01-08T18:21:38","modified_gmt":"2020-01-08T18:21:38","slug":"unifi-cameras-changing-from-static-ip-to-dhcp-from-command-line","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/unifi-cameras-changing-from-static-ip-to-dhcp-from-command-line\/","title":{"rendered":"UniFi Cameras &#8211; configure static IP or DHCP from command line"},"content":{"rendered":"\n<p>The UniFi cameras are different then the AirMax line in how the configuration works.  There is a &#8220;\/tmp\/system.cfg&#8221; file, but it does not contain most of the configuration option.  In the default directory there are some files which appear to handle the device configuration.  <\/p>\n\n\n\n<p>The network configuration file is  &#8220;ubnt_networkd.conf&#8221;<\/p>\n\n\n\n<p>Edit the file by opening it up in vi or a different text editor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Static IP config<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n     \"cfgver\": 2,\n     \"dhcp\": {\n         \"fallbackIP\": \"192.168.1.20\",\n         \"fallbackNetmask\": \"255.255.255.0\",\n         \"status\": 0  <strong>&lt;-- 0=Static 1=DHCP<\/strong>\n     },\n     \"dns\": {\n         \"ns1\": {\n             \"ip\": \"8.8.8.8\",\n             \"status\": 1\n         },\n         \"ns2\": {\n             \"ip\": \"4.2.2.2\",\n             \"status\": 1\n         }\n     },\n     \"routes\": {\n         \"gateway\": \"192.168.5.1\"\n     },\n     \"statik\": {\n         \"ip\": \"192.168.5.11\",\n         \"netmask\": \"255.255.255.0\"\n     }\n}<\/pre>\n\n\n\n<p>If you want to set the static address, you should be able to edit the settings in this config and leave DHCP status disabled.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DHCP config<\/h2>\n\n\n\n<p>To set the Camera to use DHCP, under dhcp change &#8220;&#8221;status&#8221;: 0&#8243; to  &#8220;&#8221;status&#8221;: 1&#8243;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n     \"cfgver\": 2,\n     \"dhcp\": {\n         \"fallbackIP\": \"192.168.1.20\",\n         \"fallbackNetmask\": \"255.255.255.0\",\n         \"status\": 1\n     },\n     \"dns\": {\n         \"ns1\": {\n             \"ip\": \"8.8.8.8\",\n             \"status\": 1\n         },\n         \"ns2\": {\n             \"ip\": \"4.2.2.2\",\n             \"status\": 1\n         }\n     },\n     \"routes\": {\n         \"gateway\": \"192.168.5.1\"\n     },\n     \"statik\": {\n         \"ip\": \"192.168.5.11\",\n         \"netmask\": \"255.255.255.0\"\n     }\n}<\/pre>\n\n\n\n<p>After the settings are applied the camera will use use DHCP regardless of the statik ip settings.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Save changes<\/h2>\n\n\n\n<p>Use the following command to write the changes to persistent storage<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ubnt_cmd_persist.sh<\/pre>\n\n\n\n<p>And reboot the camera.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">reboot<\/pre>\n\n\n\n<p>Camera should pull a DHCP address when it boots up<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The UniFi cameras are different then the AirMax line in how the configuration works. There is a &#8220;\/tmp\/system.cfg&#8221; file, but it does not contain most of the configuration option. In the default directory there are some files which appear to &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/unifi-cameras-changing-from-static-ip-to-dhcp-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,370],"tags":[193,744,695,693,50,132,188,856],"class_list":["post-2926","post","type-post","status-publish","format-standard","hentry","category-ubiquiti","category-unifi-video","tag-camera","tag-dhcp","tag-networkd","tag-static","tag-static-ip","tag-ubnt","tag-unifi","tag-unifi-camera"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2926","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=2926"}],"version-history":[{"count":2,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2926\/revisions"}],"predecessor-version":[{"id":2928,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2926\/revisions\/2928"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=2926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=2926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=2926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}