# Configuration Tasks

To configure an IP tunnel:

1. Create or select a physical or loopback interface.

   This interface acts as an anchor for the source of the tunnel.

2. Assign an IP address to the physical or loopback interface.
3. Create a tunnel interface.
4. Set the source address for the tunnel.
5. Set the destination address for the tunnel.
6. (Optional) Enable error checking across a GRE tunnel.
7. Set the maximum transmission unit (MTU) size for the tunnel.

   | Note: On SM interfaces, issue only the commands listed below. Do not configure protocols such as Multilink PPP or Multilink Frame Relay on SM interfaces.

interface tunnel

- Use to create an IP tunnel interface.
- Specify the type and name of the tunnel you want to create.
- You can use the transport-virtual-router keyword to establish the tunnel on a virtual router other than the current virtual router.
- Example
  host1(config)#interface tunnel dvmrp:boston-tunnel-1 transport-virtual-router boston
- Use the no version to remove the tunnel.

  | Note: When you delete a virtual router that has been configured as a transport virtual router for a DVMRP tunnel, the show configuration output displays No Router for the transport virtual router. To remove the DVMRP tunnel interface, simply omit any reference to the transport virtual router. For example, to delete interface tunnel dvmrp:boston-tunnel-1 transport-virtual-router No Router from the configuration, issue the command, no interface tunnel dvmrp:boston-tunnel-1.

- See interface tunnel.

tunnel checksum

- Use to enable checksum computation across a GRE tunnel.
- Checksum computation is not supported for DVMRP tunnels.
- Selecting this feature causes the E Series router to drop corrupted packets it receives on the tunnel interface.
- Example
  host1(config)#interface tunnel gre:tunnel2 host1(config-if)#tunnel checksum
- Use the no version to disable the checksum option.
- See tunnel checksum.

tunnel destination

- Use to configure the remote end of the tunnel.
- Specify either the IP address of an interface on the remote router or the hostname of the remote router.
  - The IP address is the address for the destination interface.
  - The hostname is the name of the destination interface.
- Example 1
  host1(config)#interface tunnel dvmrp:tunnel2 host1(config-if)#tunnel destination 192.13.7.1
- Example 2
  host1(config)#interface tunnel dvmrp:tunnel2 host1(config-if)#tunnel destination remoteHost
- Use the no version to remove the destination of a tunnel.
- See tunnel destination.

tunnel mtu

- Use to set the MTU for the tunnel.
- Specify a value in the range 1024–10240 bytes.
- Example
  host1(config-if)#tunnel mtu 7500
- Use the no version to restore the default, 10240 bytes.
- See tunnel mtu.

tunnel source

- Use to configure the source of the tunnel.
- Specify either the primary IP address or the type and specifier of an interface.
- Do not specify an unnumbered interface.
- Example 1—Primary IP address
  host1(config)#interface tunnel dvmrp:boston-tunnel-1 host1(config-if)#tunnel source 192.10.2.1
- Example 2—ATM interface on an ERX7xx model, ERX14xx model, or the ERX310 router that uses the slot/port format
  host1(config)#interface tunnel dvmrp:boston-tunnel-1 host1(config-if)#tunnel source atm 5/0.12
- Example 3—ATM interface on an E320 router that uses the slot/adapter/port format
  host1(config)#interface tunnel dvmrp:boston-tunnel-1 host1(config-if)#tunnel source atm 5/1/0.12
- Use the no version to remove the source of a tunnel.
- See tunnel source.

## Configuration Example

In this example, two GRE tunnel interfaces are configured on different virtual routers of an E Series router. The source of the first tunnel interface matches the destination of the second tunnel interface and vice versa.

| Note: This example contains an ATM interface configuration for an ERX7xx model, ERX14xx model, or ERX310 router that uses the slot/port format.

1. Configure a virtual router called boston that supports one end of the tunnel.
   host1#virtual-router boston
2. Configure a physical or loopback interface for the end of the tunnel on virtual router boston.

   The IP address of this interface appears in the header of tunneled frames and is used for forwarding traffic.

   host1:boston#interface atm 12/0.5 host1:boston(config-if)#ip address 10.5.5.5 255.255.255.0
3. Configure the tunnel interface on virtual router boston.
   1. Create the tunnel interface.
      host1:boston(config)#interface tunnel gre:ChicagoTunnel
   2. Configure the source and destination points of the tunnel interface.
      host1:boston(config-if)#tunnel source 10.5.5.5 host1:boston(config-if)#tunnel destination 10.6.6.6
   3. Set the MTU for the tunnel.
      host1:boston(config-if)#tunnel mtu 8000
   4. Configure the IP address of the tunnel interface.
      host1:boston(config-if)#ip address 10.7.7.7 255.255.255.0
4. Configure a virtual router called chicago that supports the other end of the tunnel.
   host1(config)#virtual-router chicago
5. Configure a physical or loopback interface for the end of the tunnel on virtual router chicago.
   host1:chicago(config)#interface atm 12/1.5 host1:chicago(config-if)#ip address 10.6.6.6 255.255.255.0
6. Configure the tunnel interface on virtual router chicago.
   1. Create the tunnel interface.

      The name of the tunnel interface can differ from the tunnel interface configured in Step 3.

      host1:chicago(config-if)#interface tunnel gre:BostonTunnel
   2. Configure the source and destination points of the tunnel interface.

      The destination of this tunnel interface matches the source of the tunnel interface configured in Step 3 and vice versa.

      host1:chicago(config-if)#tunnel source 10.6.6.6 host1:chicago(config-if)#tunnel destination 10.5.5.5
   3. Set the MTU for the tunnel.

      The MTU must match the MTU configured in Step 3.

      host1:chicago(config-if)#tunnel mtu 8000
   4. Configure the IP address of the tunnel interface.
      host1:chicago(config-if)#ip address 10.9.9.9 255.255.255.0

## Configuring IP Tunnels to Forward IP Frames

When a line module receives IP frames destined for a tunnel, the module forwards the frames to a tunnel-service module. Tunnel-service modules include SMs and modules that support the use of shared tunnel-server ports.

The tunnel-service module encapsulates the frames and forwards them to the tunnel through an interface determined by a route lookup of an IP frame. The source and destination addresses in the IP frame are the source and destination addresses of the tunnel.

Similarly, when a line module receives traffic from a tunnel, the module forwards the traffic to the tunnel-service module for deencapsulation. After deencapsulation, the tunnel-service module forwards the resulting IP frames to an interface determined by a route lookup.

When you have configured a tunnel interface, treat it in the same way as any IP interface on the router. For example, you can configure static IP routes or enable routing protocols on the tunnel interface. The IP configurations you apply to the tunnels control how traffic travels through the network.

## Preventing Recursive Tunnels

If routing information about the tunnel network combines with routing information about the transport networks (the networks that the tunnel services), a recursive tunnel can occur. In this case, the routing table defines the tunnel itself as the best path to a tunnel destination. To prevent recursive tunnels, differentiate routing information for the tunnel network and the transport networks with one or both of the following techniques:

- Use different routing protocols for the tunnel network and the transport networks.
- Define a static route to the tunnel destination.

  | Note: If you define a static route to a tunnel destination, be careful not to create routing loops.

Figure 20 illustrates how to prevent recursive tunnels by using different routing protocols for the tunnel network and the transport networks.

Figure 20: Transport and Tunnel Networks Using Different Routing Protocols

## Creating Multicast VPNs Using GRE Tunnels

For information about configuring multicast VPNs using GRE tunnels, see Configuring PIM for IPv4 Multicast in JunosE Multicast Routing Configuration Guide.