在 Linux 上配置 pimd 以将传入的多播数据包转发到 OpenVPN 隧道接口

网络工程 路由 多播 斑驴 皮姆
2021-07-14 17:57:35

网络图

有谁知道我如何在 Linux 上设置 pimd,以便来自 225.0.30.30 的多播地址可以路由到右侧的 172.24.0.66/30 路由器?

这就是我今天刚刚建立的实验室, PoC网络图 主机 1 IP 配置 路由器 A IP 配置 路由器 B IP 配置

在实验室环境中,我更改了 IP,因此不需要运行另一个 NAT 设置。路由器 A 和 B 正在运行 pimd 没有任何详细配置,这是两个路由器的 pimd -r 详细信息: pimd -r 路由器 A 上的详细信息 pimd -r 路由器 B 上的详细信息

将所有部件粘合在一起后,我在主机 1 上启动“iperf -c 225.0.100.100 -u -t 1 -i 1”,在路由器 B 上启动“iperf -s -u -B 225.0.100.100 -i 1”;路由器 B 根本没有收到多播,有人知道这有什么问题吗?

编辑:测试埃弗顿的建议,结果仍然没有

路由器 B 的 test_igmpv3_join 结果:

test_igmpv3_join

运行 test_igmpv3_join 后来自路由器 A 的 PIM 调试日志:

