OSPF 多链路分流实验

cisco ospf的多链路分流实验_多链路分流

 R1:

interface Loopback0
 ip address 1.1.1.1 255.255.255.0
interface Serial0/0
 ip address 172.16.1.1 255.255.255.252
 serial restart-delay 0
interface Serial0/1
 ip address 172.16.1.5 255.255.255.252
 serial restart-delay 0
router ospf 10
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.1.0 0.0.0.255 area 1
 network 172.16.1.0 0.0.0.3 area 0
 network 172.16.1.4 0.0.0.3 area 0
end
 
R2:
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
interface Loopback1
 ip address 4.4.4.4 255.255.255.0 
interface Loopback2
 ip address 3.3.3.3 255.255.255.0       
interface Serial0/0
 ip address 172.16.1.2 255.255.255.252
 serial restart-delay 0
interface Serial0/1
 ip address 172.16.1.6 255.255.255.252
 serial restart-delay 0
router ospf 10
 router-id 3.3.3.3
 log-adjacency-changes
 network 2.2.2.0 0.0.0.255 area 2
 network 3.3.3.0 0.0.0.255 area 0
 network 4.4.4.0 0.0.0.255 area 4
 network 172.16.1.0 0.0.0.3 area 0
 network 172.16.1.4 0.0.0.3 area 0
end
 
测试R1、R2的邻接关系和路由表:
R1:
R1#show ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  -        00:00:38    172.16.1.6      Serial0/1
3.3.3.3           0   FULL/  -        00:00:37    172.16.1.2      Serial0/0
R1#show ip route         
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/65] via 172.16.1.6, 00:02:03, Serial0/1
                [110/65] via 172.16.1.2, 00:02:03, Serial0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/65] via 172.16.1.6, 00:02:03, Serial0/1
                [110/65] via 172.16.1.2, 00:02:03, Serial0/0
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/65] via 172.16.1.6, 00:00:23, Serial0/1
                [110/65] via 172.16.1.2, 00:00:26, Serial0/0
     172.16.0.0/30 is subnetted, 2 subnets
C       172.16.1.4 is directly connected, Serial0/1
C       172.16.1.0 is directly connected, Serial0/0
 
R2:
R2#show ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           0   FULL/  -        00:00:30    172.16.1.5      Serial0/1
1.1.1.1           0   FULL/  -        00:00:39    172.16.1.1      Serial0/0
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
     1.0.0.0/32 is subnetted, 1 subnets
O IA    1.1.1.1 [110/65] via 172.16.1.5, 00:08:29, Serial0/1
                [110/65] via 172.16.1.1, 00:08:29, Serial0/0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback2
     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback1
     172.16.0.0/30 is subnetted, 2 subnets
C       172.16.1.4 is directly connected, Serial0/1
C       172.16.1.0 is directly connected, Serial0/0
 
配置多链路分流,让R2的2.2.2.0/24走S0/0,让R2的4.4.4.4/24走S0/1。
access-list 1 deny   3.3.3.0 0.0.0.255
access-list 1 deny   4.4.4.0 0.0.0.255
access-list 1 permit any
access-list 2 deny   2.2.2.0 0.0.0.255
access-list 2 deny   3.3.3.0 0.0.0.255
access-list 2 permit any
router ospf 10
router-id 1.1.1.1
distribute-list 1 in Serial0/0
distribute-list 2 in Serial0/1
 
查看分流后的效果:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/65] via 172.16.1.2, 00:00:20, Serial0/0
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/65] via 172.16.1.6, 00:00:20, Serial0/1
     172.16.0.0/30 is subnetted, 2 subnets
C       172.16.1.4 is directly connected, Serial0/1
C       172.16.1.0 is directly connected, Serial0/0