Setting up a GRE tunnel

Last Updated : Nov 06, 2012 |

Procedure

  1. Enter interface tunnel, followed by a number identifying the tunnel, to create the new Tunnel interface.

    If you are changing the parameters of an existing tunnel, enter interface tunnel, followed by a number identifying the tunnel, to enter the Tunnel context.

    For example:

    Gxxx-001(super)# interface tunnel 2
    Gxxx-001(super-if:Tunnel 2)#
  2. In the Tunnel interface context, enter tunnel source, followed by the public IP address of the local tunnel endpoint, to set the source address of the tunnel.

    For example:

    Gxxx-001(super-if:Tunnel 2)# tunnel source 70.70.70.2
    Done!
    Gxxx-001(super-if:Tunnel 2)#
  3. In the Tunnel interface context, enter tunnel destination, followed by the IP address of the remote tunnel endpoint, to set the destination address of the tunnel.

    For example:

    Gxxx-001(super-if:Tunnel 2)# tunnel destination 20.0.1.1
    Done!
    Gxxx-001(super-if:Tunnel 2)#
    Note:

    The Branch Gateway does not check whether the configured tunnel source IP address is an existing IP address registered with the Branch Gateway router.

  4. In most cases, it is recommended to configure keepalive in the tunnel so that the tunnel’s source interface can determine and inform the host if the tunnel is down.

    For more information on keepalive, see Keepalive feature.

    To configure keepalive for a Tunnel interface, enter keepalive in the Tunnel interface context, followed by the length (in seconds) of the interval at which the source interface sends keepalive packets, and the number of retries necessary in order to declare the tunnel down.

    The following example configures the tunnel to send a keepalive packet every 20 seconds, and to declare the tunnel down if the source interface sends three consecutive keepalive packets without a response.

    Gxxx-001(super-if:Tunnel 2)# keepalive 20 3
    Done!
    Gxxx-001(super-if:Tunnel 2)#
  5. In most cases, it is recommended to configure dynamic MTU discovery in the tunnel.

    This prevents fragmentation of packets larger than the tunnel’s MTU. When dynamic MTU discovery is not enabled, the tunnel fragments packets larger than the tunnel’s MTU, even when the packet is marked do not fragment. For more information on dynamic MTU discovery, see Dynamic MTU discovery.

    The following example configures dynamic MTU discovery, with an age timer of 15 minutes.

    Gxxx-001(super-if:Tunnel 2)# tunnel path-mtu-discovery age-timer 15
    Done!
    Gxxx-001(super-if:Tunnel 2)#
  6. Enter copy running-config startup-config.

    This saves the new Tunnel interface configuration in the startup configuration file.

Result

For a list of optional GRE tunnel features, refer to Optional GRE tunnel features. For a list of additional GRE tunnel CLI commands, refer to Summary of GRE tunneling commands.