R1
[R1]ospf router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]dis this
#
area 0.0.0.0
network 10.0.1.0 0.0.0.255
network 10.0.10.0 0.0.0.255
#
return
R2
[R2]ospf router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]dis this
#
area 0.0.0.0
network 10.0.12.0 0.0.0.255
network 10.0.2.0 0.0.0.255
#
return
R3
[R3]ospf router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]dis this
#
area 0.0.0.0
network 10.0.10.0 0.0.0.255
#
return
R5
[R5]ospf router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]dis this
#
area 0.0.0.0
network 10.0.10.0 0.0.0.255
network 10.0.12.0 0.0.0.255
#
return
R3
[R3-ospf-1-area-0.0.0.0]area 1
[R3-ospf-1-area-0.0.0.1]dis this
#
area 0.0.0.1
network 10.0.14.0 0.0.0.255
#
return
R4
[R4]ospf router-id 4.4.4.4
[R4-ospf-1]area 1
[R4-ospf-1-area-0.0.0.1]dis this
#
area 0.0.0.1
network 10.0.3.0 0.0.0.255
network 10.0.14.0 0.0.0.255
#
return
rip只能宣告标准的ABC类地址
R3
[R3-rip-1]dis this
#
rip 1
version 2
network 10.0.0.0
#
return
R6
[R6-rip-1]dis this
#
rip 1
version 2
network 10.0.0.0
network 40.0.0.0
#
return
R3
[R3-ospf-1]import-route rip 1
[R3-rip-1]import-route ospf 1
现在PC1,2,3,4可以互相ping通
让PC1去ping
在S 0/0/0端口上
[R4-Serial0/0/0]ospf authentication-mode simple cipher hongwei
(ospf authentication-mode md5 1 cipher hongwei)
[R3-Serial0/0/0]ospf authentication-mode simple cipher hongwei
[R1-ospf-1-area-0.0.0.0]authentication-mode simple plain hongwei1
[R2-ospf-1-area-0.0.0.0]dis this
#
area 0.0.0.0
authentication-mode simple plain hongwei1
network 10.0.12.0 0.0.0.255
network 10.0.2.0 0.0.0.255
#
return
[R3-ospf-1-area-0.0.0.0]dis this
#
area 0.0.0.0
authentication-mode simple plain hongwei1
network 10.0.10.0 0.0.0.255
#
return
越大越优先(DR不支持抢占)
将连接R5端口默认优先级都改为100
[R5-GigabitEthernet0/0/0]ospf dr-priority 100
[R5-GigabitEthernet0/0/1]ospf dr-priority 100
将连接R5外面端口默认优先级都改为50
[R1-GigabitEthernet0/0/1]ospf dr-priority 50
[R3-GigabitEthernet0/0/0]ospf dr-priority 50
[R2-GigabitEthernet0/0/0]ospf dr-priority 50
在R1上设置静态路由(R1->R6->PC4),R6上面反之
[R1]ip route-static 40.0.4.0 24 10.0.11.2
目的网段+掩码+下一跳
[R6]ip route-static 10.0.1.0 24 10.0.11.1
在PC1上面tracert,知道路线为R1->R6->PC4
在R1上查看路由表,去往40.0.4.0网段是静态路线优先级为60,而引入的O_ASE优先级为150
现在只需要让引入的OSPF优先级比静态路线优先级高就可以(值越小越优先)
[R1]ip route-static 40.0.4.0 255.255.255.0 10.0.11.2 preference 200
现在可以看到去往10.0.4.0为引入的ospf
验证:
PC1
让R3的OSPF学习不到PC4的网段
[R6-rip-1]undo network 40.0.0.0