{"id":2681,"date":"2019-10-04T05:29:23","date_gmt":"2019-10-04T05:29:23","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=2681"},"modified":"2019-10-04T05:30:29","modified_gmt":"2019-10-04T05:30:29","slug":"setup-dhcp-server-on-linux","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/setup-dhcp-server-on-linux\/","title":{"rendered":"Setup DHCP server on Linux"},"content":{"rendered":"\n<p>Install dhcp server software<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install isc-dhcp-server<\/pre>\n\n\n\n<p>Edit the following config file and set the networking interface it should use.  In this case enp60s0<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo vi \/etc\/default\/isc-dhcp-server<\/pre>\n\n\n\n<p>Example line to change<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">INTERFACESv4=\"enp60s0\"<\/pre>\n\n\n\n<p>Now edit the dhcpd.con file <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo vi \/etc\/dhcp\/dhcpd.conf <\/pre>\n\n\n\n<p>Add the following in.  Change the addresses and settings as needed.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">subnet 192.168.47.0 netmask 255.255.255.0 {\n   range 192.168.47.26 192.168.47.30;\n   option domain-name-servers ns1.internal.example.org;\n   option domain-name \"internal.example.org\";\n   option subnet-mask 255.255.255.0;\n   option routers 192.168.47.1;\n   option broadcast-address 192.168.47.255;\n   default-lease-time 600;\n   max-lease-time 7200;\n }<\/pre>\n\n\n\n<p>Set a static ip on the computer that&#8217;ll be acting as the dhcp server.  You can set it as the gateway if it is the gateway.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Allow dhcp through the firewall <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw allow  67\/udp\nsudo ufw reload<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Restart the service and connect a client.<\/pre>\n\n\n\n<p>sudo systemctl restart isc-dhcp-server<\/p>\n\n\n\n<p><a href=\"https:\/\/www.tecmint.com\/install-dhcp-server-in-ubuntu-debian\/\">More info. <\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>You can look at dhcp leases with the following command<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tail -f \/var\/lib\/dhcp\/dhcpd.leases<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Install dhcp server software sudo apt install isc-dhcp-server Edit the following config file and set the networking interface it should use. In this case enp60s0 sudo vi \/etc\/default\/isc-dhcp-server Example line to change INTERFACESv4=&#8221;enp60s0&#8243; Now edit the dhcpd.con file sudo vi &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/setup-dhcp-server-on-linux\/\">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":[3,669],"tags":[745,744,619,7],"class_list":["post-2681","post","type-post","status-publish","format-standard","hentry","category-linux","category-networking-3","tag-addresses","tag-dhcp","tag-ip","tag-linux-2"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2681","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=2681"}],"version-history":[{"count":2,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2681\/revisions"}],"predecessor-version":[{"id":2687,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2681\/revisions\/2687"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=2681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=2681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=2681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}