GRE is used to create a VPN tunnel between two sites, as shown in Figure 1. To implement a GRE tunnel, the network administrator must first learn the IP addresses of the endpoints. After that, there are five steps to configuring a GRE tunnel:
Step 1. Create a tunnel interface using the interface tunnel number command.
Step 2. Specify the tunnel source IP address.
Step 3. Specify the tunnel destination IP address.
Step 4. Configure an IP address for the tunnel interface.
Step 5. (Optional) Specify GRE tunnel mode as the tunnel interface mode. GRE tunnel mode is the default tunnel interface mode for Cisco IOS software.
The sample configuration in Figure 2 illustrates a basic GRE tunnel configuration for router R1.
The configuration of R2 in Figure 3 mirrors the configuration of R1.
The minimum configuration requires specification of the tunnel source and destination addresses. The IP subnet must also be configured to provide IP connectivity across the tunnel link. Both tunnel interfaces have the tunnel source set as the local serial S0/0/0 interface and the tunnel destination set as the peer router serial S0/0/0 interface. The IP address is assigned to the tunnel interfaces on both routers. OSPF has also been configured to exchange routes over the GRE tunnel.
The individual GRE tunnel command descriptions are displayed in Figure 4.
Note: When configuring GRE tunnels, it can be difficult to remember which IP networks are associated with the physical interfaces and which IP networks are associated with the tunnel interfaces. Remember that before a GRE tunnel is created, the physical interfaces have already been configured. The tunnel source and tunnel destination commands reference the IP addresses of the preconfigured physical interfaces. The ip address command on the tunnel interfaces refers to an IP network specifically manufactured for the purposes of the GRE tunnel.