Configuring IP GRE Tunnels
- Enter global configuration mode.
- Enter interface configuration mode and specify an Ethernet interface.
- Assign an IP address to Ethernet port 1/1/1.
- Return to global configuration mode to configure the GRE tunnel interface.
- Create a tunnel interface.
- Configure the source address for the tunnel interface.
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.
- Create the destination address for the tunnel interface.
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.
- Enable GRE encapsulation on the tunnel interface.
- Configure a tunnel loopback port for the tunnel interface.
- Configure an IP address for the tunnel interface.
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.
- Return to global configuration mode.
- If a route to the tunnel destination does not exist, configure a static route to the tunnel destination.
- If you configured a static route, set the route to go through the tunnel interface.
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