2016/01/28 13:55:03 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/28 13:55:03 PIM: pim_zebra.c fib_lookup_if_vif_index: high vif_index=2 > highest_vif_index=-1 nexthop for address 10.101.16.135
2016/01/28 13:55:03 PIM: pim_zebra.c fib_lookup_if_vif_index: pim disabled on interface eth0 vif_index=2 ?
2016/01/28 13:55:03 PIM: pim_zebra.c igmp_source_forward_start: could not find input interface for source 10.101.16.135
2016/01/28 13:55:03 PIM: pim_zebra.c fib_lookup_if_vif_index: high vif_index=2 > highest_vif_index=-1 nexthop for address 10.101.16.135
2016/01/28 13:55:03 PIM: pim_zebra.c fib_lookup_if_vif_index: pim disabled on interface eth0 vif_index=2 ?
2016/01/28 13:55:03 PIM: pim_zebra.c igmp_source_forward_start: could not find input interface for source 10.101.16.135
2016/01/28 13:55:03 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/28 13:55:03 PIM: pim_zebra.c fib_lookup_if_vif_index: high vif_index=2 > highest_vif_index=-1 nexthop for address 10.101.16.135
2016/01/28 13:55:03 PIM: pim_zebra.c fib_lookup_if_vif_index: pim disabled on interface eth0 vif_index=2 ?
2016/01/28 13:55:03 PIM: pim_zebra.c igmp_source_forward_start: could not find input interface for source 10.101.16.135
2016/01/28 13:55:03 PIM: pim_zebra.c fib_lookup_if_vif_index: high vif_index=2 > highest_vif_index=-1 nexthop for address 10.101.16.135
2016/01/28 13:55:03 PIM: pim_zebra.c fib_lookup_if_vif_index: pim disabled on interface eth0 vif_index=2 ?
2016/01/28 13:55:03 PIM: pim_zebra.c igmp_source_forward_start: could not find input interface for source 10.101.16.135
2016/01/28 13:55:04 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.13,103
2016/01/28 13:55:04 PIM: Recv IP PIM pkt size=30 from 10.101.16.135 to 224.0.0.13 on fd=9 on ifindex=2 (sock_ifindex=2)
2016/01/28 13:55:04 PIM: Recv IP packet from 10.101.16.135 to 224.0.0.13 on eth0: size=30 ip_header_size=20 ip_proto=103
2016/01/28 13:55:04 PIM: Recv PIM packet from 10.101.16.135 to 224.0.0.13 on eth0: ttl=1 pim_version=2 pim_type=0 pim_msg_size=10 checksum=93df
2016/01/28 13:55:04 PIM: pim_hello_recv: from 10.101.16.135 on eth0
2016/01/28 13:55:04 PIM: pim_hello_recv: parse left_size=6: PIM hello TLV type=1 length=2 from 10.101.16.135 on eth0
2016/01/28 13:55:04 PIM: pim_hello_recv: PIM hello option from 10.101.16.135 on interface eth0: holdtime=105
2016/01/28 13:55:04 PIM: neighbor_timer_off: cancelling timer for neighbor 10.101.16.135 on eth0
2016/01/28 13:55:04 PIM: pim_neighbor_timer_reset: starting 105 sec timer for neighbor 10.101.16.135 on eth0
2016/01/28 13:55:04 PIM: dr_election_by_addr: on interface eth0
2016/01/28 13:55:04 PIM: Scheduling READ event on PIM socket fd=9
2016/01/28 13:55:04 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.13,103
2016/01/28 13:55:04 PIM: Recv IP PIM pkt size=30 from 10.101.16.135 to 224.0.0.13 on fd=11 on ifindex=2 (sock_ifindex=3)
2016/01/28 13:55:04 PIM: Scheduling READ event on PIM socket fd=11
2016/01/28 13:55:07 PIM: Rescheduling 30 sec hello on interface eth1
2016/01/28 13:55:07 PIM: hello_send: to 224.0.0.13 on eth1: holdt=105 prop_d=500 overr_i=2500 dis_join_supp=0 dr_prio=1 gen_id=2518d352 addrs=2
2016/01/28 13:55:07 PIM: pim_tlv_append_addrlist_ucast: number of encoded secondary unicast IPv4 addresses: 0
2016/01/28 13:55:07 PIM: pim_msg_send: to 224.0.0.13 on eth1: msg_size=34 checksum=3adb
2016/01/28 13:55:07 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.1,2
2016/01/28 13:55:09 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.13,103
2016/01/28 13:55:09 PIM: Recv IP PIM pkt size=56 from 10.101.16.135 to 224.0.0.13 on fd=9 on ifindex=2 (sock_ifindex=2)
2016/01/28 13:55:09 PIM: Recv IP packet from 10.101.16.135 to 224.0.0.13 on eth0: size=56 ip_header_size=20 ip_proto=103
2016/01/28 13:55:09 PIM: Recv PIM packet from 10.101.16.135 to 224.0.0.13 on eth0: ttl=1 pim_version=2 pim_type=4 pim_msg_size=36 checksum=b88e
2016/01/28 13:55:09 PIM: pim_pim.c pim_pim_packet: unsupported PIM message type=4 from 10.101.16.135 on eth0
2016/01/28 13:55:09 PIM: pim_sock_read: pim_pim_packet() return=-1
2016/01/28 13:55:09 PIM: Scheduling READ event on PIM socket fd=9
2016/01/28 13:55:09 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.13,103
2016/01/28 13:55:09 PIM: Recv IP PIM pkt size=56 from 10.101.16.135 to 224.0.0.13 on fd=11 on ifindex=2 (sock_ifindex=3)
2016/01/28 13:55:09 PIM: Scheduling READ event on PIM socket fd=11
2016/01/28 13:55:12 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/28 13:55:12 PIM: pim_zebra.c fib_lookup_if_vif_index: high vif_index=2 > highest_vif_index=-1 nexthop for address 10.101.16.135
2016/01/28 13:55:12 PIM: pim_zebra.c fib_lookup_if_vif_index: pim disabled on interface eth0 vif_index=2 ?
2016/01/28 13:55:12 PIM: pim_zebra.c igmp_source_forward_start: could not find input interface for source 10.101.16.135
2016/01/28 13:55:15 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/28 13:55:16 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/28 13:55:16 PIM: pim_zebra.c fib_lookup_if_vif_index: high vif_index=2 > highest_vif_index=-1 nexthop for address 10.101.16.135
2016/01/28 13:55:16 PIM: pim_zebra.c fib_lookup_if_vif_index: pim disabled on interface eth0 vif_index=2 ?
2016/01/28 13:55:16 PIM: pim_zebra.c igmp_source_forward_start: could not find input interface for source 10.101.16.135
2016/01/28 13:55:16 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/28 13:55:21 PIM: Rescheduling 30 sec hello on interface eth0
2016/01/28 13:55:21 PIM: hello_send: to 224.0.0.13 on eth0: holdt=105 prop_d=500 overr_i=2500 dis_join_supp=0 dr_prio=1 gen_id=ca948d20 addrs=2
2016/01/28 13:55:21 PIM: pim_tlv_append_addrlist_ucast: number of encoded secondary unicast IPv4 addresses: 0
2016/01/28 13:55:21 PIM: pim_msg_send: to 224.0.0.13 on eth0: msg_size=34 checksum=f07b

路由器A配置:

routerA# show run

Current configuration:
!
password quagga
log stdout
!
interface eth0
 ip pim ssm
 ip igmp query-interval 125
 ip igmp query-max-response-time-dsec 100
!
interface eth1
 ip pim ssm
 ip igmp
 ip igmp query-interval 125
 ip igmp query-max-response-time-dsec 100
!
interface eth2
!
interface eth3
!
interface lo
!         
!
line vty
!
end

Quagga pimd 故障排除详细信息

routerA# show ip rib 10.101.16.135
Address         NextHop         Interface Metric Preference
10.101.16.135   0.0.0.0         eth0           0          0
routerA# show ip multicast 
Multicast disabled

Zclient update socket: 7 failures=0
Zclient lookup socket: 8 failures=0

Current highest VifIndex: -1
Maximum highest VifIndex: 31

Upstream Join Timer: 60 secs
Join/Prune Holdtime: 210 secs

RPF Cache Refresh Delay:    10000 msecs
RPF Cache Refresh Timer:    0 msecs
RPF Cache Refresh Requests: 5
RPF Cache Refresh Events:   2
RPF Cache Refresh Last:     00:02:20

Scan OIL - Last: 00:02:20  Events: 2
MFC Add  - Last: --:--:--  Events: 0
MFC Del  - Last: --:--:--  Events: 0

Interface Address         ifi Vif  PktsIn PktsOut    BytesIn   BytesOut
ioctl(SIOCGETVIFCNT=35296) failure for interface eth0 vif_index=-1: errno=9: Bad file descriptor
ioctl(SIOCGETVIFCNT=35296) failure for interface eth1 vif_index=-1: errno=9: Bad file descriptor
routerA# show ip mroute        
Proto: I=IGMP P=PIM

Source          Group           Proto Input iVifI Output oVifI TTL Uptime  

我看到了一些有趣的“多播禁用”,所以在 Quagga pimd 上,我添加了配置行“ip multicast-routing”,然后我启动 iperf 以发送多播数据包并再次显示详细信息,

routerA# show ip multicast 
Mroute socket descriptor: 14
Mroute socket uptime: 00:08:12

Zclient update socket: 7 failures=0
Zclient lookup socket: 8 failures=0

Current highest VifIndex: 3
Maximum highest VifIndex: 31

Upstream Join Timer: 60 secs
Join/Prune Holdtime: 210 secs

RPF Cache Refresh Delay:    10000 msecs
RPF Cache Refresh Timer:    0 msecs
RPF Cache Refresh Requests: 5
RPF Cache Refresh Events:   2
RPF Cache Refresh Last:     00:13:14

Scan OIL - Last: 00:13:14  Events: 2
MFC Add  - Last: 00:01:04  Events: 1
MFC Del  - Last: --:--:--  Events: 0

Interface Address         ifi Vif  PktsIn PktsOut    BytesIn   BytesOut
eth0      10.101.16.134     2   2    5687       0    8519126          0
eth1      172.24.0.65       3   3       0       0          0          0

routerA# show ip pim interface 
Interface Address         ifIndex Socket Uptime   Multi Broad MLoop AllMu Prmsc Del
eth0      10.101.16.134         2      9 00:23:20   yes   yes    no    no    no  no
eth1      172.24.0.65           3     11 00:23:20   yes   yes    no    no    no  no

routerA# show ip igmp sources 
Interface Address         Group           Source          Timer Fwd Uptime  
eth1      172.24.0.65     225.0.100.100   10.101.16.135   02:48   Y 00:02:03

routerA# show ip igmp interface 
Interface Address         ifIndex Socket Uptime   Multi Broad MLoop AllMu Prmsc Del
eth1      172.24.0.65           3     10 00:23:45   yes   yes   yes    no    no  no

但是路由器 B 上的 tcpdump 仍然没有收到多播数据包。

运行 test_igmpv3_join 后,从路由器 A 重做 PIM 调试日志:

2016/01/29 10:40:05 PIM: Rescheduling 30 sec hello on interface eth1
2016/01/29 10:40:05 PIM: hello_send: to 224.0.0.13 on eth1: holdt=105 prop_d=500 overr_i=2500 dis_join_supp=0 dr_prio=1 gen_id=921c168a addrs=2
2016/01/29 10:40:05 PIM: pim_tlv_append_addrlist_ucast: number of encoded secondary unicast IPv4 addresses: 0
2016/01/29 10:40:05 PIM: pim_msg_send: to 224.0.0.13 on eth1: msg_size=34 checksum=ff2a
2016/01/29 10:40:09 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/29 10:40:09 PIM: pim_rpf.c pim_nexthop_lookup: found nexthop 0.0.0.0 for address 10.101.16.135: interface eth0 ifindex=2 metric=0 pref=0
2016/01/29 10:40:09 PIM: pim_if_find_neighbor: neighbor not found for address 0.0.0.0 on interface eth0
2016/01/29 10:40:09 PIM: pim_rpf.c pim_rpf_update: RPF'(10.101.16.135,225.0.100.100) not found: won't send join upstream
2016/01/29 10:40:09 PIM: pim_rpf.c pim_rpf_update: (S,G)=(10.101.16.135,225.0.100.100) source nexthop now is: interface=eth0 address=0.0.0.0 pref=0 metric=0
2016/01/29 10:40:09 PIM: pim_rpf.c pim_rpf_update: (S,G)=(10.101.16.135,225.0.100.100) RPF_interface(S) changed from <oldif?> to eth0
2016/01/29 10:40:09 PIM: pim_ifassert_winner_set: (S,G)=(10.101.16.135,225.0.100.100) assert state changed from ifassert_bad_state to NOINFO on interface eth1
2016/01/29 10:40:09 PIM: pim_ifassert_winner_set: (S,G)=(10.101.16.135,225.0.100.100) assert winner changed from 64.146.254.46 to 0.0.0.0 on interface eth1
2016/01/29 10:40:09 PIM: ifmembership_set: (S,G)=(10.101.16.135,225.0.100.100) membership now is INCLUDE on interface eth1
2016/01/29 10:40:09 PIM: pim_upstream_switch: PIM_UPSTREAM_JOINED: (S,G)=(10.101.16.135,225.0.100.100)
2016/01/29 10:40:09 PIM: pim_ifchannel_update_assert_tracking_desired: AssertTrackingDesired(10.101.16.135,225.0.100.100,eth1) changed from 0 to 1
2016/01/29 10:40:09 PIM: pim_forward_start: (S,G)=(10.101.16.135,225.0.100.100) oif=eth1
2016/01/29 10:40:09 PIM: send_join: can't send join upstream: RPF'(10.101.16.135,225.0.100.100)=0.0.0.0
2016/01/29 10:40:09 PIM: pim_joinprune_send: sending Join(S,G)=(10.101.16.135,225.0.100.100) to upstream=0.0.0.0 on interface eth0
2016/01/29 10:40:09 PIM: pim_joinprune_send: Join(S,G)=(10.101.16.135,225.0.100.100): upstream=0.0.0.0 is myself on interface eth0
2016/01/29 10:40:09 PIM: join_timer_start: starting 60 sec timer for upstream (S,G)=(10.101.16.135,225.0.100.100)
2016/01/29 10:40:09 PIM: pim_ifchannel_update_could_assert: CouldAssert(10.101.16.135,225.0.100.100,eth1) changed from 0 to 1
2016/01/29 10:40:09 PIM: pim_ifchannel_update_my_assert_metric: my_assert_metric(10.101.16.135,225.0.100.100,eth1) changed from 1,4294967295,4294967295,0.0.0.0 to 0,0,0,172.24.0.65
2016/01/29 10:40:09 PIM: Rescheduling 30 sec hello on interface eth0
2016/01/29 10:40:09 PIM: hello_send: to 224.0.0.13 on eth0: holdt=105 prop_d=500 overr_i=2500 dis_join_supp=0 dr_prio=1 gen_id=661e4198 addrs=2
2016/01/29 10:40:09 PIM: pim_tlv_append_addrlist_ucast: number of encoded secondary unicast IPv4 addresses: 0
2016/01/29 10:40:09 PIM: pim_msg_send: to 224.0.0.13 on eth0: msg_size=34 checksum=ef2b
2016/01/29 10:40:10 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/29 10:40:20 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/29 10:40:20 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.22,2
2016/01/29 10:40:22 PIM: ifmembership_set: (S,G)=(10.101.16.135,225.0.100.100) membership now is NOINFO on interface eth1
2016/01/29 10:40:22 PIM: pim_upstream_switch: PIM_UPSTREAM_NOTJOINED: (S,G)=(10.101.16.135,225.0.100.100)
2016/01/29 10:40:22 PIM: pim_ifchannel_update_assert_tracking_desired: AssertTrackingDesired(10.101.16.135,225.0.100.100,eth1) changed from 1 to 0
2016/01/29 10:40:22 PIM: pim_forward_stop: (S,G)=(10.101.16.135,225.0.100.100) oif=eth1
2016/01/29 10:40:22 PIM: pim_zebra.c del_oif: nonexistent protocol mask 2 removed OIF eth1 (vif_index=3, min_ttl=0) from channel (S,G)=(10.101.16.135,225.0.100.100)
2016/01/29 10:40:22 PIM: pim_joinprune_send: sending Prune(S,G)=(10.101.16.135,225.0.100.100) to upstream=0.0.0.0 on interface eth0
2016/01/29 10:40:22 PIM: pim_joinprune_send: Prune(S,G)=(10.101.16.135,225.0.100.100): upstream=0.0.0.0 is myself on interface eth0
2016/01/29 10:40:22 PIM: pim_ifchannel_update_could_assert: CouldAssert(10.101.16.135,225.0.100.100,eth1) changed from 1 to 0
2016/01/29 10:40:22 PIM: pim_ifchannel_update_my_assert_metric: my_assert_metric(10.101.16.135,225.0.100.100,eth1) changed from 0,0,0,172.24.0.65 to 1,4294967295,4294967295,0.0.0.0
2016/01/29 10:40:22 PIM: pim_mroute_msg: kernel upcall NOCACHE type=1 ip_p=0 from fd=14 for (S,G)=(10.101.16.135,225.0.100.100) on eth0 vifi=2

mroute详细信息:

routerA# show ip mroute 
Proto: I=IGMP P=PIM

Source          Group           Proto Input iVifI Output oVifI TTL Uptime  
10.101.16.135   225.0.100.100   I     eth0      2 eth1       3   1 02:47:40 
routerA# show ip mroute count

Source          Group           Packets      Bytes WrongIf  
10.101.16.135   225.0.100.100    841231 1260164038       0 

通过在主机 1 上使用 -T 10 而不是默认值 1 运行 iperf 解决了问题。

1个回答

这是一个使用 Quagga pimd 的快速食谱:

1) 为 RouterA 设置 Host1 静态默认路由(您也可以为多播组使用静态特定路由)。

2) 确保 Host1 源正在使用适当的 TTL(足够高以到达接收器)发送多播流。

3) 确保RouterA 上到组播源的单播路由正确。

4) 在 RouterA 上运行 Quagga pimd:

注意:pimd 需要 zebra 守护进程:启动 pimd之前运行 zebra 守护进程

! RouterA: interface to source
! (pimd is enabled on eth0 just to activate multicast on it)
interface eth0
 ip pim ssm

! RouterA: interface to RouterB
! (for this simple topology, we actually only need IGMP here)
interface eth1
 ip pim ssm
 ip igmp

5) 在 RouterB 上安装 Quagga pimd,为了运行这个 IGMPv3 加入工具:

路由器B: test_igmpv3_join eth1 225.0.30.30 192.168.18.132

6) 在 RouterA 上使用 Quagga pimd 命令验证组播。例如:

路由器A: show ip mroute

路由器A: show ip mroute count

7) 如果事情没有按预期工作,请尝试 pimd 故障排除命令:

show ip rib 192.168.18.132 (unicast route towards source?)
show ip multicast          (multicast enabled at all?)
show ip mroute             (kernel mcast programming is correct?)
show ip pim interface      (pim enabled on interfaces?)
show ip igmp sources       (receiver joined on interface?)
show ip igmp interface     (igmp enabled on receiver interface?)

来自:http : //git.savannah.gnu.org/cgit/quagga.git/tree/pimd/TROUBLESHOOTING