思科 华为 路由重发布
网络拓扑图如下:
R1 的配置
R1(config)#int e0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#int s1/0
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#router rip
R1(config-router)#netw 192.168.1.0
R1(config-router)#netw 192.168.2.0
R1(config-router)#exit
R1(config)#exit
R1#show ip rout
R2的配置
R2(config)#int s0/0
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shu
R2(config-if)#int s0/1
R2(config-if)#ip add 192.168.3.1 255.255.255.0
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#network 192.168.2.0
R2(config-router)#redistribute ospf 1 met 1
R2(config-router)#redistribute connected
R2(config)#router ospf 1
R2(config-router)#network 192.168.3.0 0.0.0.255 area 0
R2(config)#router ospf 1
R2(config-router)#re
R2(config-router)#redistribute rip
% Only classful networks will be redistributed
R2(config-router)#redistribute connected
R3的配置
R3(config-if)#ip add 192.168.4.2 255.255.255.0
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 192.168.3.0 0.0.0.255 area 0
R3(config-router)#network 192.168.4.0 0.0.0.255 area 0
华为 在ensp 模拟上与实际做的命令不太相同 配置ospf 很大都是不同
对于R1配置
[R1]rip
[R1-rip-1]un sum
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.2.0
[R1-Ethernet0/0/0]ip add 192.168.1.1 24
hernet0/0/0]rip ver 2
[R1-rip-1]int s0/0/0
[R1-Serial0/0/0]rip ver 2
[R1-Serial0/0/0]ip add 192.168.2.1 24
[R1-Serial0/0/0]sh
[R1-Serial0/0/0]un sh
[R1]dis ip rout
对于R2配置
[R2]rip
[R2-rip-1]netw 192.168.2.0
[R2-rip-1]im ospf 1
[R2]int s0/0/0
[R2-Serial0/0/0]ip add 192.168.2.2 24
[R2-Serial0/0/0]rip ver 2
[R2-Serial0/0/0]sh
[R2-Serial0/0/0]un sh
[R2]rip
[R2-rip-1]netw 192.168.2.0
[R2-rip-1]import ospf 1
[R2-rip-1]int s0/0/1
int s0/0/1
[R2-Serial0/0/1]ip add 192.168.3.1 24
[R2]ospf
[R2-ospf-1]import-route rip
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]netw 192.168.3.0 0.0.0.255
对于R3
[R3]int s0/0/0
int s0/0/0
[R3-Serial0/0/0]ip add 192.168.3.2 24
[R3-Serial0/0/0]sh
[R3-Serial0/0/0]un sh
[R3-Ethernet0/0/0]ip add 192.168.4.1 24
[R3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
#有点像三层交换机
验证:
R1上
注:实际的华为设备ospf协议命令如下:
[Huawei]int s0/0/0
[Aweigh-Serial0/0/0]ospf enable area 0
进入端口配置协议