路由器配置——DHCP+DHCP中继服务配置

一、实验目的:掌握DHCP服务基本配置及DHCP中继服务配置,实现全网互通

二、拓扑图:

三、具体步骤配置:

(1)R1路由器配置:

Router>enable  --进入特权模式

Router#configure terminal  --进入全局配置模式

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#hostname R1  --修改路由器名为R1

R1(config)#interface f0/0  --进入端口

R1(config-if)#ip address 192.168.11.1 255.255.255.0  --为端口配置ip地址

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  --为端口配置ip地址

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  --开启dhcp服务

R1(config)#ip dhcp pool 1  --定义地址池

R1(dhcp-config)#network 192.168.11.0 255.255.255.0  --DHCP服务器要分配的网络和掩码

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  --DHCP服务器要分配的网络和掩码

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  --DHCP服务器要分配的网络和掩码

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  --开启rip协议

R1(config-router)#version 2  --版本2

R1(config-router)#no auto-summary  --关闭路由自动汇总

R1(config-router)#network 192.168.12.0  --添加直连网段到rip

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

R2(config)#interface f0/0  --进入端口

R2(config-if)#ip address 192.168.22.1 255.255.255.0  --为端口配置ip地址

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  --为端口配置ip地址

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  --为端口配置ip地址

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  --开启rip协议

R2(config-router)#version 2  --版本2

R2(config-router)#no auto-summary  --关闭路由自动汇总

R2(config-router)#network 192.168.12.0  --添加直连网段到rip

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

R3(config)#interface f0/0  --进入端口

R3(config-if)#ip address 192.168.33.1 255.255.255.0  --为端口配置ip地址

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  --为端口配置ip地址

R3(config-if)#no shutdown  --激活端口

R3(config-if)#exit  --返回上一级

R3(config)#route rip  --开启rip协议

R3(config-router)#version 2  --版本2

R3(config-router)#no auto-summary  --关闭自动路由汇总

R3(config-router)#network 192.168.24.0  --添加直连网段到rip

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)PC1PC2

 

(2)PC2PC3

 

 

(3)PC3PC1

结果:全网互通成功

posted @ 2018-07-04 17:24  Stalk  阅读(18305)  评论(0编辑  收藏  举报