Configuring a GRE tunnel

Prerequisites

A enabled layer 3 interface with an IP address assigned to it, created with the command interface.

Procedure
  1. Create a GRE tunnel with the command interface tunnel.
  2. Set the IP address for the tunnel with the command ip address.
  3. Set the source IP address for the tunnel with the command source ip.
  4. Set the destination IP address for the tunnel with the command destination ip.
  5. Optionally, set the TTL(hop count) for the tunnel with the command ttl.
  6. By default, the tunnel is attached to the default VRF. Attach it to a different VRF with the command vrf attach.
  7. Review GRE tunnel settings with the command show interface tunnel.

Example

This example creates the following configuration:

  • Creates GRE tunnel 27.
  • Set the tunnel IP address to 10.10.20.209/24.
  • Sets the tunnel source IP address to 10.10.10.1.
  • Sets the tunnel destination IP address to 10.10.10.2.
switch(config)# interface tunnel 27 mode gre ipv4
switch(config-gre-if)# ip address 10.10.20.209/24
switch(config-gre-if)# source ip address 10.10.10.1
switch(config-gre-if)# destination ip address 10.10.10.2
switch(config-gre-if)# no shutdown