×

UniFi Video will reach end-of-support on December 31st, 2020.

For more information, please refer to the official community notice.

EdgeRouter - GRE Tunnel

Overview

Readers will learn how to create a GRE (Generic Routing Encapsulation) tunnel on an EdgeRouter.

NOTES & REQUIREMENTS:
  • Applicable to the latest firmware on all EdgeRouter models.

Configuring a GRE Tunnel

topology.png

The GRE tunnel will be used to route traffic between the 192.168.1.0/24 and 172.16.1.0/24 networks.

Follow the steps below to configure the GRE tunnel on both routers:

CLI: Access the Command Line Interface on ER-L using SSH.

1. Enter configuration mode.

configure

2. Create the tunnel interface and define the local and remote tunnel endpoints.

set interfaces tunnel tun0 local-ip 203.0.113.1
set interfaces tunnel tun0 remote-ip 192.0.2.1

3. Define the tunnel encapsulation method.

set interfaces tunnel tun0 encapsulation gre

4. Define the IP address associated with the GRE tunnel

set interfaces tunnel tun0 address 10.255.12.1/30

5. Create a static route for the remote subnet.

set protocols static interface-route 172.16.1.0/24 next-hop-interface tun0

6. Commit the changes and save the configuration.

commit ; save
CLI: Access the Command Line Interface on ER-R using SSH.

1. Enter configuration mode.

configure

2. Create the tunnel interface and define the local and remote tunnel endpoints.

set interfaces tunnel tun0 local-ip 192.0.2.1
set interfaces tunnel tun0 remote-ip 203.0.113.1

3. Define the tunnel encapsulation method.

set interfaces tunnel tun0 encapsulation gre

4. Define the IP address associated with the GRE tunnel

set interfaces tunnel tun0 address 10.255.12.2/30

5. Create a static route for the remote subnet.

set protocols static interface-route 192.168.1.0/24 next-hop-interface tun0

6. Commit the changes and save the configuration.

commit ; save
NOTE: The GRE tunnel can also be routed over a Policy-Based IPsec Site-to-Site VPN. To do this, create loopback interfaces and exchange the local and remote IP addresses of the GRE tunnel using IPsec.

Related Articles

EdgeRouter - EoGRE Layer 2 Tunnel

EdgeRouter - Policy-Based Site-to-Site IPsec VPN

Intro to Networking - How to Establish a Connection Using SSH

Was this article helpful?
4 out of 7 found this helpful