实验目的:验证组播的TTL阀值。
实验拓扑:
实验步骤:
PC1,PC2均加入224.1.1.1这个组播组。
R1:
ip multicast-routing
interface Serial1/1
ip address 192.168.12.1 255.255.255.0
ip pim dense-mode
serial restart-delay 0
R3:
interface FastEthernet0/0
ip address 192.168.1.3 255.255.255.0
ip pim dense-mode
ip multicast ttl-threshold 11 //通过实验设置TTL值只能在出接口上进行设置。
no ip mroute-cache
duplex half
TTL阀值的规定:路由器必须确保只有在信息包的TTL值大于或者等于接口的TTL阀值时,才允许将该信息
在此接口上转发出去。
在R1上用扩展ping:默认ping的TTL值是255.
R1# ping ip
Target IP address: 224.1.1.1
Repeat count [1]: 11
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Interface [All]:
Time to live [255]: 11 //此处设置的ttl和R3出口的fa0/0口的ttl值一样
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 11, 100-byte ICMP Echos to 224.1.1.1, timeout is 2 seconds:
...........
R1#
结果是不通的,然后用ttl为12的试试看。
R1#
R1#
R1#ping ip
Target IP address: 224.1.1.1
Repeat count [1]: 11
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Interface [All]:
Time to live [255]: 12
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 11, 100-byte ICMP Echos to 224.1.1.1, timeout is 2 seconds:
...........
还是不通?为什么呢?
再用TTL为13试试呢?
R1#ping ip
Target IP address: 224.1.1.1
Repeat count [1]: 11
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Interface [All]:
Time to live [255]: 13
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 11, 100-byte ICMP Echos to 224.1.1.1, timeout is 2 seconds:
Reply to request 0 from 192.168.1.4, 164 ms
Reply to request 0 from 192.168.1.5, 236 ms
Reply to request 1 from 192.168.1.5, 224 ms
Reply to request 1 from 192.168.1.4, 248 ms
Reply to request 2 from 192.168.1.5, 164 ms
Reply to request 2 from 192.168.1.4, 188 ms
Reply to request 3 from 192.168.1.5, 176 ms
Reply to request 3 from 192.168.1.4, 200 ms
Reply to request 4 from 192.168.1.5, 164 ms
Reply to request 4 from 192.168.1.4, 164 ms
Reply to request 5 from 192.168.1.4, 224 ms
Reply to request 5 from 192.168.1.5, 296 ms
Reply to request 6 from 192.168.1.5, 212 ms
Reply to request 6 from 192.168.1.4, 284 ms
Reply to request 7 from 192.168.1.5, 224 ms
Reply to request 7 from 192.168.1.4, 224 ms
Reply to request 8 from 192.168.1.5, 188 ms
Reply to request 8 from 192.168.1.4, 188 ms
Reply to request 9 from 192.168.1.5, 272 ms
Reply to request 9 from 192.168.1.4, 272 ms
Reply to request 10 from 192.168.1.4, 212 ms
Reply to request 10 from 192.168.1.5, 284 ms
结果是能通?证明什么呢?从实验可以看出,在组播中的TTL和单播中的TTL递减规则是一样的,也就是说经过一个路由器,他的TTL值就减小1,然后比较ttl是否大于0,如果大于0,则继续寻找路由,否则丢弃。
由于PC1,PC2同时加入224.1.1.1 和224.1.2.3
然而在R3的FA0/0口做了如下的配置:
access-list 1 deny 224.1.2.3
access-list 1 permit any
interface FastEthernet0/0
ip address 192.168.1.3 255.255.255.0
ip pim dense-mode
ip multicast ttl-threshold 11
ip multicast boundary 1 //也就是通过ACL过滤组播流量
no ip mroute-cache
duplex half
此时在R1上ping 224.1.1.1的结果如下:有两个返回包。然而ping224.1.2.3时,则不通。
R1#ping 224.1.1.1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 224.1.1.1, timeout is 2 seconds:
Reply to request 0 from 192.168.1.4, 344 ms
Reply to request 0 from 192.168.1.5, 392 ms
R1#p 224.1.2.3
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 224.1.2.3, timeout is 2 seconds:
.
R1#
取消R3上的boundary后,在R1上则可以ping通,并且是只有PC2返回的,(注:PC1只加入了224.1.1.1,而PC2加入了224.1.1.1和224.1.2.3)
R1#ping 224.1.2.3
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 224.1.2.3, timeout is 2 seconds:
Reply to request 0 from 192.168.1.5, 224 ms
本文转自 gehailong 51CTO博客,原文链接:http://blog.51cto.com/gehailong/297372,如需转载请自行联系原作者