• Stars
    star
    194
  • Rank 200,219 (Top 4 %)
  • Language
    C
  • License
    BSD 3-Clause "New...
  • Created almost 15 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PIM-SM/SSM multicast routing for UNIX and Linux

PIM-SM/SSM Multicast Routing for UNIX

License Badge GitHub Status Coverity Status

Table of Contents

Introduction

pimd is a lightweight, stand-alone PIM-SM/SSM multicast routing daemon available under the free 3-clause BSD license. This is the restored original version from University of Southern California, by Ahmed Helmy, Rusty Eddy and Pavlin Ivanov Radoslavov.

Today pimd is maintained at GitHub. This is the preferred way to download releases, access the GIT sources, report bugs, and send patches or pull requests. Official release tarballs at the homepage and at the GitHub project's release directory.

pimd is developed on Linux and should work as-is out of the box on all major distributions. Other UNIX variants; NetBSD, FreeBSD, and Illumos, may also work, but do not receive the same amount of testing.

pimd ships with a useful pimctl tool, compatible with all PIM daemons from the same family: pimd, pimd-dense, pim6sd. It can be a very helpful little tool when debugging and learning PIM setups. The pimctl API is documented in the file src/ipc.c, in case you want to use socat to talk to pimd over its UNIX domain socket:

echo "help" |socat - UNIX-CONNECT:/var/run/pimd.sock

For a summary of changes for each release, see the ChangeLog.

Configuration

The configuration is kept in the file /etc/pimd.conf, the order of the statements are in some cases important.

PIM-SM is a designed to be a protocol independent multicast routing protocol. As such it relies on unicast protocols like, e.g, OSPF, RIP, or static routing entries to figure out the reverse path to multicast sources. This information is necessary in setups with more than one route between a multicast sender and a receiver to figure out which PIM router should be the active forwarder.

However, pimd currently cannot retrieve the unicast routing distance (preference) and metric of routes from the system, not from the kernel nor a route manager like zebra. Hence, pimd currently needs to be setup statically on each router using the desired distance and metric for each active interface. If either the distance and/or the metric is missing in an interface configuration, the following two defaults will be used:

default-route-distance   <1-255>     default: 101
default-route-metric     <1-1024>    default: 1024

By default pimd starts up on all interfaces it can find, using the above defaults. To configure individual interfaces use:

phyint <address | ifname> ...

You can reference the interface via either its local IPv4 address or its name, e.g., eth0. Some common interface settings are:

  • disable: Disable pimd on this interface, i.e., do not send or listen for PIM-SM traffic

  • dr-priority <1-4294967294>: The DR Priority option, sent in all all PIM Hello messages. Used instead of the IP address in all DR elections, if all PIM routers in LAN advertise it. The higher, the better, default 1.

  • distance <1-255>: The interface's admin distance value (also confusingly referred to as metric preference in the RFC) in PIM Assert messages. Used with metric to elect the active multicast forwarding router. Defaults to default-route-distance

  • metric <1-1024>: The cost for traversing this router. Used with the preference value above. Defaults to default-route-metric

More interface settings are available, see the pimd(8) manual page for the full details.

The most notable feature of PIM-SM is that multicast is distributed from so called Rendezvous Points (RP). Each RP handles distribution of one or more multicast groups, pimd can be configured to advertise itself as a candidate RP rp-candidate, and request to be static RP rp-address for one or more multicast groups.

