Example for Configuring Multicast over GRE
Networking Requirements
As shown in Figure 7-17, RouterA connects to a multicast source (Source), and RouterB connects to a receiver (HostA). The IP network between RouterA and RouterB does not support multicast routing protocols. A GRE tunnel needs to be set up between RouterA and RouterB to transmit multicast data from Source to HostA.
Configuration Roadmap
The configuration roadmap is as follows:
- Configure IP addresses for interfaces of RouterA and RouterB according to Figure 7-17.
- Configure Open Shortest Path First (OSPF) process 1 on RouterA and RouterB to implement IP interworking between them. Multicast data can be transmitted through a Generic Routing Encapsulation (GRE) tunnel only when a reachable unicast route is available on the network.
- Set up a GRE tunnel between RouterA and RouterB using tunnel interfaces. Set up a route to forward packets through the tunnel interfaces so that multicast data can be transmitted to HostA through the GRE tunnel. In this example, OSPF process 2 is used to generate the route.
- Enable multicast routing on RouterA and RouterB, and enable multicast protocols on the interface connected to the multicast source, tunnel interfaces, and the interface connected to HostA. After these basic multicast functions are configured, multicast data can be transmitted to HostA through the path RouterA -> GRE tunnel -> RouterB.
Procedure
- Configure IP addresses for the interfaces on the routers.
# Configure RouterA.
<Huawei> system-view [Huawei] sysname RouterA [RouterA] interface gigabitethernet 0/0/1 [RouterA-GigabitEthernet0/0/1] ip address 10.1.1.2 24 [RouterA-GigabitEthernet0/0/1] quit [RouterA] interface gigabitethernet1/0/0 [RouterA-GigabitEthernet1/0/0] ip address 192.168.12.1 24 [RouterA-GigabitEthernet1/0/0] quit [RouterA] interface loopback0 [RouterA-LoopBack0] ip address 10.10.1.1 32 [RouterA-LoopBack0] quit
# Configure RouterB.
[RouterB] interface gigabitethernet 0/0/1 [RouterB-GigabitEthernet0/0/1] ip address 10.2.1.1 24 [RouterB-GigabitEthernet0/0/1] quit [RouterB] interface gigabitethernet1/0/0 [RouterB-GigabitEthernet1/0/0] ip address 192.168.13.1 24 [RouterB-GigabitEthernet1/0/0] quit [RouterB] interface loopback0 [RouterB-LoopBack0] ip address 10.10.1.2 32 [RouterB-LoopBack0] quit
- Configure OSPF on RouterA and RouterB to implement IP interworking between them.
# Configure RouterA.
[RouterA] ospf [RouterA-ospf-1] area 0 [RouterA-ospf-1-area-0.0.0.0] network 10.10.1.1 0.0.0.0 [RouterA-ospf-1-area-0.0.0.0] network 192.168.12.0 0.0.0.255 [RouterA-ospf-1-area-0.0.0.0] quit [RouterA-ospf-1] quit
# Configure RouterB.
[RouterB] ospf [RouterB-ospf-1] area 0 [RouterB-ospf-1-area-0.0.0.0] network 10.10.1.2 0.0.0.0 [RouterB-ospf-1-area-0.0.0.0] network 192.168.13.0 0.0.0.255 [RouterB-ospf-1-area-0.0.0.0] quit [RouterB-ospf-1] quit
- Use tunnel interfaces on the routers to set up a GRE tunnel and set up a route to forward packets through the tunnel interfaces.
# Create tunnel interfaces and configure IP addresses for the tunnel interfaces.
# Configure RouterA.
[RouterA] interface tunnel 0/0/1 [RouterA-Tunnel0/0/1] ip address 192.168.1.1 24
# Configure RouterB.
[RouterB] interface tunnel 0/0/1 [RouterB-Tunnel0/0/1] ip address 192.168.1.2 24
# Set the tunnel type to GRE and set the source and destination addresses of the tunnel to IP addresses of the loopback interfaces on the routers.
# Configure RouterA.
[RouterA-Tunnel0/0/1] tunnel-protocol gre [RouterA-Tunnel0/0/1] source 10.10.1.1 [RouterA-Tunnel0/0/1] destination 10.10.1.2 [RouterA-Tunnel0/0/1] quit
# Configure RouterB.
[RouterB-Tunnel0/0/1] tunnel-protocol gre [RouterB-Tunnel0/0/1] source 10.10.1.2 [RouterB-Tunnel0/0/1] destination 10.10.1.1 [RouterB-Tunnel0/0/1] quit
# Set up a route to forward packets through the tunnel interfaces.
# Configure RouterA.
[RouterA] ospf 2 [RouterA-ospf-2] area 0 [RouterA-ospf-2-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [RouterA-ospf-2-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [RouterA-ospf-2-area-0.0.0.0] quit [RouterA-ospf-2] quit
# Configure RouterB.
[RouterB] ospf 2 [RouterB-ospf-2] area 0 [RouterB-ospf-2-area-0.0.0.0] network 10.2.1.0 0.0.0.255 [RouterB-ospf-2-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [RouterB-ospf-2-area-0.0.0.0] quit [RouterB-ospf-2] quit
- Configure multicast protocols on the interface connected to the multicast source, tunnel interfaces, and the interface connected to HostA to support multicast data forwarding.
# Globally enable multicast routing on the routers.
# Configure RouterA.
[RouterA] multicast routing-enable
# Configure RouterB.
[RouterB] multicast routing-enable
# Enable PIM-SM on GE0/0/1 of RouterA connected to the multicast source. Enable PIM-SM and IGMP on GE0/0/1 of RouterB connected to HostA.
# Configure RouterA.
[RouterA] interface gigabitethernet 0/0/1 [RouterA-GigabitEthernet0/0/1] pim sm [RouterA-GigabitEthernet0/0/1] quit
# Configure RouterB.
[RouterB] interface gigabitethernet 0/0/1 [RouterB-GigabitEthernet0/0/1] pim sm [RouterB-GigabitEthernet0/0/1] igmp enable [RouterB-GigabitEthernet0/0/1] quit
# Enable PIM-SM on the tunnel interfaces and configure the tunnel interface on RouterA as a C-BSR and C-RP.
# Configure RouterA.
[RouterA] interface tunnel 0/0/1 [RouterA-Tunnel0/0/1] pim sm [RouterA-Tunnel0/0/1] quit [RouterA] pim [RouterA-pim] c-bsr tunnel 0/0/1 [RouterA-pim] c-rp tunnel 0/0/1
# Configure RouterB.
[RouterB] interface tunnel 0/0/1 [RouterB-Tunnel0/0/1] pim sm [RouterB-Tunnel0/0/1] quit
- Verify the configuration.
# Run the display pim interface command on each router to check the PIM configuration and status. The PIM state is Up.
# Run the display igmp group command on RouterB. The command output shows that the receiver (HostA) has joined the multicast group.<RouterB> display igmp group Interface group report information GigabitEthernet0/0/1(10.2.1.1): Total 1 IGMP Group reported Group Address Last Reporter Uptime Expires 225.1.1.2 10.2.1.2 00:02:04 00:01:17
# Run the display pim routing-table command on RouterB to check the PIM multicast routing table. The routing table contains a (10.1.1.1, 225.1.1.2) entry.
<RouterB> display pim routing-table (10.1.1.1, 225.1.1.2) RP: 192.168.1.1 Protocol: pim-sm, Flag: ACT UpTime: 00:04:32 Upstream interface: Tunnel0/0/1 Upstream neighbor: 192.168.1.1 RPF prime neighbor: 192.168.1.1 Downstream interface(s) information: Total number of downstreams: 1 1: GigabitEthernet0/0/1 Protocol: pim-sm, UpTime: 00:04:32, Expires: -
Configuration Files
RouterA configuration file
# sysname RouterA # multicast routing-enable # interface GigabitEthernet0/0/1 ip address 10.1.1.2 255.255.255.0 pim sm # interface GigabitEthernet1/0/0 ip address 192.168.12.1 255.255.255.0 # interface loopback0 ip address 10.10.1.1 255.255.255.255 # interface tunnel0/0/1 ip address 192.168.1.1 255.255.255.0 tunnel-protocol gre source 10.10.1.1 destination 10.10.1.2 pim sm # ospf 1 area 0.0.0.0 network 10.10.1.1 0.0.0.0 network 192.168.12.0 0.0.0.255 # ospf 2 area 0.0.0.0 network 10.1.1.0 0.0.0.255 network 192.168.1.0 0.0.0.255 # pim c-bsr Tunnel0/0/1 c-rp Tunnel0/0/1 # return
RouterB configuration file
# sysname RouterB # multicast routing-enable # interface GigabitEthernet0/0/1 ip address 10.2.1.1 255.255.255.0 pim sm igmp enable # interface GigabitEthernet1/0/0 ip address 192.168.13.1 255.255.255.0 # interface loopback0 ip address 10.10.1.2 255.255.255.255 # interface tunnel0/0/1 ip address 192.168.1.2 255.255.255.0 tunnel-protocol gre source 10.10.1.2 destination 10.10.1.1 pim sm # ospf 1 area 0.0.0.0 network 10.10.1.2 0.0.0.0 network 192.168.13.0 0.0.0.255 # ospf 2 area 0.0.0.0 network 10.1.2.0 0.0.0.255 network 192.168.1.0 0.0.0.255 # return