Generic Routing Encapsulation
Generic Routing Encapsulation
This document describes the Generic Routing Encapsulation (GRE) feature. This feature is a tunneling protocol
that enables the encapsulation of a wide variety of protocol packet types inside IP tunnels, creating a virtual
point-to-point link to Cisco routers at remote points over an IP internetwork.
• Finding Feature Information, on page 1
• Hardware Compatibility Matrix for the Cisco cBR Series Routers, on page 2
• Restrictions for Implementing Tunnels, on page 2
• Restrictions for GRE IPv6 Tunnels, on page 3
• Information About Implementing Tunnels, on page 4
• Information About IPv6 over IPv4 GRE Tunnels, on page 5
• Information About GRE IPv6 Tunnels, on page 8
• How to Implement Tunnels, on page 8
• Configuration Examples for Implementing Tunnels, on page 16
• How to Configure IPv6 over IPv4 GRE Tunnels, on page 18
• Configuration Examples for IPv6 over IPv4 GRE Tunnels, on page 20
• How to Configure GRE IPv6 Tunnels, on page 21
• Configuration Examples for GRE IPv6 Tunnels, on page 22
• Additional References, on page 23
• Feature Information for Generic Routing Encapsulation , on page 24
Note The hardware components that are introduced in a given Cisco IOS-XE Release are supported in all subsequent
releases unless otherwise specified.
Table 1: Hardware Compatibility Matrix for the Cisco cBR Series Routers
Cisco cBR-8 Converged Broadband Cisco IOS-XE Release 16.5.1 and Cisco IOS-XE Release 16.5.1 and
Router Later Releases Later Releases
Cisco cBR-8 Supervisor: Cisco cBR-8 CCAP Line Cards:
• PID—CBR-SUP-250G • PID—CBR-LC-8D30-16U30
• PID—CBR-CCAP-SUP-160G • PID—CBR-LC-8D31-16U30
• PID—CBR-CCAP-SUP-60G • PID—CBR-RF-PIC
• PID—CBR-SUP-8X10G-PIC • PID—CBR-RF-PROT-PIC
• PID—CBR-CCAP-LC-40G-R
but the tunnel may actually cost more in terms of latency when compared to an alternative physical
topology. For example, in the topology shown in the figure below, packets from Host 1 will appear to
travel across networks w, t, and z to get to Host 2 instead of taking the path w, x, y, and z because the
tunnel hop count appears shorter. In fact, the packets going through the tunnel will still be traveling
across Router A, B, and C, but they must also travel to Router D before coming back to Router C.
• A tunnel may have a recursive routing problem if routing is not configured accurately. The best path to
a tunnel destination is via the tunnel itself; therefore recursive routing causes the tunnel interface to flap.
To avoid recursive routing problems, keep the control-plane routing separate from the tunnel routing by
using the following methods:
• Use a different autonomous system number or tag.
• Use a different routing protocol.
• Ensure that static routes are used to override the first hop (watch for routing loops).
The following error is displayed when there is recursive routing to a tunnel destination:
%TUN-RECURDOWN Interface Tunnel 0
temporarily disabled due to recursive routing
Tunnel ToS
Tunnel type of service (ToS) allows you to tunnel network traffic and group all packets in the same ToS byte
value. The ToS byte values and Time-to-Live (TTL) hop-count value can be set in the encapsulating IP header
of tunnel packets for an IP tunnel interface on a router. Tunnel ToS feature is supported for Cisco Express
Forwarding (formerly known as CEF), fast switching, and process switching.
The ToS and TTL byte values are defined in RFC 791. RFC 2474, and RFC 2780 obsolete the use of the ToS
byte as defined in RFC 791. RFC 791 specifies that bits 6 and 7 of the ToS byte (the first two least significant
bits) are reserved for future use and should be set to 0.
Note PMTUD on a tunnel interface requires that the tunnel endpoint be able to receive ICMP messages generated
by routers in the path of the tunnel. Ensure that ICMP messages can be received before using PMTUD over
firewall connections.
Use the tunnel path-mtu-discovery command to enable PMTUD for the tunnel packets and use the show
interfaces tunnel command to verify the tunnel PMTUD parameters. PMTUD works only on GRE and
IP-in-IP tunnel interfaces.
Note Class-based WFQ (CBWFQ) inside class-based shaping is not supported on a multipoint interface.
For examples of how to implement some QoS features on a tunnel interface, see the section“Configuring QoS
Options on Tunnel Interfaces Examples, on page 17” on page 32.
• IPv4-compatible
• 6to4
• Intrasite Automatic Tunnel Addressing Protocol (ISATAP)
Note Overlay tunnels reduce the maximum transmission unit (MTU) of an interface by 20 octets (assuming that
the basic IPv4 packet header does not contain optional fields). A network that uses overlay tunnels is difficult
to troubleshoot. Therefore, overlay tunnels that connect isolated IPv6 networks should not be considered a
final IPv6 network architecture. The use of overlay tunnels should be considered as a transition technique
toward a network that supports both the IPv4 and IPv6 protocol stacks or just the IPv6 protocol stack.
Use the table below to help you determine which type of tunnel that you want to configure to carry IPv6
packets over an IPv4 network.
Table 2: Suggested Usage of Tunnel Types to Carry IPv6 Packets over an IPv4 Network
Manual Simple point-to-point tunnels that can be used Can carry IPv6 packets only.
within a site or between sites.
GRE- and IPv4- Simple point-to-point tunnels that can be used Can carry IPv6, Connectionless
compatible within a site or between sites. Network Service (CLNS), and many
other types of packets.
6to4 Point-to-multipoint tunnels that can be used Sites use addresses from the 2002::/16
to connect isolated IPv6 sites. prefix.
6RD IPv6 service is provided to customers over an Prefixes can be from the SP’s own
IPv4 network by using encapsulation of IPv6 address block.
in IPv4.
ISATAP Point-to-multipoint tunnels that can be used Sites can use any IPv6 unicast
to connect systems within a site. addresses.
Individual tunnel types are discussed in detail in this document. We recommend that you review and understand
the information about the specific tunnel type that you want to implement. When you are familiar with the
type of tunnel you need, see the table below for a summary of the tunnel configuration parameters that you
may find useful.
Procedure
Step 1 Determine the passenger protocol. A passenger protocol is the protocol that you are encapsulating.
Step 2 Determine the tunnel mode command keyword, if appropriate.
The table below shows how to determine the appropriate keyword to be used with the tunnel mode command.
Keyword Purpose
dvmrp Use the dvmrp keyword to specify that the Distance Vector Multicast Routing
Protocol encapsulation will be used.
gre ip Use the gre and ip keywords to specify that GRE encapsulation over IP will be
used.
gre ipv6 Use the gre and ipv6 keywords to specify that GRE encapsulation over IPv6 will
be used.
ipip Use the ipip keyword to specify that IP-in-IP encapsulation will be used. The optional
[decapsulate-any] decapsulate-any keyword terminates any number of IP-in-IP tunnels at one tunnel
interface. Note that this tunnel will not carry any outbound traffic; however, any
number of remote tunnel endpoints can use a tunnel configured as their destination.
ipv6 Use the ipv6 keyword to specify that generic packet tunneling in IPv6 will be used.
Keyword Purpose
ipv6ip Use the ipv6ip keyword to specify that IPv6 will be used as the passenger protocol
and IPv4 as both the carrier (encapsulation) and transport protocol. When additional
keywords are not used, manual IPv6 tunnels are configured. Additional keywords
can be used to specify IPv4-compatible, 6to4, or ISATAP tunnels.
mpls Use the mpls keyword to specify that MPLS will be used for configuring traffic
engineering (TE) tunnels.
Procedure
Step 5 keepalive [period [retries]] (Optional) Specifies the number of times the
device will continue to send keepalive packets
Example:
without response before bringing the tunnel
Router(config-if)# keepalive 3 7 interface protocol down.
• GRE keepalive packets may be
configured either on only one side of the
tunnel or on both.
• If GRE keepalive is configured on both
sides of the tunnel, the period and retries
arguments can be different at each side
of the link.
Step 9 tunnel mode gre { ip | multipoint} Specifies the encapsulation protocol to be used
in the tunnel.
Example:
Device(config-if)# tunnel mode gre ip
What to Do Next
Proceed to the “Verifying Tunnel Configuration and Operation” section.
Note The configuration of only one IPv4-compatible tunnel and one 6to4 IPv6 tunnel is supported on a router. If
you choose to configure both of these tunnel types on the same router, Cisco recommends that they not share
the same tunnel source.
A 6to4 tunnel and an IPv4-compatible tunnel cannot share the same interface because both of them are NBMA
“point-to-multipoint” access links, and only the tunnel source can be used to reorder the packets from a
multiplexed packet stream into a single packet stream for an incoming interface. When a packet with an IPv4
protocol type of 41 arrives on an interface, the packet is mapped to an IPv6 tunnel interface on the basis of
the IPv4 address. However, if both the 6to4 tunnel and the IPv4-compatible tunnel share the same source
interface, the router cannot determine the IPv6 tunnel interface to which it should assign the incoming packet.
Manually configured IPv6 tunnels can share the same source interface because a manual tunnel is a
“point-to-point” link, and both IPv4 source and the IPv4 destination of the tunnel are defined.
Procedure
Step 3 interface tunnel tunnel-number Specifies a tunnel interface and number and
enters interface configuration mode.
Example:
Step 4 ipv6 address ipv6-prefix/prefix-length [eui-64] Specifies the IPv6 address assigned to the
interface and enables IPv6 processing on the
Example:
interface.
Router(config-if)# ipv6 address • The 32 bits following the initial 2002::/16
2002:c0a8:6301:1::1/64 prefix correspond to an IPv4 address
assigned to the tunnel source.
Step 5 tunnel source {ip-address | interface-type Specifies the source IPv4 address or the source
interface-number} interface type and number for the tunnel
interface.
Example:
Router(config-if)# tunnel source Note The interface type and number
TenGigabitEthernet 4/1/0 specified in the tunnel source
command must be configured with
an IPv4 address.
Step 6 tunnel mode ipv6ip 6to4 Specifies an IPv6 overlay tunnel using a 6to4
address.
Example:
Router(config-if)# tunnel mode ipv6ip
6to4
Step 8 ipv6 route ipv6-prefix / prefix-length Configures a static route to the specified tunnel
tunnel tunnel-number interface.
Example: Note When configuring a 6to4 overlay
Router(config)# ipv6 route 2002::/16 tunnel, you must configure a static
tunnel 0 route for the IPv6 6to4 prefix
2002::/16 to the 6to4 tunnel
interface.
What to Do Next
Proceed to the “Verifying Tunnel Configuration and Operation” section.
Procedure
Step 1 enable
Enables privileged EXEC mode. Enter your password if prompted.
Example:
Device> enable
Example:
To check that the remote IPv6 tunnel endpoint is reachable, use the ping command again on Device A. The
note regarding filtering earlier in step also applies to this example.
Example:
Router A
interface Tunnel 0
ip address 10.1.1.2 255.255.255.0
tunnel source TenGigabitEthernet 4/1/0
tunnel destination 192.168.3.2
tunnel mode gre ip
!
interface TenGigabitEthernet 4/1/0
ip address 192.168.4.2 255.255.255.0
Router B
interface Tunnel 0
ip address 10.1.1.1 255.255.255.0
tunnel source TenGigabitEthernet 4/1/1
tunnel destination 192.168.4.2
tunnel mode gre ip
!
interface TenGigabitEthernet 4/1/1
ip address 192.168.3.2 255.255.255.0
The following example configures a GRE tunnel running both IS-IS and IPv6 traffic between Router A and
Router B:
Router A
ipv6 unicast-routing
clns routing
!
interface Tunnel 0
no ip address
ipv6 address 2001:0DB8:1111:2222::1/64
ipv6 router isis
tunnel source TenGigabitEthernet 4/1/0
tunnel destination 10.0.0.2
tunnel mode gre ip
!
interface TenGigabitEthernet 4/1/0
ip address 10.0.0.1 255.255.255.0
!
router isis
network 49.0000.0000.000a.00
Router B
ipv6 unicast-routing
clns routing
!
interface Tunnel 0
no ip address
ipv6 address 2001:0DB8:1111:2222::2/64
ipv6 router isis
tunnel source TenGigabitEthernet 4/1/0
tunnel destination 10.0.0.1
tunnel mode gre ip
!
interface TenGigabitEthernet 4/1/0
ip address 10.0.0.2 255.255.255.0
!
router isis
network 49.0000.0000.000b.00
address-family ipv6
redistribute static
exit-address-family
interface Tunnel 0
ip address 10.1.2.1 255.255.255.0
traffic-shape rate 500000 125000 125000 1000
tunnel source 10.1.1.1
tunnel destination 10.2.2.2
The following sample configuration shows how to apply the same shaping policy to the tunnel interface with
the MQC commands:
policy-map tunnel
class class-default
shape average 500000 125000 125000
!
interface Tunnel 0
ip address 10.1.2.1 255.255.255.0
service-policy output tunnel
tunnel source 10.1.35.1
tunnel destination 10.1.35.2
Policing Example
When an interface becomes congested and packets start to queue, you can apply a queueing method to packets
that are waiting to be transmitted. Logical interfaces--tunnel interfaces in this example--do not inherently
support a state of congestion and do not support the direct application of a service policy that applies a queueing
method. Instead, you must apply a hierarchical policy. Create a "child" or lower-level policy that configures
a queueing mechanism, such as low-latency queueing, with the priority command and CBWFQ with the
bandwidth command.
policy-map child
class voice
priority 512
Create a "parent" or top-level policy that applies class-based shaping. Apply the child policy as a command
under the parent policy because admission control for the child class is done according to the shaping rate for
the parent class.
policy-map tunnel
class class-default
shape average 2000000
service-policy child
interface tunnel 0
service-policy tunnel
In the following example, a tunnel interface is configured with a service policy that applies queueing without
shaping. A log message is displayed noting that this configuration is not supported.
Procedure
Device> enable
Step 3 interface tunnel tunnel-number Specifies a tunnel interface and number, and
enters interface configuration mode.
Example:
Step 4 Enter one of the following commands: Specifies the IPv6 network assigned to the
interface and enables IPv6 processing on the
• ipv6 address {ipv6-address/prefix-length
interface.
| prefix-name sub-bits/prefix-length}
• ipv6 address ipv6-prefix/prefix-length • If you specify the eui-64 keyword, the
[eui-64] software configures an IPv6 address for
an interface and enables IPv6 processing
Example: on the interface using an EUI-64 interface
ID in the low-order 64 bits of the address.
Device(config-if)# ipv6 address
3ffe:b00:c18:1::3/127
Step 5 tunnel source {ip-address | ipv6-address | Specifies the source IPv4 address, IPv6 address,
interface-type interface-number} or the source interface type and number for the
tunnel interface.
Example:
• If an interface is specified, the interface
Device(config-if)# tunnel source must be configured with an IPv4 address.
Tengigabitethernet 4/1/0
Step 6 tunnel destination {hostname | ip-address | Specifies the destination IPv4 address, IPv6
ipv6-address} address, or hostname for the tunnel interface.
Example:
Step 7 tunnel mode {aurp | cayman | dvmrp | eon | Specifies a GRE IPv6 tunnel.
gre | gre multipoint | gre ipv6 | ipip
Note The tunnel mode gre ipv6
[decapsulate-any] | iptalk | ipv6 | mpls | nos}
command specifies GRE as the
Example: encapsulation protocol for the tunnel.
Device(config-if)# end
Router A Configuration
ipv6 unicast-routing
clns routing
!
interface tunnel 0
no ip address
ipv6 address 3ffe:b00:c18:1::3/127
ipv6 router isis
tunnel source TenGigabitEthernet 4/1/0
tunnel destination 2001:DB8:1111:2222::1/64
tunnel mode gre ipv6
!
interface TenGigabitEthernet4/1/0
ip address 10.0.0.1 255.255.255.0
!
router isis
net 49.0000.0000.000a.00
Router B Configuration
ipv6 unicast-routing
clns routing
!
interface tunnel 0
no ip address
ipv6 address 3ffe:b00:c18:1::2/127
ipv6 router isis
tunnel source TenGigabitEthernet 4/1/0
tunnel destination 2001:DB8:1111:2222::2/64
tunnel mode gre ipv6
!
interface TenGigabitEthernet4/1/0
ip address 10.0.0.2 255.255.255.0
!
router isis
net 49.0000.0000.000b.00
address-family ipv6
redistribute static
exit-address-family
Note You must enable IPv6 or configure IPv6 MTU size more than 1500 on a tunnel's exit interface to avoid
receiving warning messages.
Procedure
Step 3 interface tunnel tunnel-number Specifies a tunnel interface and number and
enters interface configuration mode.
Example:
Device(config)# interface tunnel 0
Step 4 tunnel source {ipv6-address | interface-type Specifies the source IPv6 address or the source
interface-number} interface type and number for the tunnel
interface.
Example:
Step 5 tunnel destination ipv6-address Specifies the destination IPv6 address for the
tunnel interface.
Example:
Device(config-if)# tunnel destination Note Only the syntax used in this context
2001:0DB8:0C18:2::300 is displayed. For more details, see
the IPv6 Command Reference.
router isis
net 49.0001.0000.0000.000a.00
Additional References
The following sections provide references related to the GRE feature.
Related Documents
Standards
Standard Title
MIBs
No new or modified MIBs are To locate and download MIBs for selected platforms, Cisco IOS
supported by this feature. releases, and feature sets, use Cisco MIB Locator found at the
following URL:
http://tools.cisco.com/ITDIT/MIBS/servlet/index
RFCs
RFC Title
RFC Title
Technical Assistance
Description Link
Note The following table lists only the software release that introduced support for a given feature in a given
software release train. Unless noted otherwise, subsequent releases of that software release train also support
that feature.
Generic Routing Cisco IOS XE Everest This feature was integrated into Cisco IOS XE
Encapsulation 16.6.1 Everest 16.6.1 on the Cisco cBR Series Converged
Broadband Routers.