{"id":1,"date":"2023-12-06T00:52:05","date_gmt":"2023-12-05T16:52:05","guid":{"rendered":"http:\/\/www.ozogen.cn\/?p=1"},"modified":"2023-12-09T23:24:45","modified_gmt":"2023-12-09T15:24:45","slug":"home-network-1-dhcp-options","status":"publish","type":"post","link":"https:\/\/www.ozogen.cn\/index.php\/2023\/12\/06\/home-network-1-dhcp-options\/","title":{"rendered":"EdgeRouter \u5b9e\u73b0 \u5206\u5ba2\u6237\u7aef DHCP Options"},"content":{"rendered":"\n<p>\u4e4b\u524d\u4e00\u76f4\u5728\u4f7f\u7528\u4e00\u53f0 Edgerouter-X-SFP + PON Stick \u505a\u4e3b\u8def\u7531\uff0c\u4f46\u53c8\u56e0\u4e3a\u65e0\u6cd5\u653e\u5f03 ROS \u7684 DHCP \u670d\u52a1\u5668\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u7ed9\u5404\u4e2a\u5ba2\u6237\u7aef\u5206\u914d DHCP Options \u4ee5\u7528\u6765\u65e0\u611f\u5207\u6362DNS\u548c\u7f51\u5173\u800c\u4f7f\u7528\u4e86\u4e00\u53f0 Mikrotik RB760iGS \u505a DHCP \u670d\u52a1\u5668\u3002<\/p>\n\n\n\n<p>\u5728\u8fc7\u53bb\u7684\u4e00\u4e2a\u708e\u70ed\u7684\u590f\u5929\u91cc\u653e\u5728\u50a8\u85cf\u95f4\u7684\u8def\u7531\u591a\u6b21\u51fa\u73b0\u4e86\u5f53\u673a\u7684\u60c5\u51b5\uff0c\u4e8e\u662f\u67d0\u9c7c\u4e0a\u6dd8\u4e86\u81ea\u5e26\u98ce\u6247\u7684 EdgerouterPro\u6362\u4e0a\uff0c\u53c8\u6b63\u597d\u80fd\u4e0a\u673a\u67dc\uff0c\u4e5f\u5c31\u60f3\u628a\u4ee5\u524d\u4e24\u4e2a\u8bbe\u5907\u7684\u529f\u80fd\u96c6\u6210\u4e00\u4e0b\u3002<\/p>\n\n\n\n<p>\u6252\u4e86\u4e00\u5708\u53d1\u73b0\u4e2d\u6587\u4e92\u8054\u7f51\u4e0a\u4f3c\u4e4e\u6ca1\u6709\u76f8\u5173\u7684\u8d44\u6599\uff0c\u90a3\u5c31\u53ea\u597d\u9760\u81ea\u5df1\u5566\u3002<\/p>\n\n\n\n<p>\u4e0d\u67e5\u4e0d\u77e5\u9053\uff0cEdgeOS \u81ea\u5e26\u7684 DHCP \u670d\u52a1\u5668\u8fd8\u633a\u590d\u6742\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528 ISC DHCPD\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u5207\u6362\u4e3a\u4f7f\u7528Dnsmasq \u7ba1\u7406 DHCP \u670d\u52a1\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u501f\u7528 Dnsmasq \u7684\u529f\u80fd\u6765\u5b9e\u73b0\u5206\u5ba2\u6237\u7aef DHCP Options \u4e86\u3002<\/p>\n\n\n\n<p>\u5728\u6b64\u5047\u8bbe\u6240\u6709\u4e4b\u524dconfig-tree\u7684service &#8211; dhcp-server \u90e8\u5206\u5747\u5df2\u6e05\u7a7a\u3002<\/p>\n\n\n\n<p>\u9996\u5148 SSH \u767b\u5165Edgerouter \u7684 CLI\uff0c\u7136\u540e<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>configure&nbsp;<\/p>\n<\/blockquote>\n\n\n\n<p>\u8fdb\u5165\u914d\u7f6e\u6a21\u5f0f<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>set service dhcp-server use-dnsmasq enable<\/p>\n<\/blockquote>\n\n\n\n<p>\u5207\u6362\u5230\u4f7f\u7528 Dnsmasq \u7ba1\u7406 DHCP \u670d\u52a1<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>set service dhcp-server shared-network-name Home subnet 192.168.88.0\/24&nbsp;start 192.168.88.150 stop 192.168.88.240<\/p>\n<\/blockquote>\n\n\n\n<p>\u521b\u5efa\u540d\u4e3a Home\uff0c\u7f51\u6bb5\u4e3a 192.168.88.0\/24 \u7684 DHCP \u670d\u52a1\uff0c\u5e76\u5c06\u5206\u914d\u5730\u5740\u6c60\u8bbe\u4e3a 192.168.88.150-192.168.88.240<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>commit ; save<\/p>\n<\/blockquote>\n\n\n\n<p>\u63d0\u4ea4\u5e76\u4fdd\u5b58<\/p>\n\n\n\n<p>\u6b64\u65f6\u5c31\u53ef\u4ee5\u770b\u5230\u5df2\u7ecf\u6709\u4e00\u4e2a\u540d\u4e3a Home \u7684 DHCP \u670d\u52a1\u8dd1\u8d77\u6765\u4e86\u3002<\/p>\n\n\n\n<p>EdgeOS \u672c\u8eab\u4f7f\u7528 Dnsmasq \u6765\u5904\u7406 DNS \u8f6c\u53d1\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u4f7f\u7528 Dnsmasq \u7ba1\u7406\u5e76\u5206\u5ba2\u6237\u7aef\u8d4b\u4e88 DHCP Options\uff0c\u5728 config-tree \u4e2d\u5c31\u9700\u8981\u5728 service &#8211; dns &#8211; forwarding \u4e2d\u8bbe\u7f6e Dnsmasq \u7684 Options\u3002\u4ee5\u4e0b\u4ec5\u5c55\u793a\u7528DHCP Options \u5b9a\u4e49 DNS \u548c Gateway \u7684\u8bbe\u7f6e\uff0c\u5982\u679c\u9700\u8981\u5b9a\u4e49\u5176\u4ed6 Options \u53ef\u4ee5\u53c2\u8003<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/imp\/dnsmasq\/blob\/master\/dnsmasq.conf.example\">https:\/\/github.com\/imp\/dnsmasq\/blob\/master\/dnsmasq.conf.example<\/a>\uff0c\u5177\u4f53\u7684 Options \u540d\u79f0\u53ef\u4ee5\u5207\u6362\u5230 root\u7528\u6237\u540e\u8fd0\u884c&nbsp;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>dnsmasq &#8211;help dhcp<\/p>\n<\/blockquote>\n\n\n\n<p>\u6765\u67e5\u770b\u3002<\/p>\n\n\n\n<p>\u6b64\u5904\u5047\u5b9a\u9700\u8981\u5b9a\u4e49\u7684 DNS \u548c Gateway \u5730\u5740\u90fd\u662f 192.168.88.2<\/p>\n\n\n\n<p>\u9996\u5148\u9700\u8981\u5b9a\u4e49\u9644\u52a0\u7684 Options<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>set service dns forwarding options&nbsp;dhcp-option=tag:abroad,option:router,192.168.88.2<\/p>\n<\/blockquote>\n\n\n\n<p>\u5b9a\u4e49 Option3 \u7684 Gateway\uff0c\u5e76\u6253\u4e0a\u540d\u4e3a abroad \u7684\u7f51\u7edc\u7684 tag<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>set service dns forwarding options&nbsp;dhcp-option=tag:abroad,option:dns-server,192.168.88.2<\/p>\n<\/blockquote>\n\n\n\n<p>\u5b9a\u4e49 Option6 \u7684 DNS \u670d\u52a1\u5668\uff0c\u5e76\u6253\u4e0a\u540d\u4e3a abroad \u7684\u7f51\u7edc\u7684 tag<\/p>\n\n\n\n<p>\u7136\u540e\u83b7\u53d6\u9700\u8981\u9644\u52a0 Options \u7684\u5ba2\u6237\u7aef\u7684 mac \u5730\u5740\uff0c\u518d\u6dfb\u52a0<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>set service dns forwarding options&nbsp;dhcp-host=00:04:4c:34:56:0a,set:Home,set:abroad,192.168.88.90,SHIELD<\/p>\n<\/blockquote>\n\n\n\n<p>\u5373\u5728 Home \u7f51\u7edc\u4e0b\u4e3a mac \u4e3a 00:04:4c:34:56:0a \u7684\u8bbe\u5907\u5206\u914d IP \u4e3a 192.168.88.90 \u7684\u5730\u5740\uff0cHostname \u6807\u8bb0\u4e3aSHIELD\uff0c\u5e76\u9644\u52a0 abroad \u7f51\u7edc\u7684\u6240\u6709 Options\u3002<\/p>\n\n\n\n<p>\u4f9d\u6b21\u6dfb\u52a0\u5176\u4ed6\u9700\u8981\u8d4b\u4e88\u7684 Options \u548c mac&nbsp;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>commit ; save<\/p>\n<\/blockquote>\n\n\n\n<p>\u63d0\u4ea4\u5e76\u4fdd\u5b58\u540e\u518d\u4f7f\u7528\u76ee\u6807\u5ba2\u6237\u7aef\u8bf7\u6c42IP\u5730\u5740\u5c31\u53ef\u4ee5\u770b\u5230\u6548\u679c\u4e86\u3002<\/p>\n\n\n\n<p>\u540e\u7eed\u6dfb\u52a0\u5ba2\u6237\u7aef\u57fa\u672c\u4e5f\u53ef\u4ee5\u53ea\u5728 UI \u4e2d\u6dfb\u52a0\u4e00\u6761 Options \u7684 String \u5c31\u53ef\u4ee5\u4e86\uff0c\u867d\u7136\u6ca1\u6709 ROS \u4e0a\u76f4\u63a5\u7528 UI \u8bbe\u7f6e\u90a3\u4e48\u723d\uff0c\u4f46\u4e5f\u57fa\u672c\u505a\u5230\u5f88\u65b9\u4fbf\u7684\u6c34\u5e73\u4e86\u3002<\/p>\n\n\n\n<p>&#8212;<\/p>\n\n\n\n<p>\u8ffd\u52a0\u4e00\u4e0b\u6700\u8fd1\u770b\u5230\u7684\u4f5c\u7528\u76f8\u540c\u7684\u914d\u7f6e\u65b9\u5f0f<\/p>\n\n\n\n<p>service \/ dhcp-server \/ shared-network-name \/ LAN \/ subnet \/ 192.168.88.0\/24 \/ static-mapping<\/p>\n\n\n\n<p>\u5728\u6bcf\u4e00\u4e2a\u56fa\u5b9aIP\u7684\u8bbe\u5907\u7684 static-mapping-parameters \u90e8\u5206\u6dfb\u52a0<\/p>\n\n\n\n<p>option routers 192.168.88.3;<br>option domain-name-servers 198.18.0.2;<\/p>\n\n\n\n<p>service\/dhcp- server\u90a3\u91ccuse-dnsmasq\u7684\u8bbe\u7f6e\u9700\u8981\u8bbe\u7f6e\u6210disable\uff0c\u4e0d\u7136\u7528\u7684\u8fd8\u662fdnsmasq\u7684\u8bbe\u7f6e<\/p>\n\n\n\n<p><br>\u9884\u89c8\u4fdd\u5b58\u540e\u91cd\u65b0\u8fde\u63a5\u5c31\u53ef\u4ee5\u751f\u6548\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u4e00\u76f4\u5728\u4f7f\u7528\u4e00\u53f0 Edgerouter-X-SFP + PON Stick \u505a\u4e3b\u8def\u7531\uff0c\u4f46\u53c8\u56e0\u4e3a\u65e0\u6cd5\u653e\u5f03 RO [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":109,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-homenetwork"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/posts\/1","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1"}],"version-history":[{"count":2,"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/posts\/1\/revisions\/73"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/media\/109"}],"wp:attachment":[{"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ozogen.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}