# PIM-SM Tunnel Interfaces

This will be a brief article covering PIM tunnel interfaces. Tunnel interfaces are used by PIM to encapsulate/decapsulate PIM Register messages.

Have you noticed the following output on a PIM router after you configure the RP address?

```
R3#
*Sep 19 13:59:43.417: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
```

This interface is automatically created on a PIM router when the RP address is known and is reachable. This is a special unidirectional tunnel interface which is used to encapsulate multicast traffic in a PIM Register message and unicast it to the RP. This process allows the RP to discover the source and then create a (S, G) tree rooted at the source. This tunnel interface is only used when the router is acting as a FHR.

If you think about it, the fact that this is a tunnel interface makes sense. The packet always has a single destination, the unicast address of the RP. The tunnel also adds a second header to the multicast packet. You could say it is PIM-in-IPv4 multicast encapsulation.

<figure><img src="https://1203572585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgAMH3CMtmYTBkob03NUj%2Fuploads%2FIG1rMbPxbv3on5u1W1Mv%2FUntitled.png?alt=media&#x26;token=648d8f02-3b62-4f1e-8f37-544fd937868a" alt=""><figcaption></figcaption></figure>

* The outer header is destined for 6.6.6.6. The encapsulated packet is the multicast traffic

You can see details about this tunnel interface using the following show commands:

```
R3#show ip pim tunnel 
Tunnel0* 
  Type       : PIM Encap
  RP         : 6.6.6.6
  Source     : 10.2.3.3
  State      : UP
  Last event : RP address reachable (00:02:31)


R3#show int tun0
Tunnel0 is up, line protocol is up 
  Hardware is Tunnel
  Description: Pim Register Tunnel (Encap) for RP 6.6.6.6
  Interface is unnumbered. Using address of GigabitEthernet1 (10.2.3.3)
  MTU 9972 bytes, BW 100 Kbit/sec, DLY 50000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive not set
  Tunnel linestate evaluation up
  Tunnel source 10.2.3.3 (GigabitEthernet1), destination 6.6.6.6
   Tunnel Subblocks:
      src-track:
         Tunnel0 source tracking subblock associated with GigabitEthernet1
          Set of tunnels with source GigabitEthernet1, 1 member (includes iterators), on interface <OK>
  Tunnel protocol/transport PIM/IPv4
  Tunnel TTL 255
  Tunnel transport MTU 1472 bytes
  Tunnel is transmit only
  Tunnel transmit bandwidth 8000 (kbps)
  Tunnel receive bandwidth 8000 (kbps)
  Last input never, output never, output hang never
  Last clearing of "show interface" counters 00:13:56
  Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/0 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles 
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     1 packets output, 128 bytes, 0 underruns
     Output 0 broadcasts (1 IP multicasts)
     0 output errors, 0 collisions, 0 interface resets
     0 unknown protocol drops
     0 output buffer failures, 0 output buffers swapped out
```

* Output packets increment for each PIM Register that is sent. The input packets should never increment because it is a unidirectional tunnel.

### RP Tunnel Interfaces

The RP creates two tunnel interfaces. The first is the default PIM Register tunnel which is actually to itself. The second is a PIM Register decapsulation tunnel. This is used to receive the PIM Register messages and decapsulate them to extract the multicast packet and forward it down the shared tree (if it exists).

```
R6#
*Sep 19 14:08:33.363: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
*Sep 19 14:08:33.407: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel1, changed state to up
```

```
R6#show ip pim tun
Tunnel0 
  Type       : PIM Encap
  RP         : 6.6.6.6*
  Source     : 10.1.6.6
  State      : UP
  Last event : Created (00:16:16)
Tunnel1* 
  Type       : PIM Decap
  RP         : 6.6.6.6*
  Source     : -
  State      : UP
  Last event : Created (00:16:16)


R6#show int tun1
Tunnel1 is up, line protocol is up 
  Hardware is Tunnel
  Description: Pim Register Tunnel (Decap) for RP 6.6.6.6
  Interface is unnumbered. Using address of Loopback0 (6.6.6.6)
  MTU 9980 bytes, BW 100 Kbit/sec, DLY 50000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive not set
  Tunnel linestate evaluation up
  Tunnel source 6.6.6.6 (Loopback0), destination 6.6.6.6
   Tunnel Subblocks:
      src-track:
         Tunnel1 source tracking subblock associated with Loopback0
          Set of tunnels with source Loopback0, 1 member (includes iterators), on interface <OK>
  Tunnel protocol/transport PIM/IPv4
  Tunnel TTL 255
  Tunnel transport MTU 1494 bytes
  Tunnel is receive only
  Tunnel transmit bandwidth 8000 (kbps)
  Tunnel receive bandwidth 8000 (kbps)
  Last input never, output never, output hang never
  Last clearing of "show interface" counters 00:17:18
  Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/0 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles 
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 packets output, 0 bytes, 0 underruns
     Output 0 broadcasts (0 IP multicasts)
     0 output errors, 0 collisions, 0 interface resets
     0 unknown protocol drops
     0 output buffer failures, 0 output buffers swapped out
```

* Interestingly, the input packet counter is not incrementing even though the RP has decapsulated Register packets.
