组播Lab RPF TTL
路由器检查到达的组播包源地址,在组/单播路由表中查找是否有到达源地址的路由,如果从此路由下一跳的接口进来的组播包,则RPF检验成功,并转发,否则丢弃。
在RPF Check中,只能有一个输入接口,选举方法按如下顺序:
在组/单播路由表查找去往源的路由。
Lower AD>Longest Match>Lower Metric>Higher IP
R2(config)#ip mroute 13.1.1.3 255.255.255.255 serial 0/0 89
R2(config)#ip mroute 13.1.1.3 255.255.255.255 12.1.1.1 89
R1:
ip multicast-routing
int lo 0
ip add 1.1.1.1 255.255.255.255
int f0/0
no sh
int f0/0.12
en do 12
ip add 12.1.1.1 255.255.255.0
no sh
ip pim dense-mode
int f0/0.13
en do 13
no sh
ip add 13.1.1.1 255.255.255.0
ip pim dense-mode
int f0/0.31
en do 31
ip add 10.1.1.1 255.255.255.0
no sh
ip pim dense-mode
router eigrp 100
no au
net 10.0.0.0
net 13.0.0.0
net 12.0.0.0
net 1.0.0.0
R2:++++++++++++++++++++++++++++++++++++++
ip multicast-routing
int lo 0
ip add 2.2.2.2 255.255.255.255
int f0/0
no sh
int f0/0.12
en do 12
no sh
ip add 12.1.1.2 255.255.255.0
ip pim dense-mode
router eigrp 100
no au
net 12.0.0.0
net 2.0.0.0
R3:++++++++++++++++++++++++
ip multicast-routing
int lo 0
ip add 3.3.3.3 255.255.255.255
int f0/0
no sh
int f0/0.31
en do 31
ip add 10.1.1.3 255.255.255.0
ip pim dense-mode
int f0/0.13
en do 13
no sh
ip add 13.1.1.3 255.255.255.0
ip pim dense-mode
int f0/0.35
en do 35
no sh
ip add 35.1.1.3 255.255.255.0
ip pim dense-mode
router eigrp 100
no au
net 35.0.0.0
net 13.0.0.0
net 3.0.0.0
R5:++++++++++++++++++++++++++++++++++++++++
no ip routing
int f0/0
no sh
int f0/0.35
en do 35
ip add 35.1.1.5 255.255.255.0
no sh
ip igmp join-group 224.1.1.1
ip default-gateway 35.1.1.3
========================================
让R2去ping 224.1.1.1 使其产生组播包。
R2#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 35.1.1.5, 164 ms
R1#debug ip mpacket
R3#debug ip mpacket
R1#sh ip mcache //默认情况下,组播快速转发是开启的,所以第二次PING,debug并没有相关信息产生。
IP Multicast Fast-Switching Cache
(12.1.1.1/32, 224.1.1.1), Serial2/2, Last used: 00:00:09, MinMTU: 1500
FastEthernet0/0 MAC Header: 01005E010101CC040E1C00000800
+++++++++++++++++++++++++++++++++++++++++++++
把所有组播快速转发关闭
R2#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 34.1.1.4, 212 ms //R2只发送一个组播包
R1一旦接收此组播包,会复制此包然后往OIL的接口发送。
(12.1.1.1, 224.1.1.1), 00:01:38/00:01:31, flags: T
Incoming interface: Serial2/2, RPF nbr 0.0.0.0
Outgoing interface list:
Serial2/3, Prune/Dense, 00:01:38/00:01:24, A
FastEthernet0/0, Forward/Dense, 00:01:38/00:00:00
*Mar 1 00:13:12.271: IP(0): s=12.1.1.1 (Serial2/2) d=224.1.1.1 (Serial2/3) id=2, prot=1, len=100(100), mforward
*Mar 1 00:13:12.275: IP(0): s=12.1.1.1 (Serial2/2) d=224.1.1.1 (FastEthernet0/0) id=2, prot=1, len=100(100), mforward
*Mar 1 00:13:12.383: IP(0): s=12.1.1.1 (Serial2/3) d=224.1.1.1 id=2, prot=1, len=104(100), not RPF interface
R3:
*Mar 1 00:13:10.411: IP(0): s=12.1.1.1 (Serial2/3) d=224.1.1.1 id=2, prot=1, len=104(100), not RPF interface
*Mar 1 00:13:10.415: IP(0): s=12.1.1.1 (FastEthernet0/0) d=224.1.1.1 (Serial2/3) id=2, prot=1, len=100(100), mforward
*Mar 1 00:13:10.419: IP(0): s=12.1.1.1 (FastEthernet0/0) d=224.1.1.1 (Serial2/2) id=2, prot=1, len=100(100), mforward
R3是从F0/0口学习到的,因为在IP单播表里,到达R2的接口是F0/0,RPF成功,而S2/3失败。
再往后发数据包时,不会往Serial 2/3发送了。
R3++++++++++++++++++++++++++++++++++++++++++++++++++++
*Mar 1 00:21:09.515: IP(0): s=12.1.1.1 (FastEthernet0/0) d=224.1.1.1 (Serial2/3) id=3, prot=1, len=100(100), mforward
*Mar 1 00:21:09.519: IP(0): s=12.1.1.1 (FastEthernet0/0) d=224.1.1.1 (Serial2/2) id=3, prot=1, len=100(100), mforward
*Mar 1 00:21:09.527: IP(0): s=12.1.1.1 (Serial2/3) d=224.1.1.1 id=3, prot=1, len=104(100), not RPF interface
R3#
*Mar 1 00:21:18.035: IP(0): s=12.1.1.1 (FastEthernet0/0) d=224.1.1.1 (Serial2/2) id=4, prot=1, len=100(100), mforward
R1++++++++++++++++++++++++++++++++++++++++++++++++++++
*Mar 1 00:21:11.331: IP(0): s=12.1.1.1 (Serial2/2) d=224.1.1.1 (Serial2/3) id=3, prot=1, len=100(100), mforward
*Mar 1 00:21:11.335: IP(0): s=12.1.1.1 (Serial2/2) d=224.1.1.1 (FastEthernet0/0) id=3, prot=1, len=100(100), mforward
*Mar 1 00:21:11.443: IP(0): s=12.1.1.1 (Serial2/3) d=224.1.1.1 id=3, prot=1, len=104(100), not RPF interface
R1#
*Mar 1 00:21:19.875: IP(0): s=12.1.1.1 (Serial2/2) d=224.1.1.1 (FastEthernet0/0) id=4, prot=1, len=100(100), mforward
R3#show ip rpf 10.1.1.2
RPF information for ? (10.1.1.2)
RPF interface: FastEthernet0/0
RPF neighbor: ? (10.1.1.2) - directly connected
RPF route/mask: 10.1.1.0/24
RPF type: unicast (connected)
RPF recursion count: 0
Doing distance-preferred lookups across tables
R3#
把F0/0的pim给去掉
因为RPF是F0/0不是S2/3口,所以组播包不通。
R2#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:
.
此时R1接收到组播包会正常转发的
*Mar 1 00:27:01.735: IP(0): s=12.1.1.1 (Serial2/2) d=224.1.1.1 (Serial2/3) id=6, prot=1, len=100(100), mforward
但在R3上丢弃了
*Mar 1 00:26:59.847: IP(0): s=12.1.1.1 (Serial2/3) d=224.1.1.1 id=6, prot=1, len=104(100), not RPF interface
解决方法:
在R3上添加
ip mroute 12.1.1.0 255.255.255.0 s2/3
ip mroute 12.1.1.2 255.255.255.255 s2/3 91 //最长匹配原则 但因为AD比单播里的eigrp 还要高,所以不选择。造成无法通信。
show ip mroute static
R3(config)#ip multicast longest-match //隐藏命令(开启最长匹配,使其优于AD)
R2#ping 224.1.1.1 repeat 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 35.1.1.5, 164 ms
Reply to request 0 from 34.1.1.4, 164 ms
发一个包,收到两个包
R3(config)#int f0/0
R3(config-if)#ip multicast ttl-threshold 8
int s2/2
ip multicast ttl-threshold 9
在R2使用扩展PING。TTL=10,正常只收到一个回包,一个丢弃了。
也可以基于地址来设置TTL门限值。
R3#sh ip pim int s2/2 detail
Multicast boundary:not set //默认情况下,所以流量都可以进出
Multicast TTL threshold:9
ip multicast bounday 1
access-list 1 permit 224.1.1.1