Showing posts with label Multicast. Show all posts
Showing posts with label Multicast. Show all posts

Wednesday, 1 January 2020

PIM Dense Mode



Before doing any multicast stuff first I want to generate the multicast traffic from R7
R7#ping
Protocol [ip]:
Target IP address: 224.2.2.2
Repeat count [1]: 100000000
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Interface [All]: loopback0
Time to live [255]:
Source address: 7.7.7.7
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 100000000, 100-byte ICMP Echos to 224.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 7.7.7.7
........................................

The traffic getting drop because we know we don’t have any receiver yet. Now lets enable the PIM Dense mode on R1 andR2.

R1(config)#ip multicast-routing
R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#ip ospf 1 a 0
R1(config-if)#ip pim de
R1(config-if)#int s0/0
R1(config-if)#ip add 155.1.17.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#ip ospf 1 a 0
R1(config-if)#ip pim de
R1(config-if)#int s0/1
R1(config-if)#ip add 155.1.12.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#ip ospf 1 a 0
R1(config-if)#ip pim de
R1(config-if)#int s0/2
R1(config-if)#ip add 155.1.13.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#ip ospf 1 a 0

R2(config)#ip multicast-routing
R2(config)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config-if)#ip ospf 1 a 0
R2(config-if)#ip pim de
R2(config-if)#int s0/0
R2(config-if)#ip add 155.1.12.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#ip ospf 1 a 0
R2(config-if)#ip pim de
R2(config-if)#int s0/1
R2(config-if)#ip add 155.1.23.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#ip ospf 1 a 0
R2(config-if)#ip pim de

Like any neighborship in IGP, Pim also has a neighbor state to maintain their details
Lets check the pim neighbor details

R2#sh ip pim interface

Address          Interface                Ver/   Nbr    Query  DR     DR
                                          Mode   Count  Intvl  Prior
2.2.2.2          Loopback0                v2/D   0      30     1      2.2.2.2
155.1.12.2       Serial0/0                v2/D   1      30     1      0.0.0.0
155.1.23.2       Serial0/1                v2/D   0      30     1      0.0.0.0

R2#sh ip pim ne
PIM Neighbor Table
Mode: B - Bidir Capable, DR - Designated Router, N - Default DR Priority,
      S - State Refresh Capable
Neighbor          Interface                Uptime/Expires    Ver   DR
Address                                                            Prio/Mode
155.1.12.1        Serial0/0                00:04:26/00:01:17 v2    1 / S
R2#

Lets check the routing table for multicast as we are running the PIM Dense mode. Every router on the path has a (S,G) entry in the mroute table.





R1#sh ip mroute
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
       L - Local, P - Pruned, R - RP-bit set, F - Register flag,
       T - SPT-bit set, J - Join SPT, M - MSDP created entry,
       X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
       U - URD, I - Received Source Specific Host Report,
       Z - Multicast Tunnel, z - MDT-data group sender,
       Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched, A - Assert winner
 Timers: Uptime/Expires
 Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 224.2.2.2), 00:04:43/stopped, RP 0.0.0.0, flags: D
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/1, Forward/Dense, 00:04:43/00:00:00
    Serial0/0, Forward/Dense, 00:04:43/00:00:00

(7.7.7.7, 224.2.2.2), 00:01:39/00:01:28, flags: PT
  Incoming interface: Serial0/0, RPF nbr 155.1.17.7
  Outgoing interface list:
    Serial0/1, Prune/Dense, 00:01:41/00:01:23

(*, 224.0.1.40), 00:07:11/00:02:02, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/1, Forward/Dense, 00:05:49/00:00:00
    Serial0/0, Forward/Dense, 00:07:07/00:00:00
    Loopback0, Forward/Dense, 00:07:11/00:00:00

R1#

R2#sh ip mroute
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
       L - Local, P - Pruned, R - RP-bit set, F - Register flag,
       T - SPT-bit set, J - Join SPT, M - MSDP created entry,
       X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
       U - URD, I - Received Source Specific Host Report,
       Z - Multicast Tunnel, z - MDT-data group sender,
       Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched, A - Assert winner
 Timers: Uptime/Expires
 Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 224.2.2.2), 00:05:03/stopped, RP 0.0.0.0, flags: D
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/0, Forward/Dense, 00:05:03/00:00:00

