配置PIM auto-rp
環境:三臺路由器串口相連,其它的配置如圖所示
要求:1. R1,R2,R3配置ospf 並把全部接口加入到area 0
2.配置R1爲rp,配置R2爲映射代理,把R3加入239.3.3.3組
3.練習本課全部show命令
步驟一:在每一個路由器上配置1個loopback 口,並 配置三臺路由器接口使其連通。
R1的配置
R1(config)# interface Loopback0
R1(config-if)# ip address 30.1.1.1 255.255.255.0
R1(config)# interface Serial0
R1(config-if)# ip address 10.1.1.1 255.255.255.0
R1(config-if)# clockrate 64000
R1(config-if)#no shutdown
R2的配置
R2(config)#interface Loopback0
R2(config-if)# ip address 40.1.1.1 255.255.255.0
R2(config)#interface Serial0
R2(config-if)# ip address 20.1.1.1 255.255.255.0
R2(config-if)#clockrate 64000
R2(config-if)#no shutdown
R2(config)#interface Serial1
R2(config-if)# ip address 10.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R3的配置
R3(config)#interface Loopback0
R3(config-if)# ip address 50.1.1.1 255.255.255.0
R3(config)#interface Serial1
R3(config-if)# ip address 20.1.1.2 255.255.255.0
R3(config-if)#no shutdown
步驟二:配置ospf路由協議,使其連通
R1的配置
R1(config)#router ospf 1
R1(config-router)# network 10.1.1.0 0.0.0.255 area 0
R1(config-router)# network 30.1.1.0 0.0.0.255 area 0
R2的配置
R2(config)#router ospf 1
R2(config-router)#network 10.1.1.0 0.0.0.255 area 0
R2(config-router)# network 20.1.1.0 0.0.0.255 area 0
R2(config-router)# network 40.1.1.0 0.0.0.255 area 0
R3的配置
R3(config)#router ospf 1
R3(config-router)# network 20.1.1.0 0.0.0.255 area 0
R3(config-router)# network 50.1.1.0 0.0.0.255 area 0
步驟三:配置R1爲rp,配置R2爲映射代理,把R3加入239.3.3.3組
R1的配置
R1(config)#ip multicast-routing à啓用多播協議
R1(config)# interface Loopback0
R1(config-if)# ip pim sparse-mode à接口PIM模式爲稀疏
R1(config)# interface Serial0
R1(config-if)# ip pim sparse-mode
R1(config)# ip pim send-rp-announce Loopback0 scope 5 à指定R1爲RP
R2的配置
R2(config)#ip multicast-routing
R2(config)# interface Loopback0
R2(config-if)# ip pim sparse-mode
R2(config)# interface Serial0
R2(config-if)# ip pim sparse-mode
R2(config)# interface Serial1
R2(config-if)# ip pim sparse-mode
R2(config)# ip pim send-rp-discovery Loopback0 scope 5 à將R2指定爲映射代理
R3的配置
R3(config)#ip multicast-routing
R3(config)# interface Loopback0
R3(config-if)# ip pim sparse-mode
R3(config-if)# ip igmp join-group 239.3.3.3 à將此接口加入到組239.3.3.3
R3(config)# interface Serial1
R3(config-if)# ip pim sparse-mode
步驟四:查看組播路由表
R1#sh ip mroute 239.3.3.3
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
Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode
(*, 239.3.3.3), 00:37:56/stopped, RP 30.1.1.1, flags: S
Incoming interface: Null, RPF nbr 0.0.0.0
Outgoing interface list:
Serial0, Forward/Sparse, 00:37:56/00:03:07
(10.1.1.1, 239.3.3.3), 00:00:04/00:02:56, flags: P à學來對端的基於源的多播路由
Incoming interface: Serial0, RPF nbr 0.0.0.0
Outgoing interface list: Null
(30.1.1.1, 239.3.3.3), 00:00:04/00:03:28, flags: T
Incoming interface: Loopback0, RPF nbr 0.0.0.0
Outgoing interface list:
Serial0, Forward/Sparse, 00:00:05/00:03:24
(50.1.1.1, 239.3.3.3), 00:00:12/00:03:17, flags: PX
Incoming interface: Serial0, RPF nbr 10.1.1.2
Outgoing interface list: Null
R2#sh ip mroute 239.3.3.3
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
Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode
(*, 239.3.3.3), 00:43:06/stopped, RP 30.1.1.1, flags: SF
Incoming interface: Serial1, RPF nbr 10.1.1.1
Outgoing interface list:
Serial0, Forward/Sparse, 00:42:48/00:03:02
(20.1.1.1, 239.3.3.3), 00:00:22/00:03:07, flags: T
Incoming interface: Serial0, RPF nbr 0.0.0.0, Registering
Outgoing interface list:
Serial1, Forward/Sparse, 00:00:22/00:03:07
(40.1.1.1, 239.3.3.3), 00:00:23/00:03:08, flags: FT
Incoming interface: Loopback0, RPF nbr 0.0.0.0, Registering
Outgoing interface list:
Serial0, Forward/Sparse, 00:00:24/00:03:06
(50.1.1.1, 239.3.3.3), 00:01:39/00:01:53, flags:
Incoming interface: Serial0, RPF nbr 20.1.1.2
Outgoing interface list:
Serial1, Forward/Sparse, 00:01:39/00:01:53
R3#sh ip mroute 239.3.3.3
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
Y - Joined MDT-data group, y - Sending to MDT-data group
Outgoing interface flags: H - Hardware switched
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode
(*, 239.3.3.3), 00:46:06/stopped, RP 30.1.1.1, flags: SJCLF
Incoming interface: Serial1, RPF nbr 20.1.1.1
Outgoing interface list:
Loopback0, Forward/Sparse, 00:46:06/00:02:27
(50.1.1.1, 239.3.3.3), 00:03:54/00:03:06, flags: LFT
Incoming interface: Loopback0, RPF nbr 0.0.0.0, Registering
Outgoing interface list:
Serial1, Forward/Sparse, 00:00:32/00:02:58
步驟五:查看接口組播信息
R1#sh ip pim int s0
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
10.1.1.1 Serial0 v2/S 1 30 1 0.0.0.0
R1#sh ip pim int lo 0
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
30.1.1.1 Loopback0 v2/S 0 30 1 30.1.1.1
R2#sh ip pim int s0
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
20.1.1.1 Serial0 v2/S 1 30 1 0.0.0.0
R2#sh ip pim int s1
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
10.1.1.2 Serial1 v2/S 1 30 1 0.0.0.0
R2#sh ip pim int lo 0
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
40.1.1.1 Loopback0 v2/S 0 30 1 40.1.1.1
R3#sh ip pim int s1
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
20.1.1.2 Serial1 v2/S 1 30 1 0.0.0.0
R3#sh ip pim int lo 0
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
50.1.1.1 Loopback0 v2/S 0 30 1 50.1.1.1
步驟六:查看組播鄰居
R1#sh ip pim neighbor
PIM Neighbor Table
Neighbor Interface Uptime/Expires Ver DR
Address Prio/Mode
10.1.1.2 Serial0 01:59:55/00:01:38 v2 1 / S
R2#sh ip pim nei
PIM Neighbor Table
Neighbor Interface Uptime/Expires Ver DR
Address Prio/Mode
20.1.1.2 Serial0 02:00:36/00:01:17 v2 1 / S
10.1.1.1 Serial1 02:03:04/00:01:21 v2 1 / S
R3#sh ip pim neighbor
PIM Neighbor Table
Neighbor Interface Uptime/Expires Ver DR
Address Prio/Mode
20.1.1.1 Serial1 02:03:21/00:01:35 v2 1 / S
步驟七:查看rp映射表
R1#sh ip pim rp mapping
PIM Group-to-RP Mappings
This system is an RP (Auto-RP)
Group(s) 224.0.0.0/4
RP 30.1.1.1 (?), v2v1
Info source: 40.1.1.1 (?), elected via Auto-RP
Uptime: 00:43:36, expires: 00:02:59
R2#sh ip pim rp mapping
PIM Group-to-RP Mappings
This system is an RP-mapping agent (Loopback0)
Group(s) 224.0.0.0/4
RP 30.1.1.1 (?), v2v1
Info source: 30.1.1.1 (?), elected via Auto-RP
Uptime: 00:48:13, expires: 00:02:44
R3#sh ip pim rp mapping
PIM Group-to-RP Mappings
Group(s) 224.0.0.0/4
RP 30.1.1.1 (?), v2v1
Info source: 40.1.1.1 (?), elected via Auto-RP
Uptime: 00:50:26, expires: 00:02:03
步驟八: ping 組播地址測試
R1#ping 239.3.3.3
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 239.3.3.3, timeout is 2 seconds:
Reply to request 0 from 20.1.1.2, 80 ms à此顯示爲已通
Reply to request 0 from 20.1.1.2, 112 ms
R2#ping 239.3.3.3
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 239.3.3.3, timeout is 2 seconds:
Reply to request 0 from 20.1.1.2, 56 ms
Reply to request 0 from 20.1.1.2, 136 ms
Reply to request 0 from 20.1.1.2, 80 ms
R3#ping 239.3.3.3
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 239.3.3.3, timeout is 2 seconds:
Reply to request 0 from 50.1.1.1, 8 ms
步驟九:查看當前配置結果
R1#sh run
hostname R1
!
ip multicast-routing
!
interface Loopback0
ip address 30.1.1.1 255.255.255.0
ip pim sparse-mode
!
interface Serial0
ip address 10.1.1.1 255.255.255.0
ip pim sparse-mode
clockrate 64000
!
router ospf 1
network 10.1.1.0 0.0.0.255 area 0
network 30.1.1.0 0.0.0.255 area 0
!
ip pim send-rp-announce Loopback0 scope 5
end
R2#sh run
hostname R2
!
ip multicast-routing
!
interface Loopback0
ip address 40.1.1.1 255.255.255.0
ip pim sparse-mode
!
interface Serial0
ip address 20.1.1.1 255.255.255.0
ip pim sparse-mode
clockrate 64000
!
interface Serial1
ip address 10.1.1.2 255.255.255.0
ip pim sparse-mode
!
router ospf 1
network 10.1.1.0 0.0.0.255 area 0
network 20.1.1.0 0.0.0.255 area 0
network 40.1.1.0 0.0.0.255 area 0
!
ip pim send-rp-discovery Loopback0 scope 5
!
end
R3#sh run hostname R3 ! ip multicast-routing ! interface Loopback0 ip address 50.1.1.1 255.255.255.0 ip pim sparse-mode ip igmp join-group 239.3.3.3 ! interface Serial1 ip address 20.1.1.2 255.255.255.0 ip pim sparse-mode ! router ospf 1 network 20.1.1.0 0.0.0.255 area 0 network 50.1.1.0 0.0.0.255 area 0 ! end