美文网首页路由交换CCNA网络运维
【实战演练】Packet Tracer玩转CCNA实验13-路由

【实战演练】Packet Tracer玩转CCNA实验13-路由

作者: 工程师Waiting | 来源:发表于2020-05-28 18:15 被阅读0次

本文欢迎转载,转载请注明出处和作者。

理论解释

AD值说完了,继续说说后面的Metric值

O 24.1.1.0 [110/128] via 12.1.1.2, 00:00:04, Serial2/0

Metric值,是用来同一个动态路由协议中,到同样一个目的网段的不同路由条目之间,来选择优选的链路的。

命令配置

拓扑图如下,注意R1与R3之间的链路,改为了网线(快速以太网链路)

1、预配置

R1:

en
conf t
host R1
int lo 0
ip add 1.1.1.1 255.255.255.0
no shut
int se2/0
ip add 12.1.1.1 255.255.255.0
clock rate 64000
no shut
int fa0/0
ip add 13.1.1.1 255.255.255.0
no shut

R2:

en
conf t
host R2
int lo 0
ip add 2.2.2.2 255.255.255.0
no shut
int se2/0
ip add 12.1.1.2 255.255.255.0
no shut
int se3/0
ip add 24.1.1.2 255.255.255.0
clock rate 64000
no shut

R3:

en
conf t
host R3
int lo 0
ip add 3.3.3.3 255.255.255.0
no shut
int fa0/0
ip add 13.1.1.3 255.255.255.0
no shut
int se2/0
ip add 34.1.1.3 255.255.255.0
clock rate 64000
no shut

R4:

en
conf t
host R4
int lo 0
ip add 4.4.4.4 255.255.255.0
no shut
int se2/0
ip add 24.1.1.4 255.255.255.0
no shut
int se3/0
ip add 34.1.1.4 255.255.255.0
no shut
int fa0/0
ip add 192.168.1.254 255.255.255.0
no shut

PC1:

2、配置单边的OSPF

先配置R1到R2到R4的OSPF

怎么做呢,就是启用OSPF进程,然后宣告的时候,注意只把这边的网段宣告进去就好

例如R1,只宣告1.1.1.0/24与12.1.1.0/24,不要宣告13.1.1.0/24进去OSPF进程即可。

R1:

router ospf 1
network 1.1.1.0 0.0.0.255 area 0
network 12.1.1.0 0.0.0.255 area 0

R2:

router ospf 1
network 2.2.2.0 0.0.0.255 area 0
network 12.1.1.0 0.0.0.255 area 0
network 24.1.1.0 0.0.0.255 area 0

R4:

router ospf 1
network 4.4.4.0 0.0.0.255 area 0
network 24.1.1.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 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:00:05, Serial2/0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/129] via 12.1.1.2, 00:00:05, Serial2/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial2/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, FastEthernet0/0
     24.0.0.0/24 is subnetted, 1 subnets
O       24.1.1.0 [110/128] via 12.1.1.2, 00:00:05, Serial2/0
O    192.168.1.0/24 [110/129] via 12.1.1.2, 00:00:05, Serial2/0

能够看到R1已经有192.168.1.0/24的OSPF路由条目,ping 192.168.1.1,测试可达。

**注意此时的管理距离110,metric值129,下一跳接口是se2/0,也就是说R1->R2->R4->PC1

3、配置另外一边的OSPF链路

先配置R1到R3到R4的OSPF,原理同上,启用OSPF进程,增加宣告需要的网段。

R1:

router ospf 1
network 13.1.1.0 0.0.0.255 area 0

R3:

router ospf 1
network 3.3.3.0 0.0.0.255 area 0
network 13.1.1.0 0.0.0.255 area 0
network 34.1.1.0 0.0.0.255 area 0

R4:

router ospf 1
network 34.1.1.0 0.0.0.255 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:03:51, Serial2/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 13.1.1.3, 00:00:01, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/66] via 13.1.1.3, 00:00:01, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial2/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, FastEthernet0/0
     24.0.0.0/24 is subnetted, 1 subnets
O       24.1.1.0 [110/128] via 12.1.1.2, 00:03:51, Serial2/0
     34.0.0.0/24 is subnetted, 1 subnets
O       34.1.1.0 [110/65] via 13.1.1.3, 00:00:01, FastEthernet0/0
O    192.168.1.0/24 [110/66] via 13.1.1.3, 00:00:01, FastEthernet0/0

可以看到,到192.168.1.0/24.的路由,metric变成了66,而出站接口变成了快速以太网口fa0/0,即R1->R3->R4->PC1

我们用traceroute命令跟踪一下,traceroute 192.168.1.1

R1#traceroute 192.168.1.1
Type escape sequence to abort.
Tracing the route to 192.168.1.1
  1   13.1.1.3        2 msec    3 msec    0 msec    
  2   34.1.1.4        5 msec    2 msec    0 msec    
  3   192.168.1.1     14 msec   3 msec    2 msec 

因为R1从R2与R3都收到路由更新,R2与R3都告诉R1通过它们可以去到R4。

那么R1到底选R2还是R3呢,这个时候R1就会计算metric值,由于快速以太网带宽为100Mbps,而串口只有1.44Mbps,所以R1->R3->R4->PC1的路由更优。因此会优选这条链路。

每种路由协议采用的Metric计算方式不一样。

OSPF只计算带宽,根据100000000/(带宽*1000)来计算。

EIGRP度量值是使用带宽、延迟、可靠性、负载和MTU来计算,即链路的5种不同特征以及K值。K值是可配置的但这并不常用。缺省的K值为:K1=1,K2=0,K3=1,K4=0,K5=0

度量值=K1带宽+(K2带宽)/(256-负载)+K3*延迟)。

那么问题来了,如果一个网络既有RIP,又有OSPF,又有EIGRP协议的路由器,他们之间会交换路由条目吗?我们下一节介绍不同路由协议之间是如何交换的。

相关文章

网友评论

    本文标题:【实战演练】Packet Tracer玩转CCNA实验13-路由

    本文链接:https://www.haomeiwen.com/subject/oarsahtx.html