(7.7.7.7, 224.2.2.2), 00:01:59/00:01:00, flags: PT
  Incoming interface: Serial0/0, RPF nbr 155.1.12.1
  Outgoing interface list: Null

(*, 224.0.1.40), 00:06:12/00:02:32, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/0, Forward/Dense, 00:06:08/00:00:00
    Loopback0, Forward/Dense, 00:06:14/00:00:00

R2#
Note: This (S,G) entry will be pruned but after the prune timer expire multicast feed will come again and R2 will prune it again. This prune msg sent for every 3 min.

Now lets see the PIM Prune msg sent from R2 to R1.


Lets create a client on R2 and check what happens.


R2(config)#int lo0
R2(config-if)#ip igmp join-group 224.2.2.2

Now we have a client for this group 224.2.2.2 so R2 should not prune the multicast feed.
R2#sh ip mro
*Mar  1 00:28:57.239: %SYS-5-CONFIG_I: Configured from console by console
R2#sh ip mro
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
       L - Local, P - Pruned, R - RP-bit set, F - Register flag,
       T - SPT-bit set, J - Join SPT, M - MSDP created entry,
       X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
       U - URD, I - Received Source Specific Host Report,
       Z - Multicast Tunnel, z - MDT-data group sender,
       Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched, A - Assert winner
 Timers: Uptime/Expires
 Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 224.2.2.2), 00:21:28/stopped, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Loopback0, Forward/Dense, 00:00:57/00:00:00
    Serial0/0, Forward/Dense, 00:21:28/00:00:00

(7.7.7.7, 224.2.2.2), 00:02:58/00:02:59, flags: LT
  Incoming interface: Serial0/0, RPF nbr 155.1.12.1
  Outgoing interface list:
    Loopback0, Forward/Dense, 00:00:59/00:00:00

(*, 224.0.1.40), 00:22:39/00:02:08, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/0, Forward/Dense, 00:22:33/00:00:00
    Loopback0, Forward/Dense, 00:22:39/00:00:00

R2#

See the outgoing interface has been updated as loopback0 interface. Since R2 got the IGMP Join but R2 prune time didn’t expire so R2 will wait until the prune timer expire to avoid this R2 will generate the PIM GRAFT msg and send to R1 to converge fast


R1 will ack it with PIM GRAFT ACK msg.


R2 and R1 will remove the (S,G) as Prune.


R1#sh ip mroute
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
       L - Local, P - Pruned, R - RP-bit set, F - Register flag,
       T - SPT-bit set, J - Join SPT, M - MSDP created entry,
       X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
       U - URD, I - Received Source Specific Host Report,
       Z - Multicast Tunnel, z - MDT-data group sender,
       Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched, A - Assert winner
 Timers: Uptime/Expires
 Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 224.2.2.2), 00:28:14/stopped, RP 0.0.0.0, flags: D
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/1, Forward/Dense, 00:28:14/00:00:00
    Serial0/0, Forward/Dense, 00:28:14/00:00:00

(7.7.7.7, 224.2.2.2), 00:12:52/00:02:56, flags: T
  Incoming interface: Serial0/0, RPF nbr 155.1.17.7
  Outgoing interface list:
    Serial0/1, Forward/Dense, 00:07:45/00:00:00

(*, 224.0.1.40), 00:30:42/00:02:25, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/1, Forward/Dense, 00:29:19/00:00:00
    Serial0/0, Forward/Dense, 00:30:38/00:00:00
    Loopback0, Forward/Dense, 00:30:42/00:00:00

R1#

R2#sh ip mroute
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
       L - Local, P - Pruned, R - RP-bit set, F - Register flag,
       T - SPT-bit set, J - Join SPT, M - MSDP created entry,
       X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
       U - URD, I - Received Source Specific Host Report,
       Z - Multicast Tunnel, z - MDT-data group sender,
       Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched, A - Assert winner
 Timers: Uptime/Expires
 Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 224.2.2.2), 00:28:10/stopped, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Loopback0, Forward/Dense, 00:07:39/00:00:00
    Serial0/0, Forward/Dense, 00:28:10/00:00:00

(7.7.7.7, 224.2.2.2), 00:09:40/00:02:58, flags: LT
  Incoming interface: Serial0/0, RPF nbr 155.1.12.1
  Outgoing interface list:
    Loopback0, Forward/Dense, 00:07:41/00:00:00

(*, 224.0.1.40), 00:29:21/00:02:24, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/0, Forward/Dense, 00:29:15/00:00:00
    Loopback0, Forward/Dense, 00:29:21/00:00:00

