cisco_ospf路由重分布和虚链路的配置

时间:2024-03-10 08:49:15

需求:

1、R1、R2、R3、R4的f0/0接口分别配置100.1.1.1-4并启动ospf路由协议加入area 0

2、R1、R2、R3、R4分别配置回环接口1.1.1.1、2.2.2.2、3.3.3.3、4.4.4.4;分别加入area 1、area 2、area 3、area 4

3、R2的f0/1和R5的f0/0接口改为p2p,不选举DR/BDR

4、R5和R6上配置rip协议,在R5上配置路由重分布

5、在R3和R7上配置静态路由,在R3上配置路由重分布

6、在R4和R8之间配置虚链路,使R9可以学习area 0里的路由

拓扑:

 

配置:

R1的配置:

interface loopback 0
ip address 1.1.1.1 255.255.255.255
interface f0/0
ip address 100.1.1.1 255.255.255.0
no shutdown
router ospf 1
router-id 1.1.1.1
network 100.1.1.0 0.0.0.255  area 0
network 1.1.1.1 0.0.0.0 area 1

R2的配置:

interface loopback 0
ip address 2.2.2.2 255.255.255.255
interface f0/0
ip address 100.1.1.2 255.255.255.0
no shutdown

interface f0/1
ip address 25.1.1.2 255.255.255.0
no shutdown
ip ospf network point-to-point  #更改接口为p2p模式

router ospf 1 
router-id 2.2.2.2 
network 100.1.1.0 0.0.0.255 area 0 
network 2.2.2.2 0.0.0.0 area 2
network 25.1.1.0 0.0.0.255  area 2

R3的配置:

interface loopback 0
ip address 3.3.3.3 255.255.255.255
interface f0/0
ip address 100.1.1.3 255.255.255.0
no shutdown
interface f0/1
ip address 37.1.1.3 255.255.255.0 
no shutdown
router ospf 1
router-id 3.3.3.3
network 100.1.1.0 0.0.0.255  area 0
network 3.3.3.3 0.0.0.0 area 3

ip route 7.7.7.7 255.255.255.255 37.1.1.7  #配置静态路由

router ospf 1
redistribute static subnets metric 1      #将静态路由重分布到ospf里
redistribute connected subnets          #将直连路由重分布到ospf里

R4的配置:

interface loopback 0
ip address 4.4.4.4 255.255.255.255
interface f0/0
ip address 100.1.1.4 255.255.255.0
no shutdown
interface f0/1
ip address 48.1.1.4 255.255.255.0 
no shutdown
router ospf 1
router-id 4.4.4.4
network 100.1.1.0 0.0.0.255  area 0
network 4.4.4.4 0.0.0.0 area 4
network 48.1.1.0 0.0.0.255 area 4
area 4 virtual-link 8.8.8.8        #配置虚链路

R5的配置:

interface loopback 0
ip address 5.5.5.5 255.255.255.255
interface f0/0
ip address 25.1.1.5 255.255.255.0
no shutdown
ip ospf network point-to-point      #更改接口为p2p模式

interface f0/1
ip address 56.1.1.5 255.255.255.0
no shutdown

router ospf 1
router-id 5.5.5.5
network 25.1.1.0 0.0.0.255  area 2

router rip
version 2
no auto-summary
network 5.5.5.5
network 56.1.1.0

redistribute ospf 1 subnets metric 3      #将ospf重分布到rip里

router ospf 1
redistribute rip subnets metric 100  #将rip重分布到ospf里 

R6的配置:

interface loopback 0
ip address 6.6.6.6 255.255.255.255
interface f0/0
ip address 56.1.1.6 255.255.255.0
no shutdown

router rip
version 2
no auto-summary
network 6.6.6.6 network 56.1.1.0

 R7的配置:

interface loopback 0
ip address 7.7.7.7 255.255.255.255
interface f0/0
ip address 37.1.1.7 255.255.255.0 
no shutdown
ip route 0.0.0.0 0.0.0.0 37.1.1.3   #配置静态路由

 R8的配置:

interface loopback 0
ip address 8.8.8.8 255.255.255.255
interface f0/0
ip address 48.1.1.8 255.255.255.0 
no shutdown
interface f0/1
ip address 89.1.1.8 255.255.255.0 
no shutdown
router ospf 1
router-id 8.8.8.8
network 8.8.8.8 0.0.0.0 area 4
network 48.1.1.0 0.0.0.255 area 4
network 89.1.1.0 0.0.0.255 area 5
area 4 virtual-link 4.4.4.4      #配置虚链路 virtual-link为对端路由器的route-id

R9的配置:

interface loopback 0
ip address 9.9.9.9 255.255.255.255
interface f0/0
ip address 89.1.1.9 255.255.255.0 
no shutdown
router ospf 1
router-id 9.9.9.9
network 9.9.9.9 0.0.0.0 area 5
network 89.1.1.0 0.0.0.255 area 5