This section describes how to create a tunnel interface of a GRE tunnel to be established. After tunnel interfaces are created, set the encapsulation type to GRE and specify a tunnel source address or source interface, as well as a destination address for the GRE tunnel to be established. In addition, assign an IP address to the tunnel interface if a dynamic routing protocol is used.
A tunnel interface must be configured on each end of a GRE tunnel to be established. For the tunnel interface, set the protocol type to GRE and configure a source IP address or interface, as well as a destination IP address. You also need to specify an IP address if a dynamic routing protocol is used.
Note that you must not specify the involved tunnel interface as the source interface for a GRE tunnel. Instead, specify another interface that can be either a common interface or the tunnel interface of another tunnel on the same device.
A configured interface MTU value is valid on locally originated packets that are encapsulated by GRE, but is invalid on the accepted packets that are encapsulated by GER and forwarded over the GRE tunnel.
The destination address configured for the tunnel interface is unreachable or is set to the IP address of the tunnel interface.
The source interface configured for the tunnel interface is down.
The IP address configured on the tunnel interface is invalid.
The Keepalive function is configured on the tunnel interface and detects that the tunnel remote end is unreachable.
If the tunnel interface is deleted, all configurations on the tunnel interface are also deleted.
Perform the following steps on both ends of a tunnel.
The system view is displayed.
A tunnel interface is created, and its view is displayed.
For centralized GRE in which a three-dimensional tunnel interface is used, the slot ID of the tunnel interface must be the same as the slot ID of the tunnel service board on which the tunnel's source interface resides. A slot ID inconsistency causes a failure to establish a GRE tunnel.
A tunnel description is configured.
GRE is configured as a tunneling protocol.
A source address or source interface of the tunnel is configured.
The binding tunnel gre command must be run to bind GRE to the source interface or the interface where the source address resides. After the binding is configured, a GRE tunnel can use such an interface to forward packets encapsulated by GRE.
The destination IP address of the tunnel is configured.
An MTU value of the tunnel interface is set.
Path MTU learning is enabled.
If two BGP nodes on which the peer path-mtu auto-discovery command is run communicate over a GRE tunnel, you can run the tunnel pathmtu enable command on tunnel interfaces of both nodes to prevent repetitive fragmentation for TCP packets carrying BGP messages when such packets are transmitted along the GRE tunnel, improving BGP message transmission efficiency.
An MSS value is set for inbound TCP SYN/SYN+ACK packets of the GRE tunnel.
You can set the MSS value less than the sum of the configured interface MTU and GRE header length, so that the packets accepted by the tunnel interface will not be fragmented when being transmitted over the GRE tunnel.
To configure an IPv4 address, run the ip address ip-address { mask | mask-length } [ sub ] command.
To configure the tunnel interface to borrow an IPv4 address, run the ip address unnumbered interface interface-type interface-number command.
If a dynamic routing protocol is used on the tunnel interface, configure an IP address for the tunnel interface. The IP addresses of the tunnel interfaces on both ends of the GRE tunnel can be public or private addresses and must be on the same network segment.
A tunnel interface is mapped to a tunnel service board so that GRE fragments can be assembled on the tunnel service board.
If GRE packets are fragmented during transmission over a tunnel (for example, when multiple intermediate links forward packets in load balancing mode), configure a packet reassembly board on the egress of the tunnel so that all fragmented packets are reassembled on the same board.
The target reassemble board command takes effect for distributed GRE tunnels only.
Exit the tunnel interface view.
A forwarding mode is specified, which takes effect on all distributed GRE tunnels.
You can configure a proper forwarding mode based on service requirements.
The command takes effect only for distributed GRE tunnels.
The configuration is committed.