2010-10-29_152954

 

p_w_picpath 

需求:

让R1到达3.3.3.0网络优选R2到达

配置:

R1

interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 13.1.1.1 255.255.255.0
ip ospf network broadcast
duplex half
!
interface Serial1/0
ip address 12.1.1.1 255.255.255.0
ip ospf network broadcast
serial restart-delay 0
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 0
network 12.1.1.1 0.0.0.0 area 0
network 13.1.1.1 0.0.0.0 area
line con 0
exec-timeout 0 0
password console
logging synchronous
login
line aux 0
line vty 0 4

R2

interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 12.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 23.1.1.1 255.255.255.0
serial restart-delay 0

router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
 network 12.1.1.1 0.0.0.0 area 0
network 12.1.1.2 0.0.0.0 area 0
network 23.1.1.1 0.0.0.0 area 0

R3

interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
ip address 13.1.1.2 255.255.255.0
duplex half
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
serial restart-delay 0

router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
 network 13.1.1.1 0.0.0.0 area 0
network 13.1.1.2 0.0.0.0 area 0
network 23.1.1.2 0.0.0.0 area 0

验证配置;

R1#show ip 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       2.2.2.2 [110/65] via 12.1.1.2, 00:36:26, Serial1/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 13.1.1.2, 00:36:26, FastEthernet0/0
     23.0.0.0/24 is subnetted, 1 subnets
O       23.1.1.0 [110/65] via 13.1.1.2, 00:36:26, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial1/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, FastEthernet0/0

p_w_picpath

R1选择以太网接口直接到达R3的3.3.3.0网络,因为这条路径的COST(度量值)最低,如果选择R2到达R3,COST是129(64+64+1)

那为什么以太网接口的连得路径度量值是2。是这样的吗(1+1),环回接口的链路度量值是1

修改R1和R2接口的OSPF度量值

R1(config)#int s1/0
R1(config-if)#ip ospf cost 1

R2(config)#int s1/1
R2(config-if)#ip ospf cost 1

再次查看R1路由表

R1#show ip 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       2.2.2.2 [110/2] via 12.1.1.2, 00:00:07, Serial1/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/66] via 12.1.1.2, 00:00:07, Serial1/0
     23.0.0.0/24 is subnetted, 1 subnets
O       23.1.1.0 [110/65] via 12.1.1.2, 00:00:07, Serial1/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial1/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, FastEthernet0/0

p_w_picpath

p_w_picpath

这一步中因为度量值两条路径是一样的都是2—实验测试中(我也纳闷),路由表中任然是显示以太网接口的路径,后来我就改变R1和R3以太网接口

 

的度量值,结果才显示路径选取走R2到达3.3.3.0网段。但是这个度量值为什么是66,我又闷啊啊?????

R1#traceroute 3.3.3.3

Type escape sequence to abort.
Tracing the route to 3.3.3.3

  1 12.1.1.2 20 msec 64 msec 80 msec
  2 23.1.1.2 92 msec 96 msec *

总结与思考:

本实验收获:

1.ospf中不能宣告空接口,如:

network 12.1.1.1 0.0.0.0 area 0
network 12.1.1.2 0.0.0.0 area 0

我根本就没有配置12.1.1.1 的接口,这样宣告不会找到邻居的当然邻居路由表中是不会有到你的ospf路由表,本实验中因为R2和R3这样宣告空接口,致使邻居R1上没有ospf的路由表

2.为什么各个路由器的Id的Ip地址非直连的都是以32位的显示在路由表中,而我的掩码是24位

Router-id是以IPv4的形式定义的 本地有效,环回口不管你怎样配置 都是以32位显示在路由表里的

3,当修改后不起作用时,可更改以前路径上的路由器接口的度量值,如上,但是这个度量值的计算不明白??

4。ospfCOST修改的三种方法:a.修改接口带宽,b,接口下IP ospf cost  (1-65535)命令,c.参考带宽 auto-cost reference-bandwidth ref-bw(以Mbits为单位的参考带宽,取值为1-4294967,默认为100)