<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
|
|
|
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
|
|
RIP
的度量是基于跳数(
hops
count
)的,每经过一台路由器,路径的跳数加一。如此一来,跳数越多,路径就越长,
RIP
算法会优先选择跳数少的路径
。
在
RIP
中,路由器到与它直接相连网络的跳数为
0
,通过一个路由器可达的网络的跳数为
1
,其余依此类推。为限制收敛时间,
RIP
规定
cost
取值
0~15
之间的整数,大于或等于
16
的跳数被定义为无穷大,即目的网络或主机不可达。
1:
当出现有多条到达一个目标网络跳数相同时,会出现什么情况呢?
2:
我们可不可以控制它的度量达到我们想要的效果呢?
3:
接收到路由更新来自同源,或者非同源时,情况又会如何呢?
实验目标
:
调试分析
RIP
基于跳数的负载均衡,通过
offset-list
来控制
RIP
度量,监测同源与非同源路由的情况。
|
|
|
|
ip address 1.1.1.1 255.255.255.0
ip address 13.1.1.1 255.255.255.0
ip address 12.1.1.1 255.255.255.0
|
ip address 12.1.1.2 255.255.255.0
ip address 23.1.1.2 255.255.255.0
|
|
|
ip address 23.1.1.3 255.255.255.0
ip address 13.1.1.3 255.255.255.0
|
|
|
完成各个路由器的基本配置,我们来看看R1、R2、R3的路由表
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
R 23.0.0.0/8 [120/1] via 12.1.1.2, 00:00:20, Serial1/1
[120/1] via 13.1.1.3, 00:00:10, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial1/0
R 1.0.0.0/8 [120/1] via 12.1.1.1, 00:00:19, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R 13.0.0.0/8 [120/1] via 12.1.1.1, 00:00:19, Serial1/0
[120/1] via 23.1.1.3, 00:00:25, Serial1/1
R 1.0.0.0/8 [120/1] via 13.1.1.1, 00:00:23, Serial1/1
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
R 12.0.0.0/8 [120/1] via 23.1.1.2, 00:00:09, Serial1/0
[120/1] via 13.1.1.1, 00:00:23, Serial1/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial1/1
通过上面的路由表信息,我们可以看到,每个路由器学到箭头指着网络,分别来自两个下一跳地址,而且度量值都为1,出现这种现象是因为RIP基于跳数的负载均衡产生的。
R1#show ip route 23.0.0.0
Routing entry for 23.0.0.0/8
Known via "rip", distance 120, metric 1
Last update from 13.1.1.3 on Serial1/0, 00:00:17 ago
Routing Descriptor Blocks:
12.1.1.2, from 12.1.1.2, 00:00:27 ago, via Serial1/1
Route metric is 1, traffic share count is 1
* 13.1.1.3, from 13.1.1.3, 00:00:17 ago, via Serial1/0
Route metric is 1, traffic share count is 1
*Mar 8 02:33:28.227: RIP: received v1 update from 13.1.1.3 on Serial1/0
*Mar 8 02:33:28.231: 23.0.0.0 in 1 hops
R1#----------------------省略部分信息------------------------
*Mar 8 02:33:48.275: RIP: received v1 update from 12.1.1.2 on Serial1/1
*Mar 8 02:33:48.279: 23.0.0.0 in 1 hops
由debug信息也可以看到接收23.0.0.0网络分别来自两个下一跳地址。
当然我也可以用traceroute和(扩展ping 的record选项来跟踪返回的路径)。
Type escape sequence to abort.
Tracing the route to 23.1.1.3
Type escape sequence to abort.
Tracing the route to 23.1.1.3
Type escape sequence to abort.
Tracing the route to 23.1.1.3
通过多次重复traceroute测试的结果,我们可以看到阴影部分的第一跳地址是轮流在交换着,之所以这样,正是负载均衡的作用允许路由器有多条路径到达同一目标网络产生的。
下面看看用扩展ping 的record选项来跟踪返回的路径
Target IP address: 23.1.1.3 #-------目标地址
Repeat count [5]: 2 #---由于默认ping 5个包会输出太多信息,所以改为ping 2个包
Extended commands [n]: y #-------选择Yes使用扩展ping
Source address or interface: 1.1.1.1 #-----使用1.1.1.1为源地址
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Loose, Strict, Record, Timestamp, Verbose[none]: r #----使用记录跟踪功能
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
Packet has IP options: Total option bytes= 39, padded length=40
Reply to request 0 (60 ms). Received packet has options
Total option bytes= 40, padded length=40
Reply to request 1 (120 ms). Received packet has options
Total option bytes= 40, padded length=40
Success rate is 100 percent (2/2), round-trip min/avg/max = 60/90/120 ms
通过上面ping的信息可以看到跟踪记录的信息是不同的,分别选择两条路径走的。这也证实了是负责均衡,如果不是负载均衡而是选择最优一条路径的话,跟踪记录的信息是相同的。
1:R1到达目标网络23.0.0.0是负载均衡,现在就要让它不负载均衡,要令R1优先选择走R1(s1/1)为出口经由R2达到目标网络。
2:要达到这样的要求我们就可以通过命令offset-list来改变路由的度量值。
3:利用offest-list指定一个数值(0-16)来加大路由器的度量值。使路由器R1(s1/0)到R3(s1/1)的链路达到目标网络由原来的跳数是1跳增加到3跳。
R1(config)#access-list 1 permit 23.0.0.0
R1(config-router)#offset-list 1 in 2 s1/0
首先是定义访问列表确定了要匹配的23.0.0.0的路由,而offset-list会“先检查从s1/0接口接收进来的RIP通告,如果存在和访问列表1指定的地址匹配的路由条目(23.0.0.0),那么就把该条路由的度量值加大2跳。”
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
R 23.0.0.0/8 [120/1] via 12.1.1.2, 00:00:13, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial1/0
从路由表看23.0.0.0的路由条目,现在只剩下了由R2学到的路由了。
RIP protocol debugging is on
*Mar 8 03:37:43.403: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (13.1.1.1)
*Mar 8 03:37:43.403: RIP: build update entries
*Mar 8 03:37:43.407: network 1.0.0.0 metric 1
*Mar 8 03:37:43.407: network 12.0.0.0 metric 1
*Mar 8 03:37:43.407: network 23.0.0.0 metric 2
*Mar 8 03:37:45.983: RIP: received v1 update from 12.1.1.2 on Serial1/1
*Mar 8 03:37:45.987: 23.0.0.0 in 1 hops
*Mar 8 03:37:46.759: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (12.1.1.1)
*Mar 8 03:37:46.759: RIP: build update entries
*Mar 8 03:37:46.763: network 1.0.0.0 metric 1
*Mar 8 03:37:46.763: network 13.0.0.0 metric 1
*Mar 8 03:37:55.995: RIP: received v1 update from 13.1.1.3 on Serial1/0
*Mar 8 03:37:55.999: 23.0.0.0 in 3 hops
从debug信息已经可以看到,目标网络23.0.0.0,由接口s1/1接收来自R2为1跳,而由接口s1/0接收来自R3为3跳。
R1#show ip route 23.0.0.0
Routing entry for 23.0.0.0/8
Known via "rip", distance 120, metric 1
Last update from 12.1.1.2 on Serial1/1, 00:00:04 ago
Routing Descriptor Blocks:
* 12.1.1.2, from 12.1.1.2, 00:00:04 ago, via Serial1/1
Route metric is 1, traffic share count is 1
Type escape sequence to abort.
Tracing the route to 23.1.1.3
1 12.1.1.2 92 msec 56 msec 48 msec
2 23.1.1.3 44 msec * 76 msec
Type escape sequence to abort.
Tracing the route to 23.1.1.3
1 12.1.1.2 112 msec 64 msec 16 msec
2 23.1.1.3 24 msec * 68 msec
从上面的结果可以看到,R1优先选择经由R2的路径到达目标网络,接受跳数较少的23.0.0.0路由条目。
以上实现的就是offset-list的作用了,当然offset-list还有其它的一些功能,例如:我们除了可以控制入站接收的度量值之外,还可以控制出站宣告的路由更新度量。
1: 我们先来验证同源的情况,这里只利用R1和R2两台路由,所以先把R1的s1/0断开方便我们测试。
2: 我们以R1的loopback 0接口,1.0.0.0网络作为源,通过在R1的s1/1接口,控制出站宣告的路由更新的度量值,来观察R2的接收情况。
R 1.0.0.0/8 [120/1] via 12.1.1.1, 00:00:24, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R1(config)#access-list 2 permit 1.0.0.0
R1(config-router)#offset-list 2 out 3 s1/1
R 1.0.0.0/8 [120/4] via 12.1.1.1, 00:00:20, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
和没有增加度量值时的路由表对比,发现R2现在的路由表已经安装了度量值较大的1.0.0.0路由条目。
*Mar 8 05:19:20.799: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (12.1.1.1)
*Mar 8 05:19:20.799: RIP: build update entries
*Mar 8 05:19:20.803: network 1.0.0.0 metric 4
*Mar 8 05:20:42.967: RIP: received v1 update from 12.1.1.1 on Serial1/0
*Mar 8 05:20:42.971: 1.0.0.0 in 4 hops
*Mar 8 05:20:52.359: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (12.1.1.2)
*Mar 8 05:20:52.359: RIP: build update entries
*Mar 8 05:20:52.359: network 23.0.0.0 metric 1
*Mar 8 05:20:55.187: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (23.1.1.2) #-----发送给R3
*Mar 8 05:20:55.187: RIP: build update entries
*Mar 8 05:20:55.191: network 1.0.0.0 metric 5
*Mar 8 05:20:55.191: network 12.0.0.0 metric 1
由debug信息可以看到,R2接受更高度量值的。所以来自同源的路由总是会接收更新的,不管度量增大还是小,这时我们也观察到R2在接收到度量值发生变化的路由时,立即发送flash update 给R3。这说明一点,当度量变化时发送的是flash update(瞬间更新) ,而不是triggered update(触发更新)。
4:现在我们来验证一下不同源的情况,先看看R3的路由表,再在R1、R2、R3打开debug ip rip,然后开启R1的S1/0端口,使R1恢复与R3的连通。
R 1.0.0.0/8 [120/5] via 23.1.1.2, 00:00:24, Serial1/0 #-----来自R2
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
R 12.0.0.0/8 [120/1] via 23.1.1.2, 00:00:24, Serial1/0
可以看路由表中学到的1.0.0.0路由条目是来自R2
R1(config-if)#no shutdown
R 1.0.0.0/8 [120/2] via 23.1.1.3, 00:00:11, Serial1/1 #----来自R3
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R 13.0.0.0/8 [120/1] via 12.1.1.1, 00:00:23, Serial1/0
[120/1] via 23.1.1.3, 00:00:11, Serial1/1
R 1.0.0.0/8 [120/1] via 13.1.1.1, 00:00:10, Serial1/1 #---来自R1
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
R 12.0.0.0/8 [120/1] via 23.1.1.2, 00:00:20, Serial1/0
[120/1] via 13.1.1.1, 00:00:10, Serial1/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial1/1
现在R2的1.0.0.0路由条目是来自R3的为2跳,而R3的1.0.0.0路由条目是来自R1的为1跳。再看看看debug信息
*Mar 8 05:45:50.131: RIP: received v1 update from 23.1.1.3 on Serial1/1 #----来自R3
*Mar 8 05:45:50.135: 1.0.0.0 in 2 hops
*Mar 8 05:45:50.139: 13.0.0.0 in 1 hops
*Mar 8 05:46:11.387: RIP: received v1 update from 12.1.1.1 on Serial1/0 #----来自R2
*Mar 8 05:46:11.391: 1.0.0.0 in 4 hops
*Mar 8 05:46:11.391: 13.0.0.0 in 1 hops
*Mar 8 05:48:49.479: RIP: received v1 update from 13.1.1.1 on Serial1/1
*Mar 8 05:48:49.483: 1.0.0.0 in 1 hops
*Mar 8 05:48:49.483: 12.0.0.0 in 1 hops
*Mar 8 05:48:49.483: 23.0.0.0 in 2 hops
*Mar 8 05:49:08.627: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (23.1.1.3) #---发送去R2
*Mar 8 05:49:08.627: RIP: build update entries
*Mar 8 05:49:08.631: network 1.0.0.0 metric 2 #----网络1.0.0.0发给R2度量值为2
*Mar 8 05:49:08.631: network 13.0.0.0 metric 1
由路由表和debug信息可以看到R2选择1.0.0.0的路由条目是度量值更少的,这说明接收了从不同源的路由更新时会选择度量值更小的路由。
R1(config-router)#offset-list 2 out 2 s1/0
*Mar 8 06:15:49.706: RIP: received v1 update from 13.1.1.1 on Serial1/1
*Mar 8 06:15:49.710: 1.0.0.0 in 3 hops
*Mar 8 06:15:49.710: 12.0.0.0 in 1 hops
*Mar 8 06:15:49.710: 23.0.0.0 in 2 hops
*Mar 8 06:16:01.530: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (23.1.1.3)
*Mar 8 06:16:01.530: RIP: build update entries
*Mar 8 06:16:01.534: network 1.0.0.0 metric 4
*Mar 8 06:16:01.534: network 13.0.0.0 metric 1
R 1.0.0.0/8 [120/4] via 23.1.1.3, 00:00:12, Serial1/1 #---来自R3
[120/4] via 12.1.1.1, 00:00:13, Serial1/0 #---来自R1
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R 13.0.0.0/8 [120/1] via 12.1.1.1, 00:00:13, Serial1/0
[120/1] via 23.1.1.3, 00:00:12, Serial1/1
转载于:https://blog.51cto.com/sharkii/64721
2302_80915068: 有大神能把,运满满里的货源信息导出来吗?
m0_56859380: 修改时间可以查看吗
天冰天降: 你好,我这边有电脑编程方面的需求,使用游戏操作杆或者手柄,联系商量下具体功能。做到示例可用源代码就可以,我们自己有软件开发人员做就集成。
跑地比谁都快: 转载要注明出处。
咸鱼翻身: https://www.cnblogs.com/defineconst/p/7568096.html