Posted by: paulsuela | April 11, 2009

GRE Tunnels are handy! (Cisco-Linux and Linux-Linux)

Remember to add the ip_gre module first in the linux box prior to configuration.  You can load the linux commands in /etc/rc.d/rc.local file to make sure the module & configs are run.. much like the autoexec.bat in ms-dos olden days.

reference 1:

reference 2:

CISCO to LINUX GRE TUNNEL

CISCO ROUTER CONFIG
!
interface FastEthernet4
description Interface connected to Internet
ip address 10.10.10.1 255.255.255.252
!
interface Tunnel1
description connection to Linux Network
ip address 1.1.1.1 255.255.255.0
tunnel source 10.10.10.1
tunnel destination 20.20.20.1
tunnel mode gre ip
!
! — network behind the linux router —
ip route 192.168.200.0 255.255.255.0 Tunnel1
!

LINUX ROUTER CONFIG

# modprobe ip_gre
# ip tunnel add toCiscorouter mode gre remote 10.10.10.1 local 20.20.20.1 ttl 255
# ip link set toCiscorouter up
# ip addr add 1.1.1.2 dev toCiscorouter
# ip route add 1.1.1.0/24 dev toCiscorouter
#
# — network behind the cisco router —
# ip route add 192.168.500.0/24 dev toCiscorouter

LINUX to LINUX GRE TUNNEL
LINUX ROUTER-A CONFIG

# modprobe ip_gre
# ip tunnel add routerb mode gre remote 10.10.10.1 local 20.20.20.1 ttl 255
# ip link set routerb up
# ip addr add 1.1.1.1 dev routerb
# ip route add 1.1.1.0/24 dev routerb
# ip route add 192.168.200.0/24 dev routerb

LINUX ROUTER-B CONFIG

# modprobe ip_gre
# ip tunnel add routera mode gre remote 20.20.20.1 local 10.10.10.1 ttl 255
# ip link set routera up
# ip addr add 1.1.1.2 dev routera
# ip route add 1.1.1.0/24 dev routera
# ip route add 192.168.500.0/24 dev routera



Responses

  1. Thanks for the post! Is it possible to set up a GRE tunnel between 2 routers (linux) within the same network?

    • yes it is. just do the linux config in the guides in my post for each linux gre “router” you will use. however, you should at least have different network addresses (boxA = 192.168.1.x, boxB 192.168.2.x) behind the linux gre “router” boxes so they dont cause an ip address conflict once the tunnel between the 2 linux boxes come online.


Leave a response

Your response:

Categories