The topology diagram is as follows:
650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M01/9D/77/wKiom1mAbhHgLT-uAABkvE_XhAg204.jpg "title=" 1.jpg "alt=" Wkiom1mabhhglt-uaabkve_xhag204.jpg "/>
Description of the above equipment use:
1, using R1 to do DHCP server
2, use R2 and R3 instead of computer to do DHCP client
3, SW1 used as a fool switch.
DHCP server configuration (R1 configuration):
r1#disable############ #使用 disable Command exit privileged mode r1>r1>enable ############ #使用 enable command to enter privileged mode r1#show privilege current privilege level is 15####### ##### #查看特权模式的级别 ############# into configuration mode r1#configure terminal enter configuration commands , one per line. end with cntl/z.r1 (config) #exit ############ #查看接口状态R1 #show ip interface briefInterface IP-Address OK? Method status protocolfastethernet0/0 unassigned YES unset administratively down down fastethernet0/1 unassigned yes unset administratively down down serial1/0 Unassigned yes unset administratively down down Serial1/1 unassigned YES unset administratively down down serial1/2 unassigned yes unset administratively down down serial1/3 unassigned YES unset administratively down down R1#configure Terminal enter configuration commands, one per line. end with cntl/z.############ #进入接口进行配置R1 (config) #int fastethernet 0/0r1 (config-if) #no shutdown  R1 (config-if) #*aug 1 19:39:28.523: %link-3-updown: interface fastethernet0/0, changed state to up*aug 1 19:39:29.523: % lineproto-5-updown: line protocol on interface fastethernet0/0, changed STATE TO UPR1 (config-if) #ip address 123.1.1.1 255.255.255.0r1 (config-if) #R1 (config-if ) ############# #在配置模式中查看接口状态需要加 do prefix R1 (config-if) #do show ip interface briefinterface ip-address OK? Method Status ProtocolFastEthernet0/0 123.1.1.1 YES manual up up FastEthernet0/1 unassigned YES unset administratively down down serial1/0 unassigned YES unset Administratively down down serial1/1 unassigned YES unset administratively down down Serial1/2 unassigned YES unset administratively down down serial1/3 unassigned yes unset administratively down  DOWN    R1 (config-if) ############# #也可使用 end Command exit configuration mode R1 (config-if) #endR1 #r1 #*aug 1 19:43:17.991: %sys-5-config_i: configured from console by consoler1#r1#configure terminal enter configuration commands, one per line. end with cntl/z.############ #开启dhcp server function R1 (config) #service dhcpr1 (config) #ip dhcp pool  R123R1 (dhcp-config) #network 123.1.1.0 255.255.255.0############ #将客户端的网关指向 dhcp server interface IPR1 (dhcp-config) #default-router 123.1.1.1############ #将客户端的DNS指向 dhcp server Interface IPR1 (dhcp-config) #dns-server 123.1.1.1############ #设置租期为1天0时1分R1 (dhcp-config) #lease 1 0 1############ #配置域名为cisco. comR1 (dhcp-config) #domain-name cisco.comr1 (dhcp-config) #
DHCP client configuration (R2 and R3 configuration):
r2#configure terminal enter configuration commands, one per line. end with cntl/z.############ #禁用ip routing routing forwarding, simulating the router to PcR2 (config) #no ip Routing r2 (config) #int fastethernet 0/0 r2 (config-if) #no shutdownr2 (config-if) #*Aug 1 19:07:41.279: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed State to up*aug 1 19:07:42.279: %lineproto-5-updown: line protocol on interface fastethernet0/0, changed state to up############ #开启dhcp动态获取R2 (config-if) #ip address dhcpr2 (config-if) #*aug 1 19:11:47.891: %dhcp-6-address_ Assign: interface fastethernet0/0 assigned dhcp address 123.1.1.2, mask  255.255.255.0, HOSTNAME R2R2 (config-if) #end ############ #查看接口状态R2 #show ip interface briefinterface &Nbsp; ip-address OK? Method Status ProtocolFastEthernet0/0 123.1.1.2 yes dhcp up up FastEthernet0/1 unassigned yes unset administratively down down Serial1/0 unassigned yes unset administratively down down serial1/1 unassigned YES unset administratively down down serial1/2 unassigned yes unset administratively down down Serial1/3 unassigned YES unset administratively down down r2############# #查看单独接口状态R2 #show Running-config interface fastethernet 0/0building configuration ... Current configuration : 94 bytes!interfacE fastethernet0/0 ip address dhcp no ip route-cache duplex auto speed autoend
This article is from the "Gan mu" blog, please be sure to keep this source http://ganmu.blog.51cto.com/9305511/1952781
Cisco switch turns on DHCP service