OSPF COST路由选择

Router#sh ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 12.12.12.2, 00:06:44, Ethernet0/0
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 12.12.12.0/24 is directly connected, Ethernet0/0
L 12.12.12.1/32 is directly connected, Ethernet0/0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 13.13.13.0/24 is directly connected, Ethernet0/1
L 13.13.13.1/32 is directly connected, Ethernet0/1
23.0.0.0/24 is subnetted, 1 subnets
O 23.23.23.0 [110/20] via 13.13.13.3, 00:04:52, Ethernet0/1
[110/20] via 12.12.12.2, 00:05:42, Ethernet0/0

Router#sh ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 1 0 1.1.1.1/32 1 LOOP 0/0
Et0/1 1 0 13.13.13.1/24 10 BDR 1/1
Et0/0 1 0 12.12.12.1/24 10 BDR 1/1
Router#

测试一、R2和R3接口默认Cost值为10,接下来我们通过调整cost值,影响R1选路:
R1(config)#interface e0/0
R1(config-if)#ip ospf cost 100
R1(config-if)#int e0/1
R1(config-if)#ip ospf cost 110
R1#sh ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/101] via 12.12.12.2, 00:00:01, Ethernet0/0
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 12.12.12.0/24 is directly connected, Ethernet0/0
L 12.12.12.1/32 is directly connected, Ethernet0/0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 13.13.13.0/24 is directly connected, Ethernet0/1
L 13.13.13.1/32 is directly connected, Ethernet0/1
23.0.0.0/24 is subnetted, 1 subnets
O 23.23.23.0 [110/110] via 12.12.12.2, 00:00:01, Ethernet0/0
R1 e0/0 为100 + R2 e0/0 为10 = 110,去往13.13.13.3 R1 e0/1 为110 + R2 e0/1 为10 = 120,所选择较小的12.12.12.2方向。

测试二、我们将R2和R3COST值调整下,去往23.23.23.0方向接口修改COST值,看好是去的方向。

R2(config)#interface e0/1
R2(config-if)#ip ospf cost 1010
R3(config)#interface e0/0
R3(config-if)#ip ospf cost 1000
看下R1的路由情况:
R1#sh ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/101] via 12.12.12.2, 00:12:20, Ethernet0/0
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 12.12.12.0/24 is directly connected, Ethernet0/0
L 12.12.12.1/32 is directly connected, Ethernet0/0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 13.13.13.0/24 is directly connected, Ethernet0/1
L 13.13.13.1/32 is directly connected, Ethernet0/1
23.0.0.0/24 is subnetted, 1 subnets
O 23.23.23.0 [110/1110] via 13.13.13.3, 00:00:08, Ethernet0/1
[110/1110] via 12.12.12.2, 00:00:08, Ethernet0/0
R1 e0/0 为100 + R2 e0/0 为1010 = 1110,去往13.13.13.3 R1 e0/1 为110 + R2 e0/1 为1000 = 1110

Router#sh ip ospf database router

        OSPF Router with ID (1.1.1.1) (Process ID 1)

            Router Link States (Area 0)

LS age: 260
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 80000008
Checksum: 0x888
Length: 60
Number of Links: 3

Link connected to: a Stub Network
 (Link ID) Network/subnet number: 1.1.1.1
 (Link Data) Network Mask: 255.255.255.255
  Number of MTID metrics: 0
   TOS 0 Metrics: 1

Link connected to: a Transit Network
 (Link ID) Designated Router address: 13.13.13.3
 (Link Data) Router Interface address: 13.13.13.1
  Number of MTID metrics: 0
   TOS 0 Metrics: 110

Link connected to: a Transit Network
 (Link ID) Designated Router address: 12.12.12.2
 (Link Data) Router Interface address: 12.12.12.1
  Number of MTID metrics: 0
   TOS 0 Metrics: 100

LS age: 1583
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 12.12.12.2
Advertising Router: 12.12.12.2
LS Seq Number: 80000006
Checksum: 0x1DD
Length: 60
Number of Links: 3

Link connected to: a Stub Network
 (Link ID) Network/subnet number: 2.2.2.2
 (Link Data) Network Mask: 255.255.255.255
  Number of MTID metrics: 0
   TOS 0 Metrics: 1

Link connected to: a Transit Network
 (Link ID) Designated Router address: 23.23.23.3
 (Link Data) Router Interface address: 23.23.23.2
  Number of MTID metrics: 0
   TOS 0 Metrics: 1010

Link connected to: a Transit Network
 (Link ID) Designated Router address: 12.12.12.2
 (Link Data) Router Interface address: 12.12.12.2
  Number of MTID metrics: 0
   TOS 0 Metrics: 10

LS age: 1529
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 23.23.23.3
Advertising Router: 23.23.23.3
LS Seq Number: 80000005
Checksum: 0xB302
Length: 48
Number of Links: 2

Link connected to: a Transit Network
 (Link ID) Designated Router address: 13.13.13.3
 (Link Data) Router Interface address: 13.13.13.3
  Number of MTID metrics: 0
   TOS 0 Metrics: 10

Link connected to: a Transit Network
 (Link ID) Designated Router address: 23.23.23.3
 (Link Data) Router Interface address: 23.23.23.3
  Number of MTID metrics: 0
   TOS 0 Metrics: 1000

Router#

上一篇:zookeeper not connected


下一篇:数据结构期末 图