Configure a GRE Tunnel
Configuration Condition
Before configuring a GRE tunnel, ensure that:
- Interface IP addresses have been configured so that neighbor nodes are reachable at the network layer.
- Tunnel interfaces have been created and the basic parameters have been configured. (Refer to tunnel interface configuration manual.)
- A unicast protocol has been configured so that the routes at the two ends of the tunnel are reachable.
Configure a GRE Tunnel
Table 10-2 Configuring a GRE tunnel
Step
|
Command
|
Description
|
Enter the global configuration mode. |
configure terminal |
- |
Enter the tunnel interface configuration mode.
|
interface tunnel tunnel-number
|
-
|
Configure the tunnel interface address
|
ip address ip-address { mask | mask-length }
|
Mandatory
By default, no address is configured for the tunnel interface.
|
Configure the tunnel interface mode to GRE over IPv4.
|
tunnel mode gre ip
|
Optional.
By default, the tunnel interface mode is GRE over IPv4.
|
Configure the source address or interface name on the tunnel interface.
|
tunnel source { ip-address | interface-name }
|
Mandatory.
By default, the source address and interface name are not configured on the tunnel interface.
|
Configure the destination address or host name on the tunnel interface.
|
tunnel destination { ip-address | hostname }
|
Mandatory.
By default, the destination address and host name are not configured on the tunnel interface.
|
-
On the two ends of a tunnel, the source addresses and destination addresses must be configured. The source address of one end is the destination end of the other end.
- In configuring the source of a tunnel, if the interface mode is adopted, the primary address of the source interface is used as the source address of the tunnel.
- The two ends of a tunnel must be configured with the same tunnel mode; otherwise, transmission through the tunnel fails.
- On one device, two or more tunnels with the same tunnel mode, source address and destination address are not allowed.