[Day 12] 4. GRE Tunnel Configuration
Network Topology Overview
-
Router A (LAN Side): Network
172.16.10.0/24- Router A g0/1 (Public/Internet Interface): IP
75.1.1.1 - Router A Tunnel0 Interface: IP
172.16.20.1/24
- Router A g0/1 (Public/Internet Interface): IP
-
Router B (LAN Side): Network
172.16.30.0/24- Router B g0/1 (Public/Internet Interface): IP
80.1.1.1 - Router B Tunnel0 Interface: IP
172.16.20.2/24
- Router B g0/1 (Public/Internet Interface): IP
-
Tunnel Between A and B:
- Tunnel0 IP on A:
172.16.20.1/24 - Tunnel0 IP on B:
172.16.20.2/24
- Tunnel0 IP on A:
Purpose
You are configuring a GRE tunnel between Router A and Router B to enable communication between their respective LAN networks:
- Router A's LAN:
172.16.10.0/24 - Router B's LAN:
172.16.30.0/24
The GRE tunnel allows traffic between these private LANs to traverse the internet using encapsulation.
Configuration Breakdown
Router A Configuration
A(config)# ip route 172.16.30.0 255.255.255.0 172.16.20.2- Static route: Configures a route to reach Router B's LAN network () via the tunnel's destination IP (
172.16.30.0/24), which is the Tunnel0 IP of Router B.172.16.20.2
A(config)# int tunnel0 A(config-if)# no shut A(config-if)# ip address 172.16.20.1 255.255.255.0 A(config-if)# tunnel source 75.1.1.1 A(config-if)# tunnel destination 80.1.1.1 A(config-if)#ip mtu 1420 A(config-if)# exit- Tunnel Interface ():
tunnel0- IP address: Configured as (the local end of the tunnel).
172.16.20.1/24 - Tunnel source: The public IP of Router A's interface (), facing the internet.
75.1.1.1 - Tunnel destination: The public IP of Router B (), which the tunnel will terminate at.
80.1.1.1 - MTU (Maximum Transmission Unit): Set to , which allows proper packet sizing and avoids fragmentation issues within the tunnel.
1420
- IP address: Configured as
Router B Configuration:
B(config)# ip route 172.16.10.0 255.255.255.0 172.16.20.1- Static route: Configures a route to reach Router A's LAN network () via the tunnel's destination IP (
172.16.10.0/24), which is the Tunnel0 IP of Router A.172.16.20.1
B(config)# int tunnel0 B(config-if)# no shut B(config-if)# ip address 172.16.20.2 255.255.255.0B(config-if)# tunnel source 80.1.1.1 B(config-if)# tunnel destination 75.1.1.1 B(config-if)#ip mtu 1420 B(config-if)# exit- Tunnel Interface ():
tunnel0- IP address: Configured as (the local end of the tunnel on Router B).
172.16.20.2/24 - Tunnel source: The public IP of Router B's interface (), facing the internet.
80.1.1.1 - Tunnel destination: The public IP of Router A (), where the tunnel will terminate.
75.1.1.1 - MTU: Set to , ensuring compatibility with the tunnel MTU on Router A and avoiding fragmentation.
1420
- IP address: Configured as
How the GRE Tunnel Works ?
- The GRE tunnel connects Router A and Router B across the internet, allowing the private networks on either side (and
172.16.10.0/24) to communicate as if they were on the same local network.172.16.30.0/24 - The static routes on both routers ensure that traffic intended for the other LAN (e.g., traffic from destined for
172.16.10.0/24) is forwarded through the tunnel.172.16.30.0/24
Key Points
- The tunnel encapsulates private traffic from the LANs, allowing it to travel across the public internet without being exposed.
- MTU of is specified to ensure that packets fit within the maximum transmission size across the tunnel without causing fragmentation.
1420 - The static routes on both routers direct LAN traffic into the tunnel for cross-network communication.
This configuration effectively creates a secure, private link between the two routers and their LANs over the public internet using GRE encapsulation.
Read Next
[Day 12] 5. IP Sec (IP Security)
### **IPsec (Internet Protocol Security)** IPsec is a protocol suite designed to secure IP communications by **authenticating** and **encrypting**...
Software Defined Network (SDN) by Sandeep Sir
### **What is Network Function Virtualization (NFV)?** A **Software-Defined Network (SDN)** is a way to manage networks using software instead of r...