BeezNest Open-Source specialists

July 14, 2008

IP in IP or GRE tunnel using iproute

Filed under: OSS Solutions, Tech Crunch — jwarnier @ 1:50 am
Tags: , , ,
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.

2 Comments »

  1. [...] IP in IP or GRE tunnel using iproute for the Linux configuration [...]

    Pingback by GRE tunnels between Cisco and Linux routers using iproute « BeezNest Open-Source specialists — July 14, 2008 @ 1:52 am | Reply

  2. [...] reference 2: [...]

    Pingback by GRE Tunnels are handy! (Cisco-Linux and Linux-Linux) « Papa Delta Sierra — April 14, 2009 @ 4:42 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.