Unifix knowledge database - The original one

Dashboard - News - Search - List - About - Admin


IPIP Tunneling in linux

Author:mike - Sun Jul 21 09:54:47 2002

With ipip tunneling you can connect to LAN through internet like this:

____________                    ____________
|           |                   |           |
|   Lan1    |___________________|   Lan2    |
| 10.1.x.x  |      Internet     | 10.2.x.x  |
|___________|                   |___________|
 Global IP:                      Global IP:
 80.80.80.80                     90.90.90.90

If ipip-tunneling wasnt compiled into the kernel but is compile as a module you have to modprobe it first, use:
modprobe ipip

Then we make the tunnel it self, "tundev" is the name of the device that will be created to host the tunnel. 80.80.80.80 is the tunnel endpoints IP.
iptunnel add tundev mode ipip remote 80.80.80.80

Then the tundev interface needs an ip, this will typical be the same as the lan adresss of the server.
ifconfig tundev 10.2.1.1

And finaly we add routing, this line tells the TCP/IP stack that network 10.1.0.0/16 (10.1.x.x) can be reached through gateway 10.2.1.1 via the interface tundev
route add -net 10.1.0.0/16 gw 10.2.1.1 dev tundev


Finally two examples that shows how to link the two above lans. Both must be ran on the server which has the global IP bounded to an interface.

 this is for Lan1
modprobe ipip
iptunnel add tundev mode ipip remote 90.90.90.90
ifconfig tundev 10.1.1.1
route add -net 10.2.0.0/16 gw 10.1.1.1 dev tundev

 this is for Lan2
modprobe ipip
iptunnel add tundev mode ipip remote 80.80.80.80
ifconfig tundev 10.2.1.1
route add -net 10.1.0.0/16 gw 10.2.1.1 dev tundev
Copyright(c) Unifix.org 2002-2011


Dashboard - News - Search - List - About - Admin
 
Powered by Mikjaer Consulting Solutions - Hosted by Specialhosting.dk