R2#

From R7 perspective it will be getting reply from R2's loopback0.
Reply to request 889 from 155.1.12.2, 172 ms
Reply to request 890 from 155.1.12.2, 68 ms
Reply to request 891 from 155.1.12.2, 148 ms
Reply to request 892 from 155.1.12.2, 212 ms
Reply to request 893 from 155.1.12.2, 100 ms

Now am removing the IGMP client on R2.
R2(config)#int lo0
R2(config-if)#no ip igmp join-group 224.2.2.2

Now I am configuring R3
R3(config)#ip multicast-routing
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.255
R3(config-if)#ip ospf 1 a 0
R3(config-if)#ip pim de
R3(config-if)#int s0/0
R3(config-if)#ip add 155.1.13.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#ip ospf 1 a 0
R3(config-if)#ip pim de
R3(config-if)#int s0/1
R3(config-if)#ip add 155.1.23.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#ip ospf 1 a 0
R3(config-if)#ip pim de



Now first check the mroute on R3.


R3#sh ip mroute
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
       L - Local, P - Pruned, R - RP-bit set, F - Register flag,
       T - SPT-bit set, J - Join SPT, M - MSDP created entry,
       X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
       U - URD, I - Received Source Specific Host Report,
       Z - Multicast Tunnel, z - MDT-data group sender,
       Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched, A - Assert winner
 Timers: Uptime/Expires
 Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 224.2.2.2), 00:02:27/stopped, RP 0.0.0.0, flags: D
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/1, Forward/Dense, 00:02:27/00:00:00
    Serial0/0, Forward/Dense, 00:02:27/00:00:00

(7.7.7.7, 224.2.2.2), 00:02:27/00:00:38, flags: PT
  Incoming interface: Serial0/0, RPF nbr 155.1.13.1
  Outgoing interface list:
    Serial0/1, Prune/Dense, 00:02:25/00:00:35, A

(*, 224.0.1.40), 00:02:41/00:02:46, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/0, Forward/Dense, 00:02:32/00:00:00
    Serial0/1, Forward/Dense, 00:02:32/00:00:00
    Loopback0, Forward/Dense, 00:02:41/00:00:00

R3#sh ip cef 7.7.7.7
7.7.7.7/32, version 12, epoch 0, cached adjacency to Serial0/0
0 packets, 0 bytes
  via 155.1.13.1, Serial0/0, 0 dependencies
    next hop 155.1.13.1, Serial0/0
    valid cached adjacency
R3#

Here note R3 having outgoing interface as serial0/1 only not serial0/0 Why???
Because R3 will check the RFP Check and on serial0/1 RPF check fails. Lets find out how?
On R3 first multicast feed come from 7.7.7.7 via serial s0/1, R3 will check the CEF table and finds out unicast routing on 7.7.7.7 to reach is reachable via serial0/1 or not if not RPF Check fails.

R3#sh ip cef 7.7.7.7
7.7.7.7/32, version 12, epoch 0, cached adjacency to Serial0/0
0 packets, 0 bytes
  via 155.1.13.1, Serial0/0, 0 dependencies
    next hop 155.1.13.1, Serial0/0
    valid cached adjacency

Since R3 CEF say to reach 7.7.7.7 is via serial 0/0. R3 will not put the serial 0/1 in the IIL(Incoming interface list).




Here R2 OIL is s0/1 and R3 OIL is S0/1. Assert will occur if any multicast feed received on the OIL of the particular Group.
R2 and R3 will be having a Assert and run the election between R2 and R3.





Assert election winner will be who having the lowest metric to reach the Source(7.7.7.7) if its tie, the tie breaker will be the  highest IP address.

Now from the packet capture we can see From R2 has a metric 129 and R3 also has a metric 129 but highest IP Address is R3(155.1.23.3). R3 will be the Assert Winner.

R2#sh ip route 7.7.7.7 | in Route metric
      Route metric is 129, traffic share count is 1

R3#sh ip route 7.7.7.7 | in Route metric
      Route metric is 129, traffic share count is 1

R3#sh ip mr
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
       L - Local, P - Pruned, R - RP-bit set, F - Register flag,
       T - SPT-bit set, J - Join SPT, M - MSDP created entry,
       X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
       U - URD, I - Received Source Specific Host Report,
       Z - Multicast Tunnel, z - MDT-data group sender,
       Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched, A - Assert winner
 Timers: Uptime/Expires
 Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 224.2.2.2), 00:38:04/stopped, RP 0.0.0.0, flags: D
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/1, Forward/Dense, 00:29:24/00:00:00
    Serial0/0, Forward/Dense, 00:38:04/00:00:00

(7.7.7.7, 224.2.2.2), 00:13:38/00:01:41, flags: PT
  Incoming interface: Serial0/0, RPF nbr 155.1.13.1
  Outgoing interface list:
    Serial0/1, Prune/Dense, 00:01:21/00:01:39, A

(*, 224.0.1.40), 00:38:18/00:02:13, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Serial0/1, Forward/Dense, 00:29:25/00:00:00
    Serial0/0, Forward/Dense, 00:38:08/00:00:00
    Loopback0, Forward/Dense, 00:38:18/00:00:00

Now lets enable a IGMP Client from R3's loopback 0.

R3(config)#int lo0
R3(config-if)#ip igmp join-group 224.2.2.2

From R7 perspective it will be getting reply from R3's loopback0.
Reply to request 2212 from 155.1.13.3, 76 ms
Reply to request 2213 from 155.1.13.3, 116 ms
Reply to request 2214 from 155.1.13.3, 128 ms
Reply to request 2215 from 155.1.13.3, 128 ms
Reply to request 2216 from 155.1.13.3, 244 ms
Reply to request 2217 from 155.1.13.3, 192 ms
Reply to request 2218 from 155.1.13.3, 124 ms

Boot Strap Router (BSR)


Note: BSR doesn't need this 224.0.1.39 and 224.0.0.14 because its uses unicast PIMv2.
Space inside the pimv2 it has info for RP and BSR.



Here R4 is the BSR and R2 and R3 are the candidate RP

Lets configure the BSR Router
R4(config)#ip pim bsr-candidate loopback 0


As soon as we configure the RP and BSR. PIMv2 packet has the info of who is the BSR and candidate RP
Lets look at the Packet details




Initially BSR doesn't know about the candidate RP therefore its just publishing the BSR info. As we configure the BSR on R4's loopback address.


Now configure the Candidate RP
R2(config)#ip pim rp-candidate loopback 0
R3(config)#ip pim rp-candidate loopback 0



BSR info got populated hop by hop hence R2 and R3 aware of BSR info. As soon as we configure the candidate RP it will send the unicast PIMv2 to R4 with the TTL 255.

BSR now advertise the know candidate RP info to all



This packet info explains clearly that R3 and R2 are the RP for group 224.0.0.0/4. But for the group 224.0.0.0/4 we have two RP which one it will take the is the question now?
To test this just send some multicast feed. Here the source is R7

R7#ping
Protocol [ip]:
Target IP address: 224.1.1.1
Repeat count [1]: 1000000000
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: yes
Interface [All]: loopback0
Time to live [255]:
Source address: 7.7.7.7
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 1000000000, 100-byte ICMP Echos to 224.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 7.7.7.7
...............................................


Lets check which RP knows about the group 224.1.1.1

R3#smr 224.1.1.1
Group 224.1.1.1 not found

R2#sh ip mroute 224.1.1.1 | b Int
 Interface state: Interface, Next-Hop or VCD, State/Mode
(*, 224.1.1.1), 00:02:03/stopped, RP 2.2.2.2, flags: SP
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list: Null
(7.7.7.7, 224.1.1.1), 00:02:03/00:02:57, flags: P
  Incoming interface: Serial1/0, RPF nbr 155.1.12.1
  Outgoing interface list: Null
R2#

As both the priority are same so the next tie breaker is lowest IP that’s is the reason its choosing the R2.
To test this more we will inc the priority of R2
R2(config)#ip pim rp-candidate loopback 0 priority 20

R2#sh ip mroute 224.1.1.1
Group 224.1.1.1 not found

R3#smr 224.1.1.1 | be In
 Interface state: Interface, Next-Hop or VCD, State/Mode
(*, 224.1.1.1), 00:00:29/stopped, RP 3.3.3.3, flags: SP
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list: Null
(7.7.7.7, 224.1.1.1), 00:00:29/00:02:30, flags: P
  Incoming interface: Serial1/0, RPF nbr 155.1.13.1
  Outgoing interface list: Null

So the lowest priority taking the precedence over higher.
RP selection process
Lowest priority>Lowest RP IP address