rp-address <address> [<group>[/<LENGTH> | masklen <LENGTH]

The rp-address setting is the same as the Cisco ip pim rp-address setting to configure static Rendezvous Points. The first argument can be an IPv4 address or a multicast group address. The default group and prefix length is 224.0.0.0/16. Static RP's always have priority 1.

rp-candidate [address | ifname] [interval <10-16383>] [priority <0-255>] \
             [group-prefix <group>[</LENGTH> | masklen <LENGTH>]]

The Rendezvous Point candidate, or CRP, setting is the same as the Cisco ip pim rp-candidate setting. Use it to control which interface that should be used in RP elections.

  • address | ifname: Optional local IPv4 address, or interface name to acquire address from. The default is to use the highest active IP address.

  • interval <10-16383>: The CRP advertisement interval, in seconds. Default: 60 seconds

  • priority <0-255>: How important this CRP is compared to others. The lower the value here, the more important the CRP. Like Cisco, pimd defaults to priority 0 when this is left out

In the CRP messages sent out by pimd, one or more multicast groups can be advertised using the following syntax.

group-prefix <group>[</LENGTH> | masklen <LENGTH>]

Each group-prefix setting defines one multicast group and an optional mask length, which defaults to 16 if left out. A maximum of 255 multicast group prefix records is possible for the CRP.

To keep track of all Rendezvous Points in a PIM-SM domain there exists a feature called Bootstrap Router. The elected BSR in a PIM-SM domain periodically announces the RP set in Bootstrap messages. For details on PIM BSR operation, see RFC 5059.

bsr-candidate [address | ifname] [priority <0-255>] [interval <10-26214>]

The configuration of a Candidate BootStrap Router (CBSR) is very similar to that of CRP. If either the address or the interface name is left out pimd uses the highest active IP address. If the priority is omitted, pimd (like Cisco) defaults to priority 0. If the interval is omitted, it defaults to the RFC value of 60 seconds.

In a PIM-SM domain there can be two, or more, paths from a designated router (DR) for a multicast sender to reach a receiver. When receivers begin joining multicast groups all data is received via the shared tree (RPT) from each Rendezvous Point (RP). This is often not an optimal route, so when the volume starts exceeding a configurable threshold, on either the last-hop router or the RP itself, the router will attempt to switch to the shortest path tree (SPT) from the multicast source to the receiver.

In versions of pimd prior to 2.2.0 this threshold was confusingly split in two different settings, one for the DR and one for the RP. These settings are still supported, for compatibility reasons and documented in the man-page, but it is strongly recommended to change to the new syntax instead:

spt-threshold [rate <KBPS> | packets <NUM> | infinity] [interval <5-60>]

Only slightly different from the Cisco ip pim spt-threshold setting, pimd can trigger a switch to SPT on a rate or number of packets and you can also tweak the poll interval. It's recommended to keep the interval in the tens of seconds, the default is 100 sec. The default threshold is set to zero packets, which will cause a switch over to the SPT after the first multicast packet is received.

Example

# Interface eth0 is disabled, i.e., pimd will not run there.
phyint eth0 disable

# On this LAN we have a lower numeric IP than other PIM routers
# but we want to take care of forwarding all PIM messages.
phyint eth1 dr-priority 10

# Partake in BSR elections on eth1
bsr-candidate eth1

# Offer to be an RP for all of 224.0.0.0/4
rp-candidate eth1
group-prefix 224.0.0.0 masklen 4

# This is the built-in defaults, switch to SPT on first packet
spt-threshold packets 0 interval 100

Running pimd

Having set up the configuration file, you are ready to run pimd. As usual, it is recommended that you start it manually first, to make sure everything works as expected, before adding it to your system's startup scripts, with any startup flags it might need.

pimd [-hnrsv] [-f file] [-d subsys1[,...,subsysN]] [-l level]
  • -n: Run in foreground, with logs to stdout (for systemd and finit)
  • -s: Use syslog, default unless -n
  • -c file: Utilize the specified configuration file rather than the default, /etc/pimd.conf
  • -d [subsys1,...,subsysN]: Subsystems to enable debug for when running the daemon. Optional argument, if left out, all subsystems are enabled. Type pimd -h for a full list of subsystems
  • -l level: Log level, one of none, error, warning, notice, info, or debug. Default is notice

Example:

pimd -f /cfg/pimd.conf

When running multiple instances of pimd, make sure to use the -I ident argument, otherwise the PID and IPC socket files will be overwritten and the syslog will also be hard to follow. Note, -I changes the default .conf filename pimd looks for as well, a complete identity change.

Enabling Debug

Remember to set the correct log level when enabling debug messages, usually you need -l debug, and -s to force messages to syslog when running in the foreground (-n).

pimd -d igmp_proto,pim_jp,kernel,pim_register -l debug -n -s

Troubleshooting Checklist

  1. Check the TTL of incoming multicast. Remember, the TTL of the multicast stream must be >1 to be routed. Or rather, > than then ttl-threshold of the inbound phyint

  2. If you see Permission denied in your logs, you are most likely having firewall, or SELinux, problems

  3. For PIM-SM, make sure you have a Rendezvous-Point (RP) in your network. Check rp-candidate (CRP) and bsr-candidate (CBSR) settings in your pimd.conf, or rp-address if you prefer the static RP approach

  4. Check the Linux rp_filter setting. Many Linux systems have the "strict" setting enabled, "loose" can work but may cause problems in some setups. We recommend disabling it entirely

  5. PIM is protocol independent so you must have unicast routeing in place already for pimd to work. Use ping to verify connectivity between multicast sender and receiver

Monitoring

To see the virtual interface table, including neighboring PIM routers, and the multicast routing table:

pimctl show interfaces
pimctl show neighbor
pimctl show mrt
...

The default command is pimctl show pim. To watch it continually (notice the -c flag to watch(1) to tell it to interpret the ANSI escape sequences):

watch -cd pimctl

See the pimctl help usage text for more commands (available only when a running PIM daemon is available), or the pimctl(8) man page.

Also worth mentioning, pimd logs important events to the system log, in particular at startup when it parses the pimd.conf configuration file.

Large Setups

pimd is limited to the number of MAXVIFS interfaces listed in the kernel headers. In Linux see /usr/include/linux/mroute.h.

To overcome this limitation, adjust the kernel #define to, e.g., 1280, and configure pimd --with-max-vifs=1280. Please note, this has only been tested with Linux and will likely not work with other kernels!

With this many interfaces the kernel may run out of memory to let pimd to enable IGMP on all interfaces. In Linux, use sysctl to tweak the following settings:

sysctl -w net.core.optmem_max=327680
sysctl -w net.ipv4.igmp_max_memberships=5120

Build & Install

The configure script and Makefile supports de facto standard settings and environment variables such as --prefix=PATH and DESTDIR= for the install process. E.g., to install pimd to /usr instead of the default /usr/local, but redirect install to a package directory in /tmp:

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
make DESTDIR=/tmp/pimd-2.3.2-1 install-strip

Building from GIT

If you want to contribute, or simply just try out the latest but unreleased features, then you need to know a few things about the GNU build system:

  • configure.ac and a per-directory Makefile.am are key files
  • configure and Makefile.in are generated from autogen.sh
  • Makefile is generated by configure script

To build from GIT you first need to clone the repository and run the autogen.sh script. This requires automake and autoconf to be installed on your system.

git clone https://github.com/troglobit/pimd.git
cd pimd/
./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var && make

GIT sources are a moving target and are not recommended for production systems, unless you know what you are doing!

Contributing

pimd is maintained by Joachim Wiberg at GitHub. If you find bugs, have feature requests, or want to contribute fixes or features, check out the code from GitHub:

git clone https://github.com/troglobit/pimd
cd pimd

See the file CONTRIBUTING.md for further details.

Origin & References

Part of this program has been derived from mrouted. The mrouted program is covered by the 3-clause BSD license in the accompanying file named LICENSE.mrouted.

The mrouted program is COPYRIGHT 2002 by The Board of Trustees of Leland Stanford Junior University.

More Repositories

1

inadyn

In-a-Dyn is a dynamic DNS client with multiple SSL/TLS library support
C
782
star
2

finit

Fast init for Linux. Cookies included
C
576
star
3

redir

A TCP port redirector for UNIX
C
349
star
4

mg

Micro (GNU) Emacs-like text editor ❀️ public-domain
C
293
star
5

editline

A small replacement for GNU readline() for UNIX
C
254
star
6

libuev

Lightweight event loop library for Linux epoll() family APIs
C
218
star
7

smcroute

Static multicast routing for UNIX
C
216
star
8

watchdogd

Advanced system monitor & process supervisor for Linux
C
193
star
9

uftpd

FTP/TFTP server for Linux that just worksβ„’
C
162
star
10

mcjoin

Simple multicast testing application
C
130
star
11

merecat

Small and made-easy HTTP/HTTPS server based on Jef Poskanzer's thttpd
C
129
star
12

tetris

Micro Tetrisβ„’, based on the 1989 IOCCC Obfuscated Tetris by John Tromp
C
107
star
13

uredir

A UDP port redirector for UNIX
C
87
star
14

myLinux

myLinux is an embedded operating system based on Buildroot and Finit
Shell
73
star
15

sysklogd

BSD syslog daemon with syslog()/syslogp() API replacement for Linux, RFC3164 + RFC5424
C
71
star
16

mtools

Tools for multicast testing (msend and mreceive). I do however recommend you try out mcjoin(!) or mping instead.
C
69
star
17

mrouted

The original DVMRP (dynamic multicast routing) implementation for UNIX
C
65
star
18

mini-snmpd

A minimal SNMP agent implementation
C
63
star
19

netcalc

Simplified clone of sipcalc with ipcalc looks
C
60
star
20

xplugd

Monitor, keyboard, and mouse plug/unplug helper for X
C
59
star
21

libite

That missing frog DNA you've been looking for
C
58
star
22

ssdp-responder

SSDP responder for UNIX systems that gives you an InternetGatewayDevice icon in Windows :)
C
53
star
23

