GRE Tunneling

by

Hugo Samayoa

lordvega@teknofx.com

GRE is a tunneling protocol that was originally developed by Cisco. The tools that you need to perform these tasks are the famous iproute2 tools. This package can be found at the Institute for Nuclear Research RAS, Moscow, Russia. ftp://ftp.inr.ac.ru/ip-routing/iproute2-current.tar.gz.

This new networking code brings Linux performance and feature set with little competition in the general OS arena. In fact, the new routing filtering, and classifying code has more features then provided by many dedicated routers, firewalls, and traffic shaping products. I should know this I work at an ISP.

You'll have to recompile the kernel in Linux, because you'll need the ip_gre module.

Lets say you have 2 networks that you want to connect to each other. These networks are both connected to the Internet.


So we have Hugo's network:

network 10.0.1.0
netmask 255.255.255.0
router  10.0.1.1
Internet 172.16.17.18

and CLUG's network:

network 10.0.2.0
netmask 255.255.255.0
router  10.0.2.1
Internet 172.19.20.21

On the router of Hugo's network, you do the following:

ip tunnel add clug mode gre remote 172.19.20.21 local 172.16.17.18 ttl 255
ip addr add 10.0.1.1 dev clug
ip link set clug up
ip link set clug mtu 1514
ip route add 10.0.2.0/24 dev clug

But enough about this, let's go on with the router of the CLUG network

ip tunnel add hugo mode gre remote 172.16.17.18 local 172.19.20.21 ttl 255
ip addr add 10.0.2.1 dev hug
ip link set hugo up
ip link set hugo mtu 1514
ip route add 10.0.1.0/24 dev hugo

One last thing is when you want to delete the tunnel.

ip link set clug down
ip tunnel del clug

Of course, you can replace clug with hugo for the CLUG router