Configuring a GRE/IPv4 tunnel
Restrictions and guidelines
This task describes only GRE/IPv4 tunnel required tunnel interface commands (the interface tunnel, source, and destination commands). For more tunnel interface commands, see "Configuring tunneling."
Procedure
Enter system view.
system-view
Create a GRE tunnel interface, and specify the tunnel mode as GRE/IPv4.
interface tunnel number mode gre
You must configure the same tunnel mode on both ends of a tunnel. Otherwise, packet delivery might fail.
Configure an IP address for the tunnel interface based on the passenger protocol.
IPv4:
For information about how to assign an IPv4 address to an interface, see "Configuring IP addressing."
IPv6:
For information about how to assign an IPv6 address to an interface, see "Configuring basic IPv6 settings."
By default, no IP address is configured for a tunnel interface.
Configure a source address or source interface for the tunnel interface.
source { ip-address | interface-type interface-number }
By default, no source address or interface is configured for a tunnel interface.
If you configure a source address for a tunnel interface, the tunnel interface uses the source address as the source address of the encapsulated packets.
If you configure a source interface for a tunnel interface, the tunnel interface uses the primary IP address of the source interface as the source address of the encapsulated packets.
Configure a destination address for the tunnel interface.
destination ip-address
By default, no destination address is configured for a tunnel interface.
The destination address is the address of the physical interface that the tunnel remote end uses to receive packets from the GRE tunnel.
The tunnel local end uses this address as the destination address of the encapsulated packets.
The tunnel destination address and the IP address of the tunnel interface must be in different subnets.
(Optional.) Enable GRE keepalive, and set the keepalive interval and keepalive number.
keepalive [ interval [ times ] ]
By default, GRE keepalive is disabled.
(Optional.) Set the DF bit for encapsulated packets.
tunnel dfbit enable
By default, the DF bit is not set, allowing encapsulated packets to be fragmented.