一、实验目的:掌握DHCP服务基本配置及DHCP中继服务配置,实现全网互通
二、拓扑图:
三、具体步骤配置:
(1)R1路由器配置:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.11.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface s0/0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
R1(config-if)#exit
R1(config)#service dhcp
R1(config)#ip dhcp pool 1
R1(dhcp-config)#network 192.168.11.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.11.1
R1(dhcp-config)#exit
R1(config)#ip dhcp pool 2
R1(dhcp-config)#network 192.168.22.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.22.1
R1(dhcp-config)#exit
R1(config)#ip dhcp pool 3
R1(dhcp-config)#network 192.168.33.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.33.1
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.11.1
R1(config)#ip dhcp excluded-address 192.168.22.1
R1(config)#ip dhcp excluded-address 192.168.33.1
R1(config)#route rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.12.0
R1(config-router)#network 192.168.11.0
R1(config-router)#network 192.168.22.0
R1(config-router)#network 192.168.33.0
R1(config-router)#end
R1#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
%SYS-5-CONFIG_I: Configured from console by console
R1#
R1#
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
(2)R2路由器配置:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#interface f0/0
R2(config-if)#ip address 192.168.22.1 255.255.255.0
R2(config-if)#ip helper-address 192.168.12.1
R2(config-if)#no shutdown
R2(config-if)#interface s0/0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface s0/0/1
R2(config-if)#ip address 192.168.24.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/1, changed state to down
R2(config-if)#exit
R2(config)#route rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.12.0
R2(config-router)#network 192.168.24.0
R2(config-router)#network 192.168.22.0
R2(config-router)#network
% Incomplete command.
R2(config-router)#end
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
%LINK-5-CHANGED: Interface Serial0/0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/1, changed state to up
(3)R3路由器配置:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R3
R3(config)#interface f0/0
R3(config-if)#ip address 192.168.33.1 255.255.255.0
R3(config-if)#ip helper-address 192.168.12.1
R3(config-if)#no shutdown
R3(config-if)#interface S0/0/0
R3(config-if)#ip address 192.168.24.1 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#route rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#network 192.168.24.0
R3(config-router)#network 192.168.33.0
R3(config-router)#network 192.168.12.0
R3(config-router)#end
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
R3#
%SYS-5-CONFIG_I: Configured from console by console
R3#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
四、验证测试:
1、打开各台虚拟机的DHCP功能查看是否接收到DHCP服务所分配的地址:
(1)PC1
(2)PC2
(3)PC3
分配地址成功
2、测试各台主机之间是否互通
(1)PC1与PC2
(2)PC2与PC3
(3)PC3与PC1
结果:全网互通成功