对OSPF COST的理解

  今天在做实验的时候发现一个问题:在进程1中引入直连type1,并在引入时改COST值,再在另一台路由器上的进程10中引入进程1的路由,并且是type1 ,这时在进程十中并没有最初引入的那个cost值,所以引发了对这个问题的思考,作了如下的实验:

 

   R1-S0/6/0--------S0/6/0-R2-S0/6/1--------S0/6/1-R4

 

R1与R2在ospf 1 area 0      R2和R4在OSPF 10  area 0

 思路:在R1上引入直连,在R2上查看同一进程,同一区域下引入路由的COST

       在R2上引入OSPF 1 ,在R4上查看另一进程area0下最初引入直连那个网段的COST

 

引入直连和OSPF 10引入进程时又有三种方式:直接引入,引入后加入type 1(默认是type 2,他们的区别是type 2 把AS内的cost忽略不计)

 

结论1:

 

注:上表中二列三行更改为1563,做excel表时出错。

 

结论2:

 

 

结论三,跨进程后把外部来的路由全部看成是cost 为1,不管你最初有没有作cost的更改。

 

完整配置(用的是H3C模拟器,与真机相差无机):

R1:

 

#

 version 5.20, Alpha 1011

#

 sysname R1

#

 password-control login-attempt 3 exceed lock-time 120

#

 undo voice vlan mac-address 00e0-bb00-0000

#

 ipsec cpu-backup enable

#

 undo cryptoengine enable

#

 domain default enable system

#

vlan 1

#

domain system

 access-limit disable

 state active

 idle-cut disable

 self-service-url disable

#

acl number 2000 

 rule 0 permit source 192.168.1.0 0.0.0.255

acl number 2001

 rule 0 permit source 172.16.1.0 0.0.0.255

#

interface Serial0/6/0

 link-protocol ppp

 ip address 10.1.1.1 255.255.255.0

#

interface Serial0/6/1

 link-protocol ppp

#

interface Serial0/6/2

 link-protocol ppp

#

interface Serial0/6/3

 link-protocol ppp

#

interface NULL0

#

interface LoopBack0

 ip address 192.168.1.1 255.255.255.255

#

interface LoopBack1

 ip address 172.16.1.1 255.255.255.255

#

interface Ethernet0/4/0

 port link-mode bridge

#

interface Ethernet0/4/1

 port link-mode bridge

#

interface Ethernet0/4/2

 port link-mode bridge

#

interface Ethernet0/4/3

 port link-mode bridge

#

interface Ethernet0/4/4

 port link-mode bridge

#

interface Ethernet0/4/5

 port link-mode bridge

#

interface Ethernet0/4/6

 port link-mode bridge

#               

interface Ethernet0/4/7

 port link-mode bridge

#

ospf 1

 import-route direct type 1 route-policy test

 area 0.0.0.0

  network 10.1.1.0 0.0.0.255

#

route-policy test permit node 10

 if-match acl 2000

 apply cost 1000

route-policy test permit node 20

 if-match acl 2001

 apply cost 500

#

 load xml-configuration

#

user-interface con 0

user-interface vty 0 4

#

return

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

R2:

version 5.20, Alpha 1011

#

 sysname R2

#

 password-control login-attempt 3 exceed lock-time 120

#

 undo voice vlan mac-address 00e0-bb00-0000

#

 ipsec cpu-backup enable

#

 undo cryptoengine enable

#

 domain default enable system

#

vlan 1

#

domain system

 access-limit disable

 state active

 idle-cut disable

 self-service-url disable

#

acl number 2000 

 rule 0 permit source 192.168.1.0 0.0.0.255

acl number 2001

 rule 0 permit source 172.16.1.0 0.0.0.255

#

interface Serial0/6/0

 link-protocol ppp

 ip address 10.1.1.2 255.255.255.0

#

interface Serial0/6/1

 link-protocol ppp

 ip address 10.1.2.1 255.255.255.0

#

interface Serial0/6/2

 link-protocol ppp

#

interface Serial0/6/3

 link-protocol ppp

#

interface NULL0

#

interface Ethernet0/4/0

 port link-mode bridge

#               

interface Ethernet0/4/1

 port link-mode bridge

#

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

R4:

 

 

 sysname R4

#

 password-control login-attempt 3 exceed lock-time 120

#

 undo voice vlan mac-address 00e0-bb00-0000

#

 ipsec cpu-backup enable

#

 undo cryptoengine enable

#

 domain default enable system

#

vlan 1

#

domain system

 access-limit disable

 state active

 idle-cut disable

 self-service-url disable

#

interface Serial0/6/0

 link-protocol ppp

#

interface Serial0/6/1

 link-protocol ppp

 ip address 10.1.2.2 255.255.255.0

#

interface Serial0/6/2

 link-protocol ppp

#

interface Serial0/6/3

 link-protocol ppp

#

interface NULL0

#

interface LoopBack0

 ip address 192.168.2.1 255.255.255.255

#

interface LoopBack1

 ip address 172.16.2.1 255.255.255.255

#

interface Ethernet0/4/0

 port link-mode bridge

#               

interface Ethernet0/4/1

 port link-mode bridge

#

interface Ethernet0/4/2

 port link-mode bridge

#

interface Ethernet0/4/3

 port link-mode bridge

#

interface Ethernet0/4/4

 port link-mode bridge

#

interface Ethernet0/4/5

 port link-mode bridge

#

interface Ethernet0/4/6

 port link-mode bridge

#

interface Ethernet0/4/7

 port link-mode bridge

#

ospf 10

 area 0.0.0.0   

  network 10.1.2.0 0.0.0.255

#

 load xml-configuration

#

user-interface con 0

user-interface vty 0 4

#

return

 

 

 

 

 

本文出自 “IT正能量” 博客,转载请与作者联系!

你可能感兴趣的:(cost,cost,ospf,ospf)