wiki'd

by JoKeru

IPIP Tunnel

IPIP kind of tunnels is the simplest one. It has the lowest overhead, but can incapsulate only IPv4 unicast traffic, so you will not be able to setup OSPF, RIP or any other multicast-based protocol. You can setup only one tunnel for unique tunnel endpoints pair. It can work with FreeBSD and cisco IOS. Kernel module is 'ipip'.

The following setup will configure an IPIP tunnel between Node 1 (having 10.20.30.40 as public IP) and Node 2 (having 50.60.70.80 as public IP). The IPIP tunnel subnet used will be 192.168.1.0/30 since we only need 2 IPs. We'll also route 2 other subnets from Node 1 to Node 2 and from Node 2 to Node 1 using the newly created IPIP interfaces.

Server_1

$ modprobe ipip
$ ip tunnel add ipip1 mode ipip local 10.20.30.40 remote 50.60.70.80
$ ip address add dev ipip1 192.168.1.1 peer 192.168.1.2/30
$ ip link set dev ipip1 up
$ ip route add 172.16.20.0/24 via 192.168.1.2

$ ip link show ipip1  
$ ifconfig ipip1  

Server_2

$ modprobe ipip
$ ip tunnel add ipip1 mode ipip local 50.60.70.80 remote 10.20.30.40
$ ip address add dev ipip1 192.168.1.2 peer 192.168.1.1/30
$ ip link set dev ipip1 up
$ ip route add 172.16.10.0/24 via 192.168.1.1

$ ip link show ipip1
$ ifconfig ipip1

$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=201 ms

$ ping 172.16.10.1
PING 172.16.10.1 (172.16.10.1) 56(84) bytes of data.
64 bytes from 172.16.10.1: icmp_seq=1 ttl=63 time=211 ms

Cleanup

$ ip tunnel del ipip1
$ rmmod ipip

Comments