mdnsd

Jeremie Miller's original mdnsd
C
49
star
24

sntpd

sntpd is a fork of Larry Doolittle's ntpclient with added daemon, syslog, and IPv6 support
C
42
star
25

adventure

Classic Colossal Cave Adventure
C
42
star
26

omping

Open Multicast Ping (omping) is a tool for testing IPv4/IPv6 multicast connectivity on a LAN.
C
33
star
27

snake

Micro Snake, based on Simon Huggins snake game.
C
30
star
28

pok3r-layouts

Vortex POK3R keyboard layouts for Linux, Windows and OS X/macOS. Based on:
28
star
29

rfctl

Linux driver and control tool for 433 MHz communication on Raspberry Pi
C
25
star
30

sun

Simple library and application that shows sunset and sunrise based on your latitude,longitude
C
23
star
31

jush

just give me a unix shell
C
22
star
32

lipify

C API for http://ipify.org
C
19
star
33

pim6sd

PIM for IPv6 sparse mode daemon
C
19
star
34

tinyroot

Small busybox based embedded Linux root file system
Makefile
17
star
35

mping

A simple multicast ping program
C
17
star
36

pimd-dense

Continuation of the original pimd-dense from 1998-1999, gaps filled with frog DNA from pimd
C
14
star
37

pev

Portable Event Library
C
14
star
38

libicmp

Very simple library for sending and receiving ICMP datagrams.
C
13
star
39

backlight

Very simple program to control the backlight brightness of a laptop
C
13
star
40

getty

Minix getty
C
10
star
41

pacman

UNIX pacman game by Dave Nixon, AGS Computers Inc. (1981) with curses support by Mark Horton (1982)
C
10
star
42

uget

Really stupid get-file-over-http program/function
Shell
10
star
43

toolbox

Misc. home brewed code, free to use under GPL/MIT/ISC, see each snippet for license.
C
9
star
44

mrdisc

Stand alone UNIX implementation of RFC4286 Multicast Router Discovery Protocol
C
9
star
45

uemacs

MicroEMACS by Dave Conroy
C
8
star
46

aliens

UNIX aliens game by Jude Miller, Cambridge (1979) with curses support by Mark Horton (1981)
C
7
star
47

nlmon

Simple example of how to use libnl and libev to monitor kernel netlink events
C
7
star
48

quagga

Westermo Quagga. See security/0.99.17 branch for ported CVE fixes and westermo/0.99.17 for patches on top of that. For more information, see the Wiki.
C
7
star
49

keepalived

Health-checking for LVS and high availability
C
6
star
50

ttinfo

Display information about a process, group or tty
C
6
star
51

awesome-config

My awesome window manager configuration
Lua
5
star
52

finit-plugins

Plugin Repository for Finit
C
5
star
53

zoo

public domain zoo archive tool
C
5
star
54

logit

tiny log helper
C
5
star
55

MicroEMACS

MicroEMACS v3.6 by Dave Conroy and Daniel Lawrence from 1986. Free in the public domain.
C
5
star
56

cx

Small wrapper for basic lxc tasks
Shell
5
star
57

awesome-redshift

Ryan Young's small, simple lua library for interfacing the Awesome window manager with redshift
Lua
5
star
58

crobots

CROBOTS is a programming game, for (aspiring) programmers
C
5
star
59

gul

The one true GUL editor!
C
5
star
60

awesome-plain

Plain barebones AwesomeWM setup
Lua
4
star
61

usbctl

A user space tool to operate on USB devices.
C
4
star
62

mctools

Collection of (old) multicast tools
C
4
star
63

deb

Signing key(s) for .deb repository
3
star
64

booz

Zoo Extractor/Lister by Rahul Dhesi
C
3
star
65

sniffer

sniff packets from interface store in db for analysis
C
3
star
66

zroute

Very simple command line client for managing Zebra static routes from the command line. Useful if Zebra is your route manager and you want your DHCP client, or PPPoE client, to set default gateway dynamically via Zebra instead of as kernel routes.
C
3
star
67

libc-chaos

Emit random errors when calling libc functions to emulate an unstable underlying system
C
3
star
68

misc

Misc. helpers, in the public domain
Makefile
2
star
69

alpine-qemu-image

Create bootable Qemu images fro Alpine Linux ISO
Shell
2
star
70

ns

Example of how to use getaddrinfo()
C
2
star
71

awesome-light

Lua library for controlling screen and keyboard brightness from Awesome WM
Lua
2
star
72

plotty

Library for text terminal plotter
C
2
star
73

klish-plugin-sysrepo

Mirror of Serj Kalichev's klish plugins for sysrepo
C
2
star
74

faux

Mirror of Serj Kalichev's auxillary functions library
C
2
star
75

troglobit.github.io

Personal website and blog
CSS
2
star
76

demo

Collection of ASCII art demos
C
1
star
77

ubot

very small and stupid irc bot
C
1
star
78

awesome

My awesome-copycats adaptions
Lua
1
star
79

logrun

An event-based, regexp-triggered, job runner ...
Perl
1
star
80

klish

Mirror of Serj Kalichev's klish
C
1
star
81

br2-finit-demo

Demo of Finit (FastInit) in Buildroot
Makefile
1
star
82

zephyr-uart-test

Playground for the Zephyr UART
C
1
star
83

busybox-builder

busybox defconfig++ binaries
Shell
1
star
84

bridged

Linux bridge helper daemon
C
1
star
85

weatherd

Hackish weather data logger for my homemade Raspberry Pi based weather station
C
1
star