{"id":402,"date":"2015-12-03T16:33:55","date_gmt":"2015-12-03T16:33:55","guid":{"rendered":"http:\/\/www.flat-planet.net\/?p=402"},"modified":"2015-12-03T16:33:55","modified_gmt":"2015-12-03T16:33:55","slug":"supporting-multiple-subnets-from-a-single-dhcp-server","status":"publish","type":"post","link":"https:\/\/flat-planet.net\/?p=402","title":{"rendered":"Supporting Multiple Subnets from a single DHCP Server"},"content":{"rendered":"<p>This took a bit of google work to piece together how it works, so just posting it here so others can benefit. The basic scenario is as follows:<\/p>\n<ol>\n<li>I have a number of subnets that I need to assign addresses to<\/li>\n<li>I have a single server with only one interface and it lives on my management network<\/li>\n<\/ol>\n<p><a href=\"https:\/\/www.flat-planet.net\/wp-content\/uploads\/2015\/12\/Screen-Shot-2015-12-03-at-16.20.19.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-403\" src=\"https:\/\/www.flat-planet.net\/wp-content\/uploads\/2015\/12\/Screen-Shot-2015-12-03-at-16.20.19.png\" alt=\"DHCP Relay Setup\" width=\"681\" height=\"364\" \/><\/a>Since the server isn&#8217;t on each of the subnets I&#8217;m going to make user of the UDP Helper functionality built into most routers\/L3 switches today. If a DHCP client outside the DHCP server&#8217;s subnet broadcasts an address request, it is the helper that forwards the message to the DHCP server. The server then chooses an address and sends the client a unicast message, using the helper to send the message back to the client&#8217;s subnet.<\/p>\n<p>The address is reserved for a limited time while the DHCP server waits for a response. If the client responds with another broadcast message, the DHCP server distributes the address.<\/p>\n<h2>Router config<\/h2>\n<p>This is incredibly simple. On each SVI, simply add the ip helper-address:<\/p>\n<pre>interface vlan 10\r\nip address 10.0.10.1\/24\r\nip helper-address 10.10.10.200\r\ninterface vlan 20\r\nip address 10.0.20.1\/24\r\nip helper-address 10.10.10.200\r\ninterface vlan 30\r\nip address 10.0.30.1\/24\r\nip helper-address 10.10.10.200<\/pre>\n<p>Of course, your router should be able to reach the helper address.<\/p>\n<h2>DHCP Server Config<\/h2>\n<p>This was actually the harder part to hunt down. Basically we just define our subnets without using the &#8220;shared-network&#8221; statement<\/p>\n<pre>authoritative;\r\n\r\n# this is the most important line. It specifies the method\r\n# to use to connect to the DNS server and update it.\r\nddns-update-style none;\r\nddns-domainname \"example.com\";\r\nignore client-updates;\r\n\r\n\r\noption domain-name              \"example.com\";\r\noption domain-name-servers      8.8.8.8,8.8.4.4;\r\noption time-offset              0;\r\noption ntp-servers              10.10.10.200;\r\none-lease-per-client off;\r\ndefault-lease-time 86400;\r\nmax-lease-time 604800;\r\noption ip-forwarding off;\r\n\r\n\r\n# Subnet for internal hosts\r\n    subnet 10.0.10.0 netmask 255.255.255.0 {\r\n        range 10.0.10.2 10.0.10.254;\r\n        option routers                  10.0.10.1;\r\n        option subnet-mask              255.255.255.0;\r\n    }\r\n\r\nsubnet 10.0.20.0 netmask 255.255.255.0 {\r\n        range 10.0.20.2 10.0.20.254;\r\n        option routers                  10.0.20.1;\r\n        option subnet-mask              255.255.255.0;\r\n    }\r\nsubnet 10.0.30.0 netmask 255.255.255.0 {\r\n        range 10.0.30.2 10.0.30.254;\r\n        option routers                  10.0.30.1;\r\n        option subnet-mask              255.255.255.0;\r\n    }<\/pre>\n<p>The server will select the correct subnet, based on the GIADDR (Gateway IP Address) contained in the request e.g. the DHCP Request reaching the server from vlan10 will have GIADDR = 10.0.10.1<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This took a bit of google work to piece together how it works, so just posting it here so others can benefit. The basic scenario is as follows: I have a number of subnets that I need to assign addresses to I have a single server with only one interface and it lives on my [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[95,38],"tags":[42,115,232,233,234,235,236,40],"series":[],"class_list":["post-402","post","type-post","status-publish","format-standard","hentry","category-data-networking","category-linux","tag-linux-2","tag-config","tag-dhcp","tag-dhcp-relay","tag-udp-helper","tag-subnets","tag-address-management","tag-networking"],"_links":{"self":[{"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/posts\/402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=402"}],"version-history":[{"count":1,"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/posts\/402\/revisions"}],"predecessor-version":[{"id":404,"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/posts\/402\/revisions\/404"}],"wp:attachment":[{"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=402"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}