Home > English, OSS Solutions, Tech Crunch > IP in IP or GRE tunnel using iproute

IP in IP or GRE tunnel using iproute

This article was first written in August 2004 for the BeezNest technical
website (http://glasnost.beeznest.org/articles/166).

Setting an IP in IP or GRE tunnel using iproute between two Linux routers is relatively easy.

Given the following two routers, each one gateway for its network:

routerA

Public IP: 87.65.43.21

Private network: 192.168.4.0/24

IP on that private network: 192.168.4.4

routerB

Public IP: 123.45.67.8

Private network: 192.168.10.0/24

IP on that private network: 192.168.10.4

To setup routerA, will issue the following commands on the command line, after having loaded the ipip or ip_gre module

# ip tunnel add routerb mode gre remote 123.45.67.8 local 87.65.43.21 ttl 255
# ip link set routerb up
# ip addr add 192.168.10.4 dev routerb
# ip route add 192.168.4.0/24 dev routerb

and of course the following on routerB

# ip tunnel add routera mode gre remote 87.65.43.21 local 123.45.67.8 ttl 255
# ip link set routera up
# ip addr add 192.168.4.4 dev routera
# ip route add 192.168.0.0/24 dev routera

See also http://lackof.org/taggart/tunnel/ or http://www.linuxguruz.com/iptables/howto/2.4routing-5.html keeping in mind that IP in IP and GRE tunnels are similarily configured using iproute.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: