documentation:examples:multicast_with_pim-sm
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | documentation:examples:multicast_with_pim-sm [2017/06/26 00:24] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Multicast with PIM-SM ====== | ||
+ | This lab show a multicast routing example using BSDRP 1.59 (FreeBSD 10.2 and [[https:// | ||
+ | |||
+ | ===== Presentation ===== | ||
+ | |||
+ | ==== Network diagram ==== | ||
+ | |||
+ | Here is the logical and physical view: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===== Setting-up the lab ===== | ||
+ | |||
+ | ==== Downloading BSD Router Project images ==== | ||
+ | |||
+ | Download BSDRP serial image (prevent to have to use an X display) on Sourceforge. | ||
+ | |||
+ | ==== Download Lab scripts ===== | ||
+ | |||
+ | More information on these BSDRP lab scripts available on [[documentation: | ||
+ | |||
+ | Start the lab with 4 routers simulating an e1000 NIC (vtnet interface and they didn't support mcast routing on FreeBSD): | ||
+ | < | ||
+ | BSDRP-lab-bhyve.sh -n 4 -e -i BSDRP-1.702-full-amd64-serial.img.xz | ||
+ | BSD Router Project (http:// | ||
+ | Setting-up a virtual lab with 4 VM(s): | ||
+ | - Working directory: /tmp/BSDRP | ||
+ | - Each VM have 1 core(s) and 256M RAM | ||
+ | - Emulated NIC: e1000 | ||
+ | - Switch mode: bridge + tap | ||
+ | - 0 LAN(s) between all VM | ||
+ | - Full mesh Ethernet links between each VM | ||
+ | VM 1 have the following NIC: | ||
+ | - vtnet0 connected to VM 2 | ||
+ | - vtnet1 connected to VM 3 | ||
+ | - vtnet2 connected to VM 4 | ||
+ | VM 2 have the following NIC: | ||
+ | - vtnet0 connected to VM 1 | ||
+ | - vtnet1 connected to VM 3 | ||
+ | - vtnet2 connected to VM 4 | ||
+ | VM 3 have the following NIC: | ||
+ | - vtnet0 connected to VM 1 | ||
+ | - vtnet1 connected to VM 2 | ||
+ | - vtnet2 connected to VM 4 | ||
+ | VM 4 have the following NIC: | ||
+ | - vtnet0 connected to VM 1 | ||
+ | - vtnet1 connected to VM 2 | ||
+ | - vtnet2 connected to VM 3 | ||
+ | For connecting to VM' | ||
+ | - VM 1 : cu -l /dev/nmdm1B | ||
+ | - VM 2 : cu -l /dev/nmdm2B | ||
+ | - VM 3 : cu -l /dev/nmdm3B | ||
+ | - VM 4 : cu -l /dev/nmdm4B | ||
+ | </ | ||
+ | |||
+ | ===== Routers configuration ===== | ||
+ | |||
+ | ==== Router 1 ==== | ||
+ | |||
+ | Configuration: | ||
+ | < | ||
+ | sysrc hostname=R1 | ||
+ | sysrc gateway_enable=NO | ||
+ | sysrc ipv6_gateway_enable=NO | ||
+ | sysrc ifconfig_em0=" | ||
+ | sysrc defaultrouter=" | ||
+ | hostname R1 | ||
+ | service netif restart | ||
+ | service routing restart | ||
+ | config save | ||
+ | </ | ||
+ | ==== Router 2 ==== | ||
+ | |||
+ | R2 is a PIM router that < | ||
+ | |||
+ | < | ||
+ | sysrc hostname=R2 | ||
+ | sysrc ifconfig_em0=" | ||
+ | sysrc ifconfig_em1=" | ||
+ | sysrc defaultrouter=" | ||
+ | sysrc pimd_enable=YES | ||
+ | |||
+ | cat > / | ||
+ | # | ||
+ | rp-address 10.0.23.2 | ||
+ | |||
+ | EOF | ||
+ | |||
+ | hostname R2 | ||
+ | service netif restart | ||
+ | service routing restart | ||
+ | service pimd start | ||
+ | config save | ||
+ | </ | ||
+ | ==== Router 3 ==== | ||
+ | |||
+ | We would R3 < | ||
+ | |||
+ | < | ||
+ | sysrc hostname=R3 | ||
+ | sysrc ifconfig_em1=" | ||
+ | sysrc ifconfig_em2=" | ||
+ | sysrc defaultrouter=" | ||
+ | sysrc pimd_enable=YES | ||
+ | |||
+ | cat > / | ||
+ | # | ||
+ | rp-address 10.0.23.2 | ||
+ | EOF | ||
+ | |||
+ | hostname R3 | ||
+ | service netif restart | ||
+ | service routing restart | ||
+ | service pimd start | ||
+ | config save | ||
+ | </ | ||
+ | ==== Router 4 ==== | ||
+ | |||
+ | < | ||
+ | sysrc hostname=R4 | ||
+ | sysrc gateway_enable=NO | ||
+ | sysrc ipv6_gateway_enable=NO | ||
+ | sysrc ifconfig_em2=" | ||
+ | sysrc defaultrouter=" | ||
+ | hostname R4 | ||
+ | service netif restart | ||
+ | service routing restart | ||
+ | config save | ||
+ | </ | ||
+ | |||
+ | ===== Checking pimd behavior ===== | ||
+ | |||
+ | ==== PIM neighbors ==== | ||
+ | |||
+ | Does the PIM routers see each others ? | ||
+ | |||
+ | < | ||
+ | [root@R2]~# pimd -r | ||
+ | Virtual Interface Table | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Multicast Routing Table | ||
+ | | ||
+ | --------------------------(*, | ||
+ | Number of Groups: 0 | ||
+ | Number of Cache MIRRORs: 0 | ||
+ | </ | ||
+ | |||
+ | => R2 sees R3 | ||
+ | |||
+ | < | ||
+ | [root@R3]~# pimd -r | ||
+ | Virtual Interface Table | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Multicast Routing Table | ||
+ | | ||
+ | --------------------------(*, | ||
+ | Number of Groups: 0 | ||
+ | Number of Cache MIRRORs: 0 | ||
+ | </ | ||
+ | |||
+ | => R3 sees R2. | ||
+ | ==== Does PIM daemon locally register to PIM mcast group ? ==== | ||
+ | |||
+ | PIM router need to register to 224.0.0.13 mcast group, check if all PIM routers correctly display this group on their enabled interfaces: | ||
+ | |||
+ | < | ||
+ | [root@R2]~# ifmcstat | ||
+ | em0: | ||
+ | inet 10.0.12.2 | ||
+ | igmpv2 | ||
+ | group 224.0.0.22 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.2 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.13 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.1 refcnt 1 state silent mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | inet6 fe80: | ||
+ | mldv2 flags=2< | ||
+ | group ff01:1::1 refcnt 1 | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | group ff02:1::1 refcnt 1 | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | em1: | ||
+ | inet 10.0.23.2 | ||
+ | igmpv2 | ||
+ | group 224.0.0.22 refcnt 1 state sleeping mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.2 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.13 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.1 refcnt 1 state silent mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | inet6 fe80: | ||
+ | mldv2 flags=2< | ||
+ | group ff01:2::1 refcnt 1 | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | group ff02:2::1 refcnt 1 | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | </ | ||
+ | < | ||
+ | [root@R3]~# ifmcstat | ||
+ | em0: | ||
+ | em1: | ||
+ | inet 10.0.23.3 | ||
+ | igmpv2 | ||
+ | group 224.0.0.22 refcnt 1 state sleeping mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.2 refcnt 1 state sleeping mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.13 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.1 refcnt 1 state silent mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | inet6 fe80: | ||
+ | mldv2 flags=2< | ||
+ | group ff01:2::1 refcnt 1 | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | group ff02:2::1 refcnt 1 | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | em2: | ||
+ | inet 10.0.34.3 | ||
+ | igmpv2 | ||
+ | group 224.0.0.22 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.2 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.13 refcnt 1 state lazy mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | group 224.0.0.1 refcnt 1 state silent mode exclude | ||
+ | mcast-macaddr 01: | ||
+ | inet6 fe80: | ||
+ | mldv2 flags=2< | ||
+ | group ff01:3::1 refcnt 1 | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | group ff02:3::1 refcnt 1 | ||
+ | mcast-macaddr 33: | ||
+ | group ff02: | ||
+ | mcast-macaddr 33: | ||
+ | |||
+ | </ | ||
+ | |||
+ | We correctly sees mcast group 224.0.0.13 subscribed on PIM enabled interfaces. | ||
+ | |||
+ | ===== Testing ===== | ||
+ | |||
+ | ==== 1. Sart a mcast generator (IPerf client) on R1 ==== | ||
+ | |||
+ | Start an iperf client to 239.1.1.1. | ||
+ | |||
+ | < | ||
+ | [root@R1]~# iperf -c 239.1.1.1 -u -T 32 -t 3000 -i 1 | ||
+ | ------------------------------------------------------------ | ||
+ | Client connecting to 239.1.1.1, UDP port 5001 | ||
+ | Sending 1470 byte datagrams | ||
+ | Setting multicast TTL to 32 | ||
+ | UDP buffer size: 9.00 KByte (default) | ||
+ | ------------------------------------------------------------ | ||
+ | [ 3] local 10.0.12.1 port 41484 connected with 239.1.1.1 port 5001 | ||
+ | [ ID] Interval | ||
+ | [ 3] 0.0- 1.0 sec 129 KBytes | ||
+ | [ 3] 1.0- 2.0 sec 128 KBytes | ||
+ | [ 3] 2.0- 3.0 sec 128 KBytes | ||
+ | [ 3] 3.0- 4.0 sec 128 KBytes | ||
+ | </ | ||
+ | |||
+ | ==== 2. Check R2 updates its mrouting table with discovered mcast source ===== | ||
+ | |||
+ | PIM daemon should be updated: | ||
+ | < | ||
+ | [root@R2]~# pimd -r | ||
+ | Virtual Interface Table ====================================================== | ||
+ | Vif Local Address | ||
+ | --- --------------- | ||
+ | 0 10.0.12.2 | ||
+ | 1 10.0.23.2 | ||
+ | 2 10.0.12.2 | ||
+ | |||
+ | | ||
+ | |||
+ | Multicast Routing Table ====================================================== | ||
+ | ----------------------------------- (S,G) ------------------------------------ | ||
+ | Source | ||
+ | --------------- | ||
+ | 10.0.12.1 | ||
+ | Joined | ||
+ | Pruned | ||
+ | Leaves | ||
+ | Asserted oifs: ... | ||
+ | Outgoing oifs: ..o | ||
+ | Incoming | ||
+ | |||
+ | TIMERS: | ||
+ | | ||
+ | --------------------------------- (*,*,G) ------------------------------------ | ||
+ | Number of Groups: 1 | ||
+ | Number of Cache MIRRORs: 1 | ||
+ | ------------------------------------------------------------------------------ | ||
+ | </ | ||
+ | |||
+ | And mcast routing table too: | ||
+ | |||
+ | < | ||
+ | [root@R2]~# netstat -g | ||
+ | |||
+ | IPv4 Virtual Interface Table | ||
+ | | ||
+ | 0 | ||
+ | 1 | ||
+ | 2 | ||
+ | |||
+ | IPv4 Multicast Forwarding Table | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | IPv6 Multicast Interface Table is empty | ||
+ | |||
+ | IPv6 Multicast Forwarding Table is empty | ||
+ | </ | ||
+ | |||
+ | R2 had update its mroute table for adding a source for group 239.1.1.1 comming from vif0 (toward R1). | ||
+ | |||
+ | ==== 3. Start a mcast receiver (IPerf server) on R4 ==== | ||
+ | |||
+ | IPerf server will subscribe to 239.1.1.1 multicast group and receiving mcast traffic: | ||
+ | |||
+ | < | ||
+ | [root@R4]~# iperf -s -u -B 239.1.1.1 -i 1 | ||
+ | ------------------------------------------------------------ | ||
+ | Server listening on UDP port 5001 | ||
+ | Binding to local address 239.1.1.1 | ||
+ | Joining multicast group 239.1.1.1 | ||
+ | Receiving 1470 byte datagrams | ||
+ | UDP buffer size: 41.1 KByte (default) | ||
+ | ------------------------------------------------------------ | ||
+ | [ 3] local 239.1.1.1 port 5001 connected with 10.0.12.1 port 41484 | ||
+ | [ ID] Interval | ||
+ | [ 3] 0.0- 1.0 sec 128 KBytes | ||
+ | [ 3] 1.0- 2.0 sec 128 KBytes | ||
+ | [ 3] 2.0- 3.0 sec 128 KBytes | ||
+ | [ 3] 3.0- 4.0 sec 128 KBytes | ||
+ | [ 3] 4.0- 5.0 sec 128 KBytes | ||
+ | [ 3] 5.0- 6.0 sec 129 KBytes | ||
+ | [ 3] 6.0- 7.0 sec 128 KBytes | ||
+ | [ 3] 7.0- 8.0 sec 128 KBytes | ||
+ | [ 3] 8.0- 9.0 sec 128 KBytes | ||
+ | [ 3] 9.0-10.0 sec 128 KBytes | ||
+ | [ 3] 10.0-11.0 sec 128 KBytes | ||
+ | [ 3] 11.0-12.0 sec 129 KBytes | ||
+ | </ | ||
+ | |||
+ | ==== 4. Check R3 correctly notice this mcast subscriber ==== | ||
+ | |||
+ | Now the mrouting table of R3 is updated and know it has a customer: | ||
+ | |||
+ | < | ||
+ | [root@R3]~# pimd -r | ||
+ | Virtual Interface Table ====================================================== | ||
+ | Vif Local Address | ||
+ | --- --------------- | ||
+ | 0 10.0.23.3 | ||
+ | 1 10.0.34.3 | ||
+ | 2 10.0.23.3 | ||
+ | |||
+ | | ||
+ | |||
+ | Multicast Routing Table ====================================================== | ||
+ | ----------------------------------- (*,G) ------------------------------------ | ||
+ | Source | ||
+ | --------------- | ||
+ | INADDR_ANY | ||
+ | Joined | ||
+ | Pruned | ||
+ | Leaves | ||
+ | Asserted oifs: ... | ||
+ | Outgoing oifs: .o. | ||
+ | Incoming | ||
+ | |||
+ | TIMERS: | ||
+ | | ||
+ | ----------------------------------- (S,G) ------------------------------------ | ||
+ | Source | ||
+ | --------------- | ||
+ | 10.0.12.1 | ||
+ | Joined | ||
+ | Pruned | ||
+ | Leaves | ||
+ | Asserted oifs: ... | ||
+ | Outgoing oifs: .o. | ||
+ | Incoming | ||
+ | |||
+ | TIMERS: | ||
+ | | ||
+ | --------------------------------- (*,*,G) ------------------------------------ | ||
+ | Number of Groups: 1 | ||
+ | Number of Cache MIRRORs: 1 | ||
+ | ------------------------------------------------------------------------------ | ||
+ | </ | ||
+ | |||
+ | And its mcast routing is updated too: | ||
+ | |||
+ | < | ||
+ | [root@R3]~# netstat -g | ||
+ | |||
+ | IPv4 Virtual Interface Table | ||
+ | | ||
+ | 0 | ||
+ | 1 | ||
+ | 2 | ||
+ | |||
+ | IPv4 Multicast Forwarding Table | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | IPv6 Multicast Interface Table is empty | ||
+ | |||
+ | IPv6 Multicast Forwarding Table is empty | ||
+ | |||
+ | </ | ||
+ | |||
+ | R3 correctly learn that there is a subscriber to group 239.1.1.1 on interface vif1 (toward R4). |
documentation/examples/multicast_with_pim-sm.txt · Last modified: 2019/11/08 19:22 by olivier