This is an old revision of the document!
TECH NOTES:
Source(publishers) > Receivers(group members/subscribers)
The publisher sends packets to a multicast IP; The subscriber receives packets with destination that multicast IP.
IGMP: Messages:
IGMPv3 (MLDv2)
MEMBERSHIP QUERY (0x21) and MEMBERSHIP-REPORT (0x22) (question from the router and answer from the receivers) https://mrncciew.com/2021/04/16/igmp-version-3/
MEMBERSHIP-QUERY (igmp query):
SUBSCRIBER AND PUBLISHERS MESSAGES FLOW:
Nice explanation in this presentation. worth reading: External_Link
1)Receiver → **IGMP_Report **→ Last hop router → **PIM join ** → RP 2)RP ← **PIM-reg** ← FHR@ 3)RP → **PIM-join** → FHR*& @ Firstly GRE tunnel and MC encapsulated (unicast). The is the (*,G) not in the RP yet, RP replies with register-stop and adds it. If there are no receivers yet, RP replies with a PIM-register-stop message & When the (8,G) state is already in the RP, then the PIM-join goes up all way until the FHR receiver sends (*,G) to 224.0.0.13. Inside the pim register is listed: the pim neighbor + the RP's IP.
~~now traffic~~
4)LHR ← RP ← FHR-oil (but lhr knows now the source besides the rp) 5)FHR → PIM-join-for-src → LHR (fhr adds new iface to oil and traffic flows via spt) 6)LHR → PIM-prune → FHR (to remove old (*,G) path)
PIM
PIM-RPF. PIM builds and maintains multicast routing trees u
PIM applies the RPF policy (towards where the 'Source' of the multicast traffic is located).
There an important exception for this: when the PIM-join travels from the LHR Towards The RP, the RFP is made against the RP!
Remember: dynamic RPs are preferred to statically defined
ip pim anycast-ip <lo100-IP> <member-N-IP>
Multicast Boundary Filtering
https://networklessons.com/multicast/multicast-boundary-filtering
DESIGNATED ROUTER AND QUERIER:
show ip igmp snooping querier
NX-OS CONFIGURATION:
!SPARSE-MODE BSR - NEITHER RP-CANDIDATE NOR BSR-CANDIDATE feature pim ! interface ex/x ip pim sparse-mode ! !SPARSE-MODE BSR - RP-CANDIDATE AND BSR-CANDIDATE feature pim ! interface ex/x ip pim sparse-mode ! ip pim bsr-candidate loopback 0 ! To become BSR - we can add a hash value 'Hash Mask length for RP selection'. The BSR does not elect the best RP for every group range but builds a set of candidate RPs. Priority (below) is used for that. ip pim rp-candidate loopback 0 group-list 10 priority 10 ! For the rp-candidacy - lower priority wins, who should become RP if multiple candidates for same group ! access-list 10 permit 224.0.0.0 15.255.255.255 access-list 20 deny 224.0.1.39 access-list 20 deny 224.0.1.40 ! ip pim bsr forward !
!SPARSE-MODE AUTO-RP - NEITHER CANDIDATE NOR MAPPING AGENT BUT HAVING A 'SINK RP' feature pim ! interface ex/x ip pim sparse-dense-mode ! ip pim rp-address 1.1.1.1 20 ! rp-address + access-list !SPARSE-MODE AUTO-RP - CANDIDATE AND MAPPING AGENT feature pim ! interface ex/x ip pim sparse-dense-mode ! ip pim rp-address 1.1.1.1 20 ! rp-address + access-list ip pim send-rp-discovery Loopback0 scope 32 ! For the rp mapping-agent - agent sends discovery messages to 224.0.1.40 ip pim send-rp-announce Loopback0 scope 32 group-list 10 ! For the rp candidate_rp - sends messages to 224.0.1.39 to become RP for groups in '10' ! access-list 10 permit 224.0.0.0 15.255.255.255 access-list 20 deny 224.0.1.39 access-list 20 deny 224.0.1.40 ! ip pim auto-rp listen
!SSM - TODO
!BIDIR - This goes in all the participants feature pim ! ip pim bidir-enable ip pim rp-address 10.0.1.1 45 bidir
DEBUG COMMANDS:
access-list 2239 permit ip any host 239.1.1.1 debug ip packet 2239 detail !
TROUBLESHOOTING:
show ip pim rpm 6.6.6.6 ! ios show ip route rpf 6.6.6.6 ! nxos
show ip mroute
First thing in the output is the ‘state’:
(S,G) or (*,G) In Arista : S (meaning (S,G) or 0.0.0.0 meaning (*,G))
# << EXPLAIN MAIN FLAGS MEANING * D--Dense. Entry is operating in dense mode. * S--Sparse. Entry is operating in sparse mode. * s-- ssm * B--Bidir Group. Indicates that a multicast group is operating in bidirectional mode. * s--SSM Group. Indicates that a multicast group is within the SSM range of IP addresses. This flag is reset if the SSM range changes. * C--Connected. A member of the multicast group is present on the directly connected interface. * L--Local. The router itself is a member of the multicast group. Groups are joined locally by the ip igmp join-group (for the configured group), the ip sap listen command (for the well-known session directory groups), and rendezvous point (RP) mapping (for the well-known groups 224.0.1.39 and 224.0.1.40). Locally joined groups are not fast switched. * P--Pruned. Route has been pruned. The Cisco IOS software keeps this information so that a downstream member can join the source. * R--RP-bit set. Indicates that the (S, G) entry is pointing toward the RP. This flag typically indicates a prune state along the shared tree for a particular source. * **T--SPT-bit**. Indicates that packets have been received on the shortest path source tree. * **J--Join SPT**. For (*, G) entries, indicates that the rate of traffic flowing down the shared tree is exceeding the SPT-Threshold set for the group. (The default SPT-Threshold setting is 0 kbps).When the J - Join shortest path tree (SPT) flag is set, the next (*, G) packet received down the shared tree triggers an (S, G) join in the direction of the source, thereby causing the router to join the source tree.
show ip rpf 2.2.2.2 # Cisco and frr sh ip route rpf unicast 10.240.0.50 # Arista
If ECMP are available, the RPF for the multicast traffic will be based on highest IP address for the RPF neighbor
SERVER SIDE TOOLS (generate multicast traffic):
If we cannot install anything (and we have pyton3 we can paste these scripts:
GENERATING MULTICAST TRAFFIC
#!/usr/bin/python3 import socket # Usage in bash : 'while true; do ./msend.py; sleep 2; done' MCAST_GRP = '239.1.1.1' MCAST_PORT = 5007 # regarding socket.IP_MULTICAST_TTL # --------------------------------- # for all packets sent, after two hops on the network the packet will not # be re-sent/broadcast (see https://www.tldp.org/HOWTO/Multicast-HOWTO-6.html) MULTICAST_TTL = 250 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, MULTICAST_TTL) # For Python 3, change next line to 'sock.sendto(b"robot", ...' to avoid the # "bytes-like object is required" msg (https://stackoverflow.com/a/42612820) sock.sendto(b"robot", (MCAST_GRP, MCAST_PORT)) ! ! Execute from the cli with: while true; do ./msend.py; sleep 2; done
SUBSCRIBING TO MULTICAST STREAM
#!/usr/bin/python3
import socket
import struct
import sys
multicast_group = '239.1.1.1'
server_address = ('', 5007)
# Create the socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Bind to the server address
sock.bind(server_address)
# Tell the operating system to add the socket to the multicast group
# on all interfaces.
group = socket.inet_aton(multicast_group)
mreq = struct.pack('4sL', group, socket.INADDR_ANY)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
while True:
print('\nwaiting to receive message', file=sys.stderr)
data, address = sock.recvfrom(1024)
print('\nreceived ' + str(len(data)) + ' bytes from ' + ''.join(str(address)), file=sys.stderr)
print(data, file=sys.stderr)
# string = “AcK”
# string_utf = string.encode()
# print('\nsending ack to ' + .join(str(address)), file=sys.stderr)
# sock.sendto(string_utf, address)
If we can, install IPERF'':
iperf -c 224.0.0.1 -u -B 10.1.0.54 -t 3600 -T 255 # traffic for this group from this address (needs to belong to the switch)
PRESENTATIONS:
MULTICAST IN ARISTA:
This is for static and BSR RP:
interface Vlan100
ip address 10.1.8.3/24
pim ipv4 sparse-mode
! static
router pim sparse-mode
ipv4
rp address 10.0.0.3
! BSR
router pim sparse-mode
ipv4
rp candidate Vlan100 235.1.1.0/24 priority 48 interval 45
router pim bsr
ipv4
candidate Vlan100 priority 192 hashmask 30 interval 30
MULTICAST IN IOS-XR:
router pim address-family ipv4 rp-address 10.0.100.2 spt-threshold infinity ssm disable
IPV6 MULTICAST
ipv6 multicast-routing show ipv6 mroute ! show ipv6 pim neighbor ! show ipv6 mld group show ipv6 mld interface g0/0 show ipv6 mld traffic
BIER (bit indexed explicit replication)
https://www.linkedin.com/posts/mc36mc36_bit-indexed-explicit-replication-aka-next-next-gen-activity-7024219343123062784--sG9?utm_source=share&utm_medium=member_desktop