天天看点

OSPF default-metric cost 命令实现细节

default-metric cost

结论:

1>除BGP重分布后metric为1,其它路由协议都默认为20。

2>default-metric cost命令影响所有路由协议重分布过来的metric,包括静态路由。

3>直连路由不受default-metric cost命令影响。

3>所有路由(静态、动态、直连)都受redistribute metric影响。

OSPF default-metric cost 命令实现细节

r1#sh run

Building configuration...

Current configuration : 1024 bytes

!

interface Serial1/0

description conn_to_r2_s1/0_192.168.1.2

ip address 192.168.1.1 255.255.255.0

serial restart-delay 0

router ospf 100

router-id 10.0.0.1

log-adjacency-changes

network 192.168.1.0 0.0.0.255 area 0

---------------------------------------------

r2#sh run

Current configuration : 1393 bytes

interface Loopback0

ip address 1.1.1.1 255.255.255.0

ip ospf network point-to-point

interface FastEthernet0/0

ip address 2.2.2.2 255.255.255.0

duplex auto

speed auto

description conn_to_r1_s1/0_192.168.1.1

ip address 192.168.1.2 255.255.255.0

interface Serial1/1

description conn_to_r3_s1/0_192.168.2.2

ip address 192.168.2.1 255.255.255.0

router-id 10.0.0.2

redistribute connected metric 33 subnets

redistribute static subnets

redistribute rip subnets

default-metric 7

router rip

version 2

network 192.168.2.0

no auto-summary

ip route 3.3.3.0 255.255.255.0 Serial1/1

-----------------------------------------------

r3#sh run

Current configuration : 1299 bytes

ip address 5.5.5.5 255.255.255.0

interface Loopback1

ip address 6.6.6.6 255.255.255.0

interface Loopback81

ip address 3.3.3.3 255.255.255.0

description conn_to_r2_s1/1_192.168.2.1

ip address 192.168.2.2 255.255.255.0

no dce-terminal-timing-enable

network 5.0.0.0

network 6.0.0.0

----------------------------------------------------

r1#sh 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

O E2    1.1.1.0 [110/33] via 192.168.1.2, 00:15:37, Serial1/0

     2.0.0.0/24 is subnetted, 1 subnets

O E2    2.2.2.0 [110/33] via 192.168.1.2, 00:15:37, Serial1/0

     3.0.0.0/24 is subnetted, 1 subnets

//直连路由

O E2    3.3.3.0 [110/7] via 192.168.1.2, 00:12:03, Serial1/0

     5.0.0.0/24 is subnetted, 1 subnets

//静态路由

O E2    5.5.5.0 [110/7] via 192.168.1.2, 00:12:03, Serial1/0

     6.0.0.0/24 is subnetted, 1 subnets

O E2    6.6.6.0 [110/7] via 192.168.1.2, 00:12:03, Serial1/0

C    192.168.1.0/24 is directly connected, Serial1/0

//动态路由

O E2 192.168.2.0/24 [110/33] via 192.168.1.2, 00:15:37, Serial1/0

继续阅读