Configuring an IP tunnel

Prerequisites

一个启用第三层接口与一个IP地址signed to it, created with the commandinterface.

Procedure
  1. Create an IP tunnel with the commandinterface tunnel.
  2. Set the IP address for the tunnel.For a GRE tunnel, enter the commandip addressip address.For an IPv6 in IPv4 or an IPv6 in IPv6 tunnel, enter the commandipv6 address.
  3. Set the source IP address for the tunnel. Fora GRE oran IPv6 in IPv4 tunnel, enter the commandsource ip. For an IPv6 in IPv6 tunnel, enter the commandsource ipv6.
  4. Set the destination IP address for the tunnel.Fora GRE oran IPv6 in IPv4 tunnel, enter the commanddestination ip.For an IPv6 in IPv6 tunnel, enter the commanddestination ipv6.
  5. Optionally, set the TTL (hop count) for the tunnel with the commandttl.
  6. Optionally, set the MTU for the tunnel with the commandip mtu.
  7. Optionally, add a description to the tunnel with the commanddescription.
  8. By default, the tunnel is attached to the default VRF. Attach it to a different VRF with the commandvrf attach.
  9. Enable the tunnel with the commandno shutdown.
  10. Review tunnel settings with the commandshow interface tunnel.

Example

This example creates the following configuration:

  • Creates GRE tunnel33.
  • Set the tunnel IP address to10.10.20.209/24.
  • Sets the tunnel source IP address to10.10.10.1.
  • Sets the tunnel destination IP address to10.10.10.2.
  • Enables the tunnel.
switch(config)# interface tunnel 33 mode gre ipv4 switch(config-gre-if)#ip address 10.10.20.209/24switch(config-gre-if)#source ip address 10.10.10.1switch(config-gre-if)#destination ip address 10.10.10.2switch(config-gre-if)#no shutdown