Configuring IP GRE Tunnels

Generic Routing Encapsulation can be configured on tunnel interfaces.
When configuring a GRE tunnel you must create a tunnel interface, configure a source address or source interface for the tunnel interface, configure the destination address, enable GRE encapsulation for the tunnel interface, and configure an IP address for the tunnel. If a route to the tunnel destination does not exist, you must create a static route and specify that the route is through the tunnel interface. These configuration requirements are explained in more detail in the following steps.
Note: ICX 7150 devices do not support Generic Routing Encapsulation (GRE) tunnels. This task is not supported for ICX 7150 devices.
  1. Enter global configuration mode.
    device# configure terminal
  2. Enter interface configuration mode and specify an Ethernet interface.
    device(config)# interface ethernet 1/1/1
  3. Assign an IP address to Ethernet port 1/1/1.
    device(config-if-e10000-1/1/1)# ip address 10.45.6.1 255.255.255.0
  4. Return to global configuration mode to configure the GRE tunnel interface.
    device(config-if-e10000-1/1/1)# exit
  5. Create a tunnel interface.
    device(config)# interface tunnel 1
  6. Configure the source address for the tunnel interface.
    device(config-tnif-1)# tunnel source 10.0.8.108
    The tunnel source address should be one of the device IP addresses configured on a physical, loopback, or virtual Ethernet (VE) interface, through which the other end of the tunnel is reachable.

    If the destination address for a tunnel interface is not resolved, you should either configure the source interface (instead of the source address) as the source for a tunnel interface, or enable GRE link keepalive on the tunnel interface.

  7. Create the destination address for the tunnel interface.
    device(config-tnif-1)# tunnel destination 131.108.5.2
    The destination address should be the address of the IP interface of the device at the other end of the tunnel.

    If the destination address for a tunnel interface is not resolved, you should either configure the source interface (instead of the source address in Step 6) as the source for a tunnel interface, or enable GRE link keepalive on the tunnel interface.

  8. Enable GRE encapsulation on the tunnel interface.
    device(config-tnif-1)# tunnel mode gre ip
  9. Configure a tunnel loopback port for the tunnel interface.
    device(config-tnif-1)# tunnel source loopback 4/1
  10. Configure an IP address for the tunnel interface.
    device(config-tnif-1)# ip address 10.10.3.1/24
    An IP address sets a tunnel interface as an IP port and allows the configuration of Layer 3 protocols, such as OSPF, BGP, and Multicast (PIM-DM and PIM-SM) on the port. Note that the subnet cannot overlap other subnets configured on other routing interfaces, and both ends of the tunnel should be in the same subnet.
  11. Return to global configuration mode.
    device(config-tnif-1)# exit
  12. If a route to the tunnel destination does not exist, configure a static route to the tunnel destination.
    device(config)# ip route 131.108.5.0/24 10.0.8.1
  13. If you configured a static route, set the route to go through the tunnel interface.
    device(config)# ip route 10.10.2.0/24 tunnel 1

The following example configures an IP GRE tunnel.

device# configure terminal
device(config)# interface ethernet 1/1/1
device(config-if-e1000-1/1/1)# ip address 10.0.8.108/24
device(config)# exit
device(config)# interface tunnel 1 
device(config-tnif-1)# tunnel source 10.0.8.108
device(config-tnif-1)# tunnel destination 131.108.5.2
device(config-tnif-1)# tunnel mode gre ip
device(config-tnif-1)# tunnel source loopback 4/1
device(config-tnif-1)# ip address 10.10.3.1/24
device(config-tnif-1)# exit
device(config)# ip route 131.108.5.0/24 10.0.8.1
device(config)# ip route 10.10.2.0/24 tunnel 1