{"id":134448,"date":"2019-01-25T09:41:09","date_gmt":"2019-01-25T01:41:09","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=134448"},"modified":"2019-01-22T08:41:50","modified_gmt":"2019-01-22T00:41:50","slug":"dhcp-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/dhcp-linux.html","title":{"rendered":"DHCP\u670d\u52a1\u539f\u7406\u4e0e\u642d\u5efa"},"content":{"rendered":"

\u5927\u5bb6\u90fd\u77e5\u9053\u4e0a\u7f51\u7684\u6700\u57fa\u672c\u524d\u63d0\u662f\u8981\u5728\u7ec8\u7aef\u4e0a\u8bbe\u7f6eIP\u3001\u5b50\u7f51\u63a9\u7801\u3001\u7f51\u5173\u3001DNS\u7b49\u5730\u5740\u4fe1\u606f\uff0c\u5728\u5bb6\u91cc\u6216\u8005\u5728\u529e\u516c\u5ba4\u5f88\u591a\u65f6\u5019\u6253\u5f00\u7535\u8111\u540e\u53d1\u73b0\u5c31\u53ef\u4ee5\u4e0a\u7f51\uff0c\u5e76\u6ca1\u6709\u624b\u52a8\u8bbe\u7f6eIP\u3001\u63a9\u7801\u3001DNS\u5730\u5740\u4e5f\u80fd\u4e0a\u7f51\uff0c\u8fd9\u662f\u4ec0\u4e48\u539f\u56e0\u5462?\u5176\u5b9e\u8fd9\u4e2a\u539f\u56e0\u5f88\u7b80\u5355\uff0c\u8bf4\u660e\u4f60\u7684\u5185\u7f51\u6709\"DHCP\"\u670d\u52a1\u5668\uff0c\u901a\u8fc7\u5b83\u7ed9\u4f60\u7684\u7ec8\u7aef\u81ea\u52a8\u5206\u914d\u4e86IP\u63a9\u7801\u548c\u7f51\u5173\u7b49\u5730\u5740\uff0c\u7701\u53bb\u4e86\u4f60\u624b\u52a8\u914d\u7f6e\u8fc7\u7a0b\uff0c\u4ece\u800c\u7ed9\u7f51\u7ba1\u4eba\u5458\u548c\u529e\u516c\u4eba\u5458\u90fd\u5e26\u6765\u4e86\u65b9\u4fbf\uff0c\u7b80\u5316\u4e86\u7ba1\u7406\u8fc7\u7a0b\u3002
\n\"\"
\n\u4eca\u5929\u5c31\u4ee5\u672c\u7bc7\u6587\u7ae0\u5185\u5bb9\u7ed9\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e00\u4e0b\"DHCP\"\u5b9e\u73b0\u7684\u57fa\u672c\u539f\u7406\u4ee5\u53ca\u5e38\u89c1\u7684\u51e0\u79cd\u642d\u5efaDHCP\u670d\u52a1\u5668\u7684\u65b9\u6cd5!<\/p>\n

\u4e00\u3001DHCP\u5b9e\u73b0\u539f\u7406<\/strong><\/div>\n
1. DHCP\u662f\u4ec0\u4e48<\/strong><\/span><\/div>\n

DHCP(Dynamic Host Configuration Protocol\uff0c\u52a8\u6001\u4e3b\u673a\u914d\u7f6e\u534f\u8bae)\u662f\u4e00\u4e2a\u5c40\u57df\u7f51\u7684\u7f51\u7edc\u534f\u8bae\uff0c\u4f7f\u7528UDP\u534f\u8bae\u5de5\u4f5c\u3002\u5b83\u662f\u4e00\u79cd\u6d41\u884c\u7684Client\/Server\u534f\u8bae\uff0c\u4e00\u822c\u7528\u4e8e\u4e3a\u4e3b\u673a\u6216\u8005\u4e3a\u8def\u7531\u5668\u7b49\u6307\u5b9a\u76f8\u5173\u7684\u914d\u7f6e\u4fe1\u606f\u3002DHCP\u670d\u52a1\u5728\u4f01\u4e1a\u548c\u5bb6\u5ead\u4e2d\u5f97\u5230\u4e86\u5927\u91cf\u7684\u5e94\u7528\uff0c\u5b83\u80fd\u591f\u81ea\u52a8\u5206\u914dip\u5730\u5740\u4ee5\u53ca\u4e00\u4e9b\u5176\u4ed6\u7684\u76f8\u5173\u4fe1\u606f\uff0c\u6574\u4e2a\u8fc7\u7a0b\u5bf9\u5ba2\u6237\u900f\u660e\u3002<\/p>\n

2. \u90e8\u7f72DHCP\u670d\u52a1\u7684\u597d\u5904<\/strong><\/span><\/div>\n

\u51cf\u5c11\u7ba1\u7406\u5458\u7684\u5de5\u4f5c\u91cf
\n\u907f\u514d\u8f93\u5165\u9519\u8bef\u7684\u53ef\u80fd
\n\u907f\u514dip\u5730\u5740\u51b2\u7a81
\n\u5f53\u7f51\u7edc\u66f4\u6539ip\u5730\u5740\u6bb5\u65f6\uff0c\u4e0d\u9700\u8981\u518d\u91cd\u65b0\u914d\u7f6e\u6bcf\u4e00\u4e2a\u7528\u6237\u7684ip\u5730\u5740
\n\u63d0\u9ad8\u4e86ip\u5730\u5740\u7684\u5229\u7528\u7387
\n\u65b9\u4fbf\u5ba2\u6237\u7aef\u7684\u914d\u7f6e<\/p>\n

3. DHCP\u5206\u914d\u65b9\u5f0f<\/strong><\/span><\/div>\n

\u81ea\u52a8\u5206\u914d\u65b9\u5f0f(Automatic Allocation)\uff0cDHCP\u670d\u52a1\u5668\u4e3a\u4e3b\u673a\u6307\u5b9a\u4e00\u4e2a\u6c38\u4e45\u6027\u7684IP\u5730\u5740\uff0c\u4e00\u65e6DHCP\u5ba2\u6237\u7aef\u7b2c\u4e00\u6b21\u6210\u529f\u4eceDHCP\u670d\u52a1\u5668\u7aef\u79df\u7528\u5230IP\u5730\u5740\u540e\uff0c\u5c31\u53ef\u4ee5\u6c38\u4e45\u6027\u7684\u4f7f\u7528\u8be5\u5730\u5740\u3002
\n\u52a8\u6001\u5206\u914d\u65b9\u5f0f(Dynamic Allocation)\uff0cDHCP\u670d\u52a1\u5668\u7ed9\u4e3b\u673a\u6307\u5b9a\u4e00\u4e2a\u5177\u6709\u65f6\u95f4\u9650\u5236\u7684IP\u5730\u5740\uff0c\u65f6\u95f4\u5230\u671f\u6216\u4e3b\u673a\u660e\u786e\u8868\u793a\u653e\u5f03\u8be5\u5730\u5740\u65f6\uff0c\u8be5\u5730\u5740\u53ef\u4ee5\u88ab\u5176\u4ed6\u4e3b\u673a\u4f7f\u7528\u3002
\n\u624b\u5de5\u5206\u914d\u65b9\u5f0f(Manual Allocation)\uff0c\u5ba2\u6237\u7aef\u7684IP\u5730\u5740\u662f\u7531\u7f51\u7edc\u7ba1\u7406\u5458\u6307\u5b9a\u7684\uff0cDHCP\u670d\u52a1\u5668\u53ea\u662f\u5c06\u6307\u5b9a\u7684IP\u5730\u5740\u544a\u8bc9\u5ba2\u6237\u7aef\u4e3b\u673a\u3002<\/p>\n

4. DHCP\u5de5\u4f5c\u8fc7\u7a0b<\/strong><\/span><\/div>\n

DHCP\u5ba2\u6237\u673a\u5728\u542f\u52a8\u65f6\uff0c\u4f1a\u641c\u5bfb\u7f51\u7edc\u4e2d\u662f\u5426\u5b58\u5728DHCP\u670d\u52a1\u5668\u3002\u5982\u679c\u627e\u5230\uff0c\u5219\u7ed9DHCP\u670d\u52a1\u5668\u53d1\u9001\u4e00\u4e2a\u8bf7\u6c42\u3002DHCP\u670d\u52a1\u5668\u63a5\u5230\u8bf7\u6c42\u540e\uff0c\u4e3aDHCP\u5ba2\u6237\u673a\u9009\u62e9TCP\/IP\u914d\u7f6e\u7684\u53c2\u6570\uff0c\u5e76\u628a\u8fd9\u4e9b\u53c2\u6570\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\u3002 \u5982\u679c\u5df2\u914d\u7f6e\u51b2\u7a81\u68c0\u6d4b\u8bbe\u7f6e\uff0c\u5219DHCP\u670d\u52a1\u5668\u5728\u5c06\u79df\u7ea6\u4e2d\u7684\u5730\u5740\u63d0\u4f9b\u7ed9\u5ba2\u6237\u673a\u4e4b\u524d\u4f1a\u4f7f\u7528Ping\u6d4b\u8bd5\u4f5c\u7528\u57df\u4e2d\u6bcf\u4e2a\u53ef\u7528\u5730\u5740\u7684\u8fde\u901a\u6027\u3002\u8fd9\u53ef\u786e\u4fdd\u63d0\u4f9b\u7ed9\u5ba2\u6237\u7684\u6bcf\u4e2aIP\u5730\u5740\u90fd\u6ca1\u6709\u88ab\u4f7f\u7528\u624b\u52a8TCP\/IP\u914d\u7f6e\u7684\u53e6\u4e00\u53f0\u975eDHCP\u8ba1\u7b97\u673a\u4f7f\u7528\u3002<\/p>\n

\u6839\u636e\u5ba2\u6237\u7aef\u662f\u5426\u7b2c\u4e00\u6b21\u767b\u5f55\u7f51\u7edc\uff0cDHCP\u7684\u5de5\u4f5c\u5f62\u5f0f\u4f1a\u6709\u6240\u4e0d\u540c\u3002<\/p>\n

\u521d\u6b21\u767b\u5f55\u65f6DHCP\u5de5\u4f5c\u5305\u62ec\u56db\u4e2a\u6b65\u9aa4\uff1a<\/p>\n

(1) \u7b2c\u4e00\u6b65\u5bfb\u627eDHCP\u670d\u52a1\u5668<\/p>\n

\u5f53DHCP\u5ba2\u6237\u7aef\u7b2c\u4e00\u6b21\u767b\u5f55\u7f51\u7edc\u7684\u65f6\u5019\uff0c\u8ba1\u7b97\u673a\u53d1\u73b0\u672c\u673a\u4e0a\u6ca1\u6709\u4efb\u4f55IP\u5730\u5740\u8bbe\u5b9a\uff0c\u5c06\u4ee5\u5e7f\u64ad\u65b9\u5f0f\u53d1\u9001DHCP\u2002discover\u53d1\u73b0\u4fe1\u606f\u6765\u5bfb\u627eDHCP\u670d\u52a1\u5668\uff0c\u5373\u5411255.255.255.255\u53d1\u9001\u7279\u5b9a\u7684\u5e7f\u64ad\u4fe1\u606f\u3002\u7f51\u7edc\u4e0a\u6bcf\u4e00\u53f0\u5b89\u88c5\u4e86TCP\/IP\u534f\u8bae\u7684\u4e3b\u673a\u90fd\u4f1a\u63a5\u6536\u8fd9\u4e2a\u5e7f\u64ad\u4fe1\u606f\uff0c\u4f46\u53ea\u6709DHCP\u670d\u52a1\u5668\u624d\u4f1a\u505a\u51fa\u54cd\u5e94\u3002<\/p>\n

(2) \u7b2c\u4e8c\u6b65\u5206\u914dIP\u5730\u5740<\/p>\n

\u5728\u7f51\u7edc\u4e2d\u63a5\u6536\u5230DHCP\u2002discover\u53d1\u73b0\u4fe1\u606f\u7684DHCP\u670d\u52a1\u5668\u5c31\u4f1a\u505a\u51fa\u54cd\u5e94\uff0c\u5b83\u4ece\u5c1a\u672a\u5206\u914d\u7684IP\u5730\u5740\u6c60\u4e2d\u6311\u9009\u4e00\u4e2a\u5206\u914d\u7ed9DHCP\u5ba2\u6237\u673a\uff0c\u5e76\u5411DHCP\u5ba2\u6237\u673a\u53d1\u9001\u4e00\u4e2a\u5305\u542b\u5206\u914d\u7684IP\u5730\u5740\u548c\u5176\u4ed6\u8bbe\u7f6e\u7684DHCP offer\u63d0\u4f9b\u4fe1\u606f\u3002<\/p>\n

(3) \u7b2c\u4e09\u6b65\u63a5\u53d7IP\u5730\u5740<\/p>\n

DHCP\u5ba2\u6237\u7aef\u63a5\u53d7\u5230DHCP offer\u63d0\u4f9b\u4fe1\u606f\u4e4b\u540e\uff0c\u9009\u62e9\u7b2c\u4e00\u4e2a\u63a5\u6536\u5230\u7684\u63d0\u4f9b\u4fe1\u606f\uff0c\u7136\u540e\u4ee5\u5e7f\u64ad\u7684\u65b9\u5f0f\u56de\u7b54\u4e00\u4e2aDHCP\u2002request\u8bf7\u6c42\u4fe1\u606f\uff0c\u8be5\u4fe1\u606f\u5305\u542b\u5411\u5b83\u6240\u9009\u5b9a\u7684DHCP\u670d\u52a1\u5668\u8bf7\u6c42IP\u5730\u5740\u7684\u5185\u5bb9\u3002<\/p>\n

(4) \u7b2c\u56db\u6b65IP\u5730\u5740\u5206\u914d\u786e\u8ba4<\/p>\n

\u5f53DHCP\u670d\u52a1\u5668\u6536\u5230DHCP\u5ba2\u6237\u7aef\u56de\u7b54\u7684DHCP request\u8bf7\u6c42\u4fe1\u606f\u4e4b\u540e\uff0c\u4fbf\u5411DHCP\u5ba2\u6237\u7aef\u53d1\u9001\u4e00\u4e2a\u5305\u542b\u5b83\u6240\u63d0\u4f9b\u7684IP\u5730\u5740\u548c\u5176\u4ed6\u8bbe\u7f6e\u7684DHCP\u2002ack\u786e\u8ba4\u4fe1\u606f\uff0c\u544a\u8bc9DHCP\u5ba2\u6237\u7aef\u53ef\u4ee5\u4f7f\u7528\u5b83\u63d0\u4f9b\u7684IP\u5730\u5740\u3002\u7136\u540e\uff0cDHCP\u5ba2\u6237\u673a\u4fbf\u5c06\u5176TCP\/IP\u534f\u8bae\u4e0e\u7f51\u5361\u7ed1\u5b9a\uff0c\u53e6\u5916\uff0c\u9664\u4e86DHCP\u5ba2\u6237\u673a\u9009\u4e2d\u7684DHCP\u670d\u52a1\u5668\u5916\uff0c\u5176\u4ed6\u7684DHCP\u670d\u52a1\u5668\u5c06\u6536\u56de\u66fe\u7ecf\u63d0\u4f9b\u7684IP\u5730\u5740\u3002<\/p>\n

\u91cd\u65b0\u767b\u5f55\uff1a<\/p>\n

\u4ee5\u540eDHCP\u5ba2\u6237\u7aef\u6bcf\u6b21\u91cd\u65b0\u767b\u5f55\u7f51\u7edc\u65f6\uff0c\u5c31\u4e0d\u9700\u8981\u518d\u53d1\u9001DHCP discover\u53d1\u73b0\u4fe1\u606f\u4e86\uff0c\u800c\u662f\u76f4\u63a5\u53d1\u9001\u5305\u542b\u524d\u4e00\u6b21\u6240\u5206\u914d\u7684IP\u5730\u5740\u7684DHCP request\u8bf7\u6c42\u4fe1\u606f\u3002\u5f53DHCP\u670d\u52a1\u5668\u6536\u5230\u8fd9\u4e00\u4fe1\u606f\u540e\uff0c\u5b83\u4f1a\u5c1d\u8bd5\u8ba9DHCP\u5ba2\u6237\u673a\u7ee7\u7eed\u4f7f\u7528\u539f\u6765\u7684IP\u5730\u5740\uff0c\u5e76\u56de\u7b54\u4e00\u4e2aDHCP\u2002ack\u786e\u8ba4\u4fe1\u606f\u3002\u5982\u679c\u6b64IP\u5730\u5740\u5df2\u65e0\u6cd5\u518d\u5206\u914d\u7ed9\u539f\u6765\u7684DHCP\u5ba2\u6237\u673a\u4f7f\u7528\u65f6\uff0c\u5219DHCP\u670d\u52a1\u5668\u7ed9DHCP\u5ba2\u6237\u673a\u56de\u7b54\u4e00\u4e2aDHCP\u2002nack\u5426\u8ba4\u4fe1\u606f\u3002\u5f53\u539f\u6765\u7684DHCP\u5ba2\u6237\u673a\u6536\u5230\u6b64DHCP nack\u5426\u8ba4\u4fe1\u606f\u540e\uff0c\u5b83\u5c31\u5fc5\u987b\u91cd\u65b0\u53d1\u9001DHCP discover\u53d1\u73b0\u4fe1\u606f\u6765\u8bf7\u6c42\u65b0\u7684IP\u5730\u5740\u3002<\/p>\n

\u5982\u679c\u5ba2\u6237\u7aefDHCP request \u5185\u7684IP\u5730\u5740\u5728\u670d\u52a1\u5668\u7aef\u6ca1\u6709\u88ab\u4f7f\u7528\uff0cDHCP\u670d\u52a1\u5668\u56de\u590dDHCP ACK\u7ee7\u7eed\u4f7f\u7528IP\u3002
\n\u5982\u679c\u5ba2\u6237\u7aefDHCP request \u5185\u7684IP\u5730\u5740\u5728\u670d\u52a1\u5668\u7aef\u5df2\u88ab\u4f7f\u7528\uff0cDHCP\u670d\u52a1\u5668\u56de\u590dDHCP NACK\u544a\u8bc9\u5ba2\u6237\u7aefIP\u5df2\u88ab\u4f7f\u7528\u3002
\n\u56de\u590dNACK\u540e\uff0c\u91cd\u65b0\u5f00\u59cbDHCP\u521d\u6b21\u767b\u5f55\u65f6\u7684\u6d41\u7a0b
\n\u66f4\u65b0\u79df\u7ea6\uff1a<\/p>\n

DHCP\u670d\u52a1\u5668\u5411DHCP\u5ba2\u6237\u673a\u51fa\u79df\u7684IP\u5730\u5740\u4e00\u822c\u90fd\u6709\u4e00\u4e2a\u79df\u501f\u671f\u9650\uff0c\u671f\u6ee1\u540eDHCP\u670d\u52a1\u5668\u4fbf\u4f1a\u6536\u56de\u51fa\u79df\u7684IP\u5730\u5740\u3002\u5982\u679cDHCP\u5ba2\u6237\u673a\u8981\u5ef6\u957f\u5176IP\u79df\u7ea6\uff0c\u5219\u5fc5\u987b\u66f4\u65b0\u5176IP\u79df\u7ea6\u3002DHCP\u5ba2\u6237\u673a\u542f\u52a8\u65f6\u548cIP\u79df\u7ea6\u671f\u9650\u5230\u8fbe\u79df\u7ea6\u768450%\u65f6\uff0cDHCP\u5ba2\u6237\u673a\u90fd\u4f1a\u81ea\u52a8\u5411DHCP\u670d\u52a1\u5668\u53d1\u9001\u66f4\u65b0\u5176IP\u79df\u7ea6\u7684\u4fe1\u606f\u3002<\/p>\n

\u4e8c\u3001\u5e38\u89c1\u7684\u51e0\u79cd\u642d\u5efaDHCP\u670d\u52a1\u5668\u7684\u65b9\u6cd5<\/strong><\/div>\n
1. \u5229\u7528TPLinK\u7b49\u5bbd\u5e26\u8def\u7531\u5668\u5185\u7f6e\u7684DHCP\u529f\u80fd\u6a21\u5757\u63d0\u4f9b\u670d\u52a1<\/strong><\/span><\/div>\n

\u8fd9\u79cd\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u9996\u5148\u5c31\u662f\u767b\u5f55\u8def\u7531\u5668\uff0c\u627e\u5230DHCP\u529f\u80fd\u8bbe\u7f6e\u7684\u4f4d\u7f6e\uff0c\u76f4\u63a5\u8bbe\u7f6e\u5373\u53ef\u3002<\/p>\n

\u8bbe\u7f6e\u597d\u4fdd\u5b58\u91cd\u542f\u540e\uff0c\u7f51\u5185\u7684\u8ba1\u7b97\u673a\u5c31\u53ef\u4ee5\u81ea\u52a8\u83b7\u53d6iP\u5730\u5740\u7b49\u4fe1\u606f\u4e86\u3002<\/p>\n

2. \u529e\u516c\u7f51\u73af\u5883\u5229\u7528\u4e09\u5c42\u4ea4\u6362\u673a\u642d\u5efaDHCP\u670d\u52a1<\/strong><\/span><\/div>\n

\u4ee5\u534e\u4e3a\u4ea4\u6362\u673a\u4e3e\u4f8b\uff1a
\n\"\"
\n\u5728\u4e09\u5c42\u4ea4\u6362\u673a\u914d\u7f6eDHCP\u670d\u52a1\u8fc7\u7a0b\uff1a<\/p>\n

system-view\u2002\uff08\u8fdb\u5165\u5168\u5c40\u6a21\u5f0f\uff09\r\n[Huawei]sysname\u2002SW1\u2002(\u2002\u8bbe\u5907\u547d\u540d\uff09\r\n[SW1]dhcp\u2002enable\u2002\uff08\u4f7f\u7528DHCP\u529f\u80fd\uff09\r\n[SW1]ip\u2002pool\u200210\u2002\uff08\u521b\u5efa\u5168\u5c40\u5730\u5740\u6c60\uff0c\u540c\u65f6\u8fdb\u5165\u5168\u5c40\u5730\u5740\u6c60\u89c6\u56fe\uff09\r\n[SW1-ip-pool-10]network\u2002192.168.10.0\u2002mask\u200224 \uff08\u914d\u7f6e\u5168\u5c40\u5730\u5740\u6c60\u53ef\u52a8\u6001\u5206\u914d\u7684IP\u5730\u5740\u8303\u56f4\uff09\r\n[SW1-ip-pool-10]dns-list\u20028.8.8.8\u2002\uff08\u914d\u7f6eDNS\u2002\uff09\r\n[SW1-ip-pool-10]gateway-list\u2002192.168.10.1\u2002\uff08\u914d\u7f6e\u7f51\u5173\uff09\r\n[SW1-ip-pool-10]excluded-ip-address\u2002192.168.10.201\u2002192.168.10.254\u2002\uff08\u4fdd\u7559\u4e0d\u88ab\u5206\u914d\u7684\u5730\u5740\uff09\r\n[SW1-ip-pool-10]lease\u2002day\u20027\u2002\uff08IP\u79df\u7ea6\u671f\u9650\uff09\r\n[SW1-ip-pool-10]dis\u2002this\u2002\uff08\u67e5\u8be2\u5f53\u524d\u6a21\u5f0f\u7684\u914d\u7f6e\uff09\r\n# ip\u2002pool\u200210\r\ngateway-list\u2002192.168.10.1\u2002\uff08\u7f51\u5173\uff09\r\nnetwork\u2002192.168.10.0\u2002mask\u2002255.255.255.0\u2002\uff08IP\u5730\u5740\u8303\u56f4\uff09\r\nexcluded-ip-address\u2002192.168.10.201\u2002192.168.10.254\u2002\uff08\u4fdd\u7559IP\u5730\u5740\u8303\u56f4\uff09\r\nlease\u2002day\u20027\u2002hour\u20020\u2002minute\u20020\u2002\uff08IP\u79df\u7ea6\u5468\u671f\uff09\r\ndns-list\u20028.8.8.8\r\n[SW1-ip-pool-10]quit\u2002(\u9000\u51fa\r\n[SW1]ip\u2002pool\u200220\r\n[SW1-ip-pool-20]network\u2002192.168.20.0\u2002mask\u200224\r\n[SW1-ip-pool-20]dns-list\u20028.8.8.8\r\n[SW1-ip-pool-20]gateway-list\u2002192.168.20.1\r\n[SW1-ip-pool-20]excluded-ip-address\u2002192.168.20.201\u2002192.168.20.254\r\n[SW1-ip-pool-20]lease\u2002day\u20027\r\n[SW1-ip-pool-20]q\r\n------------------------------------------------\r\n[SW1]vlan\u2002batch\u200210\u200220\u2002\uff08\u6279\u91cf\u521b\u5efavlan\uff09\r\n[SW1]interface\u2002GigabitEthernet\u20020\/0\/1\u2002\uff08\u8fdb\u5165port\u20021)\r\n[SW1-GigabitEthernet0\/0\/1]port\u2002link-type\u2002access\u2002(\u914d\u7f6eport\u20021\u2002\u7c7b\u578b\uff09\r\n[SW1-GigabitEthernet0\/0\/1]port\u2002default\u2002vlan\u200210\u2002\uff08\u914d\u7f6eport\u20021\u2002vlan)\r\n[SW1-GigabitEthernet0\/0\/1]quit\u2002(\u9000\u51fa\uff09\r\n[SW1]interface\u2002GigabitEthernet\u20020\/0\/2\r\n[SW1-GigabitEthernet0\/0\/2]port\u2002link-type access\r\n[SW1-GigabitEthernet0\/0\/2]port\u2002default\u2002vlan\u200220\r\n[SW1-GigabitEthernet0\/0\/2]quit\r\n\uff08\u2002\u914d\u7f6eVLANIF10\u63a5\u53e3\u4e0b\u7684\u5ba2\u6237\u7aef\u4ece\u5168\u5c40\u5730\u5740\u6c60\u4e2d\u83b7\u53d6IP\u5730\u5740\uff09\r\n[SW1]interface\u2002Vlanif\u200210\u2002\uff08\u521b\u5efavlanif\u200210)\r\n[SW1-Vlanif10]ip\u2002address\u2002192.168.10.1\u200224\u2002(\u914d\u7f6eIP\u5730\u5740\uff09\r\n[SW1-Vlanif10]dhcp\u2002select\u2002global\u2002\uff08\u5728vlanif\u200210\u6a21\u5f0f\u4e0b\u8c03\u7528\u5168\u5c40\u5730\u5740\u6c60\uff09\r\n[SW1-Vlanif10]display\u2002this\u2002\uff08\u67e5\u8be2\u5f53\u524d\u914d\u7f6e\u53c2\u6570\uff09\r\n#\r\ninterface\u2002Vlanif10\r\nip\u2002address\u2002192.168.10.1\u2002255.255.255.0\r\ndhcp\u2002select\u2002global\r\n#\r\nReturn\r\n[SW1-Vlanif10]quit\r\n[SW1]interface\u2002Vlanif\u200220\r\n[SW1-Vlanif20]ip\u2002address\u2002192.168.20.1\u200224\r\n[SW1-Vlanif20]dhcp\u2002select\u2002global\r\n[SW1-Vlanif20]quit\r\n[SW1]display\u2002ip\u2002pool\u2002\uff08\u67e5\u770bIP\u5730\u5740\u6c60\u914d\u7f6e\u60c5\u51b5\uff09\r\n[SW1]quit\r\nsave\u2002\uff08\u4fdd\u5b58\u914d\u7f6e\uff0c\u5199\u5165\u8bbe\u5907\uff09 <\/pre>\n
3. \u5728Windows \u7cfb\u7edf\u91cc\u642d\u5efaDHCP\u670d\u52a1<\/strong><\/span><\/div>\n

\u4ee52008server\u4e3a\u4f8b\uff1a<\/p>\n

2008ser\u642d\u5efaDHCP\u670d\u52a1\u5668\u6b65\u9aa4\uff1a<\/p>\n

\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5Windows Server 2008\u7cfb\u7edf\u4f5c\u4e3a\u670d\u52a1\u5668\u7aef;\u5ba2\u6237\u7aef\u53ef\u5b89\u88c5\u5176\u4ed6Windows\u7cfb\u7edf\u3002<\/p>\n

\u7b2c\u4e8c\u6b65\uff1a\u8fdb\u51652008ser\u7cfb\u7edf\uff0c\u624b\u52a8\u8bbe\u7f6eIP(\u672a\u8bbe\u7f6e\u9759\u6001IP\uff0c\u540e\u9762\u65e0\u6cd5\u7ee7\u7eed)<\/p>\n

\u7b2c\u4e09\u6b65\uff1a\u6253\u5f00\u670d\u52a1\u5668\u7ba1\u7406\u5668\uff1a\u7cfb\u7edf\u4e2d\u70b9\u51fb \"\u5f00\u59cb\u83dc\u5355\u7a0b\u5e8f\"\u2014\u2014> \u7ba1\u7406\u5de5\u5177 \u2014\u2014>\u670d\u52a1\u5668\u7ba1\u7406\u5668<\/p>\n

\u7b2c\u56db\u6b65\uff1a\u8fdb\u5165\u670d\u52a1\u5668\u7ba1\u7406\u5668\uff0c\u70b9\u51fb\u5de6\u4fa7\u7684\"\u89d2\u8272\"\u7136\u540e\u70b9\u51fb\u53f3\u4fa7\"\u6dfb\u52a0\u89d2\u8272\"<\/p>\n

\u7b2c\u4e94\u6b65\uff1a\u8fdb\u5165\u6dfb\u52a0\u89d2\u8272\u5411\u5bfc\u9ed8\u8ba4\u4e0b\u4e00\u6b65\uff0c<\/p>\n

\u7b2c\u516d\u6b65\uff1a\u670d\u52a1\u5668\u89d2\u8272\u754c\u9762\uff0c\u52fe\u9009DHCP\u670d\u52a1\u5668;<\/p>\n

\u7b2c\u4e03\u6b65\uff1a\u52fe\u9009DHCP\u670d\u52a1\u5668\u540e\uff0c\u5355\u51fb\"\u4e0b\u4e00\u6b65\"\u6309\u94ae\uff0c\u5c4f\u5e55\u4e0a\u5c06\u4f1a\u5f39\u51faDHCP\u670d\u52a1\u5668\u7b80\u4ecb\u7a97\u53e3\uff0c\u9ed8\u8ba4\u4e0b\u4e00\u6b65;<\/p>\n

\u7b2c\u516b\u6b65\uff1a \u8fdb\u5165\u9009\u62e9\u7f51\u7edc\u8fde\u63a5\u7ed1\u5b9a\uff0c\u52fe\u9009IP\u5730\u5740;\u5b89\u88c5\u7a0b\u5e8f\u5c06\u81ea\u52a8\u68c0\u67e5\u4f60\u7684\u670d\u52a1\u5668\u662f\u5426\u5177\u6709\u4e00\u4e2a\u9759\u6001IP\u5730\u5740\uff0c\u7b2c2\u6b65\u8bbe\u7f6e\u4e86\u5219\u4f1a\u88ab\u68c0\u6d4b\u663e\u793a\u51fa\u6765\u3002<\/p>\n

\u7b2c\u4e5d\u6b65\uff1a\u63a5\u4e0b\u6765\u5230\"IPv4DNS\u8bbe\u7f6e\"\uff0c\u9700\u8981\u8f93\u5165\u4f60\u7684\u7236\u57df\u540d\u548cDNS\u670d\u52a1\u5668\u7684IP\u5730\u5740\uff0c\u8fd9\u4e2a\u57df\u5c06\u7528\u4e8e\u6211\u4eec\u5728\u8fd9\u53f0DHCP\u670d\u52a1\u5668\u4e0a\u521b\u5efa\u7684\u6240\u6709\u4f5c\u7528\u57df; \u5f53DHCP\u66f4\u65b0IP\u5730\u5740\u4fe1\u606f\u7684\u65f6\u5019\uff0c\u76f8\u5e94\u7684DNS\u66f4\u65b0\u4f1a\u5c06\u8ba1\u7b97\u673a\u7684\u540d\u79f0\u5230IP\u5730\u5740\u7684\u5173\u8054\u8fdb\u884c\u540c\u6b65\u3002<\/p>\n

\u7b2c\u5341\u6b65\uff1a\u662f\u5426\u8981\u8bbe\u7f6eWINS\u670d\u52a1\u5668\u5730\u5740\u53c2\u6570\uff0c\u9ed8\u8ba4\"\u6b64\u7f51\u7edc\u4e0a\u7684\u5e94\u7528\u7a0b\u5e8f\u4e0d\u9700\u8981WINS\"\u9009\u9879; (\u82e5\u9700\u8981\u5219\u6b63\u786e\u8bbe\u7f6e\u597d\u76ee\u6807WINS\u670d\u52a1\u5668\u7684IP\u5730\u5740\u3002)<\/p>\n

\u7b2c\u5341\u4e00\u6b65\uff1a\u63a5\u4e0b\u6765\u7684\"DHCP\u4f5c\u7528\u57df\"\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u53f3\u4fa7\"\u6dfb\u52a0\"\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u672c\u5730\u5c40\u57df\u7f51\u7684IP\u5730\u5740\u5206\u914d\u60c5\u51b5\uff0c\u8bbe\u7f6e\u597dDHCP\u670d\u52a1\u5668\u7684\u9002\u7528\u8303\u56f4\uff0c\u540c\u65f6\u9009\u4e2d\"\u6fc0\u6d3b\u6b64\u4f5c\u7528\u57df\"\u9009\u9879\uff0c\u5e76\u5355\u51fb\"\u786e\u5b9a\"\u6dfb\u52a0\u5b8c\u6210\u3002<\/p>\n

\u7b2c\u5341\u4e8c\u6b65\uff1a DHCPv6\u65e0\u72b6\u6001\u6a21\u5f0f\uff0c\u9009\u62e9\u7981\u7528\u6a21\u5f0f;\u5728Windows Server 2008\u4e2d\u9ed8\u8ba4\u589e\u52a0\u4e86\u5bf9\u4e0b\u4e00\u4ee3IP\u5730\u5740\u89c4\u8303IPv6\u7684\u652f\u6301\uff0c\u4e0d\u8fc7\u5c31\u76ee\u524d\u7684\u7f51\u7edc\u73b0\u72b6\u6765\u8bf4\u5f88\u5c11\u7528\u5230IPv6\uff0c\u56e0\u6b64\u53ef\u4ee5\u9009\u62e9\u5bf9\u6b64\u670d\u52a1\u5668\u7981\u7528DHCPv6\u65e0\u72b6\u6001\u6a21\u5f0f\u3002<\/p>\n

\u7b2c\u5341\u4e09\u6b65\uff1a \u5728\"\u786e\u8ba4\"\u754c\u9762\uff0c\u786e\u8ba4\u540e\u70b9\u51fb\u5b89\u88c5\uff0c\u5f00\u59cb\u81ea\u52a8\u5b89\u88c5\u3002\u8fdb\u5ea6\u6761\u5b8c\u6210\uff0cDHCP\u4e5f\u5b89\u88c5\u5b8c\u6210\u3002<\/p>\n

\u6700\u540e\u540c\u5c40\u57df\u7f51\u4e2d\u7684\u5ba2\u6237\u7aef\u8bbe\u7f6e\u4e3a\u81ea\u52a8\u83b7\u5f97IP\u5730\u5740\uff0c\u5373\u53ef\u83b7\u5f97DHCP\u81ea\u52a8\u5206\u914d\u7684IP;<\/p>\n

4. Linux\u7cfb\u7edf\u4e0b\u642d\u5efaDHCP\u670d\u52a1<\/strong><\/span><\/div>\n

\u4ee5ubuntu\u7cfb\u7edf\u4e3a\u4f8b\uff1a<\/p>\n

\u7f51\u7edc\u62d3\u6251\u7ed3\u6784\u56fe\u5982\u4e0b\uff1a
\n\"\"
\n\u914d\u7f6e\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n

\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5isc-dhcp-server<\/p>\n

\u91c7\u7528\u547d\u4ee4\uff1aapt-get install isc-dhcp-server\uff1a<\/p>\n

\u7b2c\u4e00\u6b65\uff1a\u914d\u7f6eisc-dhcp-server<\/p>\n

\u9996\u5148\u5bf9\u4f5c\u4e3aDHCP\u670d\u52a1\u5668\u7684\"ubuntu \u526f\u672c\"\u8fdb\u884c\u8bbe\u7f6e\uff1a<\/p>\n

\u7b2c\u4e09\u6b65\uff1a\u8fdb\u5165\u8d85\u7ea7\u7528\u6237\uff0c\u7f16\u8f91\u6587\u4ef6\/etc\/default\/isc-dhcp-server\u6587\u4ef6\uff1a<\/p>\n

\u5728INTERFACES=\"\"\u5904\u586b\u5165\u7f51\u5361\u540denp0s3\uff1a<\/p>\n

\u7b2c\u56db\u6b65\uff1a\u5c06\u6587\u4ef6\u6253\u5f00\u53d1\u73b0\u6709\u5f88\u591a\u4f8b\u5b50\uff0c\u90fd\u662f\u88ab\u6ce8\u91ca\u6389\u4e86\u7684\uff0c\u9009\u7528\u4e00\u4e2a\u4f8b\u5b50\uff0c\u4fee\u6539\u540e\u7684\u7ed3\u679c\u5982\u4e0b\uff1a
\n\"\"<\/p>\n

\u4fee\u6539\u672c\u673a\u7684IP\u5730\u5740\uff0c\u5b50\u7f51\u63a9\u7801\uff0c\u9ed8\u8ba4\u7f51\u5173\uff0cDNS\u7b49\uff1a<\/p>\n

\u5bf9\u8be5\u7f51\u5361\u8fdb\u884c\u91cd\u542f\uff0c\u5bf9\u7f51\u7edc\u8fdb\u884c\u91cd\u65b0\u542f\u52a8\uff0c\u5c06DHCP\u670d\u52a1\u5f00\u542f\uff1a<\/p>\n

\u7b2c\u4e94\u6b65\uff1aLinux\u5ba2\u6237\u673a\u914d\u7f6e(\u865a\u62df\u673a\u4ece\u865a\u62df\u673a\u83b7\u5f97IP)\uff1a<\/p>\n

\u7f51\u7edc\u8fde\u63a5\u8bbe\u7f6e\u4e3a\u81ea\u52a8\u83b7\u53d6IP\u5730\u5740\uff1a<\/p>\n

\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165dhclient\u547d\u4ee4\u91cd\u65b0\u5206\u914dIP\u5730\u5740\uff0c\u6211\u4eec\u53d1\u73b0IP\u5730\u5740\u6210\u529f\u88ab\u5206\u914d\u5230\u4e86\uff0c\u5176\u4e2d\u56fe\u4e00\u662f\u672a\u5f97\u5230\u5206\u914d\u7684IP\u5730\u5740\uff0c\u56fe\u4e8c\u662f\u91cd\u5206\u914d\u540e\u5f97\u5230\u7684\u7531DHCP\u670d\u52a1\u5668192.168.137.2\u5206\u914d\u800c\u6765\u7684IP\u5730\u5740192.168.137.101\uff1a<\/p>\n

\u901a\u8fc7wireshark\u6293\u5305\u8fdb\u884c\u5206\u6790\uff0c\u53ef\u770b\u5230IP\u5730\u5740192.168.137.101\u7684\u786e\u662f\u7531DHCP\u670d\u52a1\u5668192.168.137.2\u63d0\u4f9b\u7684\uff0c\u5e76\u4e14\u53ef\u4ee5\u770b\u5230\u5b83\u4eec\u4e4b\u95f4\u7684request-ack\u8fc7\u7a0b\uff1a<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4eca\u5929\u5c31\u4ee5\u672c\u7bc7\u6587\u7ae0\u5185\u5bb9\u7ed9\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e00\u4e0b”DHCP”\u5b9e\u73b0\u7684\u57fa\u672c\u539f\u7406\u4ee5\u53ca\u5e38\u89c1\u7684\u51e0\u79cd\u642d\u5efaDHCP\u670d\u52a1\u5668\u7684\u65b9\u6cd5\uff01<\/p>\n","protected":false},"author":370,"featured_media":37905,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-134448","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/134448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/370"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=134448"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/134448\/revisions"}],"predecessor-version":[{"id":134534,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/134448\/revisions\/134534"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/37905"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=134448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=134448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=134448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}