{"id":900,"date":"2008-10-07T22:03:00","date_gmt":"2008-10-07T14:03:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=900"},"modified":"2023-11-07T22:12:25","modified_gmt":"2023-11-07T14:12:25","slug":"cisco-dhcp","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/900","title":{"rendered":"Cisco DHCP"},"content":{"rendered":"\n<p>\u555f\u52d5dhcp\u529f\u80fd<br><strong>(config)#[no] server dhcp<\/strong><br>\u9810\u8a2d\u662f\u555f\u52d5,\u53ef\u5728\u524d\u52a0no\u4f86\u95dc\u9589<br>ps:Cisco IOS\u4e2d\u7684Easy IP\u63d0\u4f9b\u4e00\u500b\u53ef\u9078\u64c7\u4e14\u5168\u529f\u80fd\u7684DHCP\u4f3a\u670d\u5668<\/p>\n\n\n\n<p>\u65b0\u589edhcp\u670d\u52d9\u540d\u7a31<br><strong>(config)#ip dhcp pool &lt; pooname&gt;<br><\/strong>\u5728\u5206\u914dip\u7d66client\u524d,\u6703\u5148\u9001ICMP\u6216ping\u5224\u65b7\u8a72\u5730\u5740\u662f\u5426\u88ab\u7528,\u9810\u8a2dping\u6b21\u6578\u662f\u5169\u6b21<br><br>\u8a2d\u5b9adhcp\u5206\u914d\u7684\u7d44\u614b<br><strong>(config-dhcp)#[option]<\/strong><br>option\u8aaa\u660e\u5982\u4e0b<br>network &lt; ip&gt; &lt; mask&gt;<strong>&nbsp;<\/strong>\u5b9a\u7fa9\u53ef\u4ee5\u5206\u914d\u7d66\u7684ip\u7bc4\u570d<br>dns-server &lt; ip&gt;\u3000\u8a2d\u5b9adns<br>default-router &lt; ip&gt; \u8a2d\u5b9adefault-gateway<br>domain-name &lt; domain name&gt;<br>netbios-name-server &lt; ip&gt; \u8a2d\u5b9awins<\/p>\n\n\n\n<p>ex:<br>(config)#ip dhcp pool dhcpzone<br>(config-dhcp)# network 10.1.20.0 255.255.255.0<br>(config-dhcp)# default-router 10.1.20.254<br>(config-dhcp)# dns-server 10.1.1.1&nbsp;<\/p>\n\n\n\n<p>\u8a2d\u5b9adhcp\u79df\u671f<br><strong>(config-dhcp)#lease &lt; infinite | &lt; days [hours [minutes]] &gt;&gt;<\/strong><br>\u5206\u914d\u7684ip\u9810\u8a2d24\u5c0f\u6642\u5c31\u6703\u88ab\u53d6\u56de&nbsp;&nbsp;<\/p>\n\n\n\n<p>\u8a2d\u5b9adhcp\u4e0d\u8981\u5206\u914dip\u7684\u7bc4\u570d<br><strong>(config)#ip dhcp excluded-address &lt; ip range&gt;<\/strong><br>ex:192.168.1.10-192.168.1.20\u7bc4\u570d\u7684ip\u4e0d\u767c<br>(config)#ip dhcp excluded-address 192.168.1.10 192.168.1.20<\/p>\n\n\n\n<p>\u8a2d\u5b9adhcp\u8cc7\u6599\u5eab<br><strong>(config)#ip dhcp database &lt; name&gt;<\/strong><\/p>\n\n\n\n<p>ps:<br>(config)#ip dhcp ?<br>pool\u3000 Configure DHCP address pools<br>excluded-address\u3000 Prevent DHCP from assigning certain addresses<br>relay\u3000 DHCP relay agent parameters<\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/p>\n\n\n\n<p>\u91dd\u5c0dDHCP\u7684\u52d5\u4f5c\u9032\u884c\u932f\u8aa4\u6392\u9664<\/p>\n\n\n\n<p><strong>#debug ip dhcp server events<\/strong><br>\u6703\u986f\u793a\u4f3a\u670d\u9031\u671f\u6027\u5730\u6aa2\u8996\u662f\u5426\u79df\u7d04\u5230\u671f\u7684\u4e00\u4e9b\u8a0a\u606f,\u540c\u6642\u4e5f\u6703\u986f\u793a\u5730\u5740\u7684\u6b78\u9084\u548c\u5730\u5740\u7684\u5206\u914d\u7a0b\u5e8f<br>\u756b\u9762\u5927\u81f4\u5982\u4e0b<br>*Mar 2 00:16:37.427: DHCPD: Seeing if there is an internally specified pool class:<br>*Mar 2 00:16:37.431: DHCPD: htype 1 chaddr c001.0f1c.0000<br>*Mar 2 00:16:37.431: DHCPD: remote id 020a00000a01010101000000<br>*Mar 2 00:16:37.435: DHCPD: circuit id 00000000<br>*Mar 2 00:16:39.415: DHCPD: Seeing if there is an internally specified pool class:<br>*Mar 2 00:16:39.419: DHCPD: htype 1 chaddr c001.0f1c.0000<br>*Mar 2 00:16:39.419: DHCPD: remote id 020a00000a01010101000000<br>*Mar 2 00:16:39.423: DHCPD: circuit id 00000000<br>*Mar 2 00:16:42.603: DHCPD: no subnet configured for 192.168.1.2.<\/p>\n\n\n\n<p><strong>#debug ip dhcp server packet<\/strong><br>\u986f\u793adhcp packet\u7684\u89e3\u78bc&nbsp;<br>\u756b\u9762\u5927\u81f4\u5982\u4e0b<br>*Mar 2 00:17:39.867: DHCPD: DHCPRELEASE message received from client<br>0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 (10.1.1.2).<br>*Mar 2 00:17:41.855: DHCPD: DHCPRELEASE message received from client<br>0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 (10.1.1.2).<br>*Mar 2 00:17:41.859: DHCPD: Finding a relay for client<br>0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 on interface<br>FastEthernet0\/1.<br>*Mar 2 00:17:54.775: DHCPD: DHCPDISCOVER received from client<br>0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 on interface<br>FastEthernet0\/1.<br>*Mar 2 00:17:54.779: DHCPD: Allocate an address without class information<br>(10.1.1.0)<br>*Mar 2 00:17:56.783: DHCPD: Sending DHCPOFFER to client<br>0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 (10.1.1.1).<br>*Mar 2 00:17:56.787: DHCPD: broadcasting BOOTREPLY to client c001.0f1c.0000.<br>*Mar 2 00:17:56.879: DHCPD: DHCPREQUEST received from client<br>0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30.<br>*Mar 2 00:17:56.887: DHCPD: No default domain to append &#8211; abort update<br>*Mar 2 00:17:56.887: DHCPD: Sending DHCPACK to client<br>0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 (10.1.1.1).<br>*Mar 2 00:17:56.891: DHCPD: broadcasting BOOTREPLY to client c001.0f1c.0000.<\/p>\n\n\n\n<p>&#8230;&nbsp;<\/p>\n\n\n\n<p><strong>#show ip dhcp binding<\/strong><br>\u9a57\u8b49DHCP\u7684\u904b\u4f5c,\u6703\u986f\u793aDHCP\u670d\u52d9\u7684\u4e00\u7cfb\u5217\u7d44\u614b\u8a2d\u5b9a<br>\u756b\u9762\u5927\u81f4\u5982\u4e0b<br>IP address Hardware address Lease expiration Type<br>192.168.1.10 0100.16d3.234d.10 Mar 02 2008 01:15 AM Automatic<br>ps:<br>\u82e5\u8981\u91cb\u653e\u6240\u6709dhcp lease,\u53ef\u4f7f\u7528clear ip dhcp binding *&nbsp;<\/p>\n\n\n\n<p><strong>#show ip dhcp conflict<\/strong><br>\u7528\u4f86\u8a66\u5225\u662f\u5426\u6709ip\u885d\u7a81<br>\u756b\u9762\u5927\u81f4\u5982\u4e0b<br>IP address Detection method Detection time<br>172.16.1.5 Ping Aug 10 2013 8:56 PM<br>ps:<br>\u82e5\u8981\u6e05\u9664\u6240\u6709\u627e\u5230\u7684ip\u885d\u7a81,\u53ef\u4f7f\u7528clear ip dhcp conflict *<\/p>\n\n\n\n<p><strong>#show ip dhcp server statistics<\/strong><br>\u9a57\u8b49\u8def\u7531\u5668\u6240\u63a5\u6536\u548c\u9001\u51fa\u7684\u4e00\u4e9b\u8a0a\u606f\u6982\u6cc1,\u6703\u986f\u793a\u9001\u51fa\u548c\u63a5\u6536\u4e4bDHCP\u8a0a\u606f\u6578\u76ee\u7684\u4e00\u4e9b\u8cc7\u8a0a<\/p>\n\n\n\n<p>ps:<br>#show ip dhcp ?<br>database DHCP database agents<br>server Miscellaneous DHCP server information<br>conflict DHCP address conflicts<br>binding DHCP address bindings<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p>dhcp relay\u7684\u529f\u80fd<br>ip helper-address<br>\u53ef\u5c07\u91cd\u8981\u7684UTP\u670d\u52d9\u7684\u5ee3\u64ad\u8981\u6c42\u5f9e\u8def\u7531\u5668\u8f49\u9001\u51fa\u53bb<br>\u5167\u5b9a\u4e0aip helper-address\u547d\u4ee4\u53ef\u4ee5\u8f49\u50b3\u4e0b\u5217\u516b\u7a2eUTP\u670d\u52d9:<br>Time<br>TACACS<br>DNS<br>BOOTP\/DHCP Server<br>BOOTP\/DHCP Client<br>TFTP<br>NetBIOS Name Service<br>NetBIOS datagram Service<\/p>\n\n\n\n<p>\u8a2d\u5b9adhcp relay\u4ee5\u4f7f\u7528\u5916\u90e8dhcp server&nbsp;<br><strong>(config-if)# ip helper-address &lt; external dhcp ip&gt;<\/strong><br>\u8a72\u4ecb\u9762\u9808\u8981\u6709\u8a2d\u5b9aip,\u7528\u4f86\u63a5\u6536\u5916\u90e8dhcp\u7684\u8a0a\u606f<br>ip helper-address\u53ef\u4ee5\u8a2d\u5b9a\u591a\u7d44<br>ex:<br>\u5728vlan5\u4f7f\u7528192.168.199.4\u7684\u5916\u90e8dhcp\u914dip&nbsp;<br>(config)# interface vlan5<br>(config-if)# ip address 192.168.1.1 255.255.255.0<br>(config-if)# ip helper-address 192.168.199.4&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u555f\u52d5dhcp\u529f\u80fd(config)#[no] server d &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[32],"tags":[],"class_list":["post-900","post","type-post","status-publish","format-standard","hentry","category-cisco-network"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=900"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/900\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}