Configuration procedure
To configure a GRE/IPv4 tunnel:
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Create a GRE tunnel interface, and specify the tunnel mode as GRE/IPv4. | interface tunnel interface-number mode gre | By default, no tunnel interfaces exist. You must configure the same tunnel mode on both ends of a tunnel. Otherwise, packet delivery might fail. |
3. Configure an IPv4 or IPv6 address for the tunnel interface. | For information about how to assign an IPv4 address to an interface, see "Configuring IP addressing." For information about how to assign an IPv6 address to an interface, see "Configuring basic IPv6 settings." | By default, no IPv4 or IPv6 address is configured for a tunnel interface. When the passenger protocol is IPv4, configure an IPv4 address for the tunnel interface. When the passenger protocol is IPv6, configure an IPv6 address for the tunnel interface. |
4. 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. |
5. 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. |
6. (Optional.) Enable GRE keepalive, and set the keepalive interval and keepalive number. | keepalive [ interval [ times ] ] | By default, GRE keepalive is disabled. |
7. (Optional.) Enable GRE checksum. | gre checksum | By default, GRE checksum is disabled. |
8. (Optional.) Configure a GRE key for the GRE tunnel interface. | gre key key | By default, no GRE key is configured for a GRE tunnel interface. The two ends of a GRE tunnel must have the same key or both have no key. |
9. (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. |
10. (Optional.) Enable GRE packets to carry VPC information. | gre vpc enable | By default, GRE packets do not carry VPC information. |
11. Return to system view. | quit | N/A |
12. (Optional.) Configure the device to discard IPv6 packets with IPv4-compatible IPv6 addresses. | tunnel discard ipv4-compatible-packet | By default, the device does not discard such IPv6 packets. |
For more information about the interface tunnel, source, destination, tunnel dfbit enable, and tunnel discard ipv4-compatible-packet commands and additional configuration commands on a tunnel interface, see tunnel configuration and commands in Layer 3—IP Services Configuration Guide and Layer 3—IP Services Command Reference.