Category Archives: IP Network

How to configure an IP Tunnel

An IP tunnel is an Internet Protocol (IP) network communications channel between two networks. It is used to transport another network protocol by encapsulation of its packets.

IP tunnels are often used for connecting two disjoint IP networks that don’t have a native routing path to each other, via an underlying routable protocol across an intermediate transport network. In conjunction with the IPsec protocol they may be used to create a virtual private network between two or more private networks across a public network such as the Internet. Another prominent use is to connect islands of IPv6 installations across the IPv4 Internet.

You could try by two ways.
On-the-fly way
In the first (192.168.0.18) endpoint:
ip tunnel add mytun mode ipip local 192.168.0.18 remote 192.168.0.118
ip addr add 10.168.0.18/24 dev mytun
ip link mytun up

In the second (192.168.0.118) endpoint:
ip tunnel add mytun mode ipip local 192.168.0.118 remote 192.168.0.18
ip addr add 10.168.0.118/24 dev mytun
ip link mytun up

Permanent way
Host 192.168.0.18:
DEVICE=mytun
TYPE=IPIP
MY_OUTER_IPADDR=192.168.0.18
PEER_OUTER_IPADDR=192.168.0.118
MY_INNER_IPADDR=10.168.0.18/24
PEER_INNER_IPADDR=10.168.0.118/24
ONBOOT=yes

Host 192.168.0.118:
DEVICE=mytun
TYPE=IPIP
MY_OUTER_IPADDR=192.168.0.118
PEER_OUTER_IPADDR=192.168.0.18
MY_INNER_IPADDR=10.168.0.118/24
PEER_INNER_IPADDR=10.168.0.18/24
ONBOOT=yes

To starting tunnel is simple. On host 192.168.0.18 and on host 192.168.0.118:
ifup mytun

If you want check up tunnel:
ip addr ls

Reference: wikipedia.org, daverdave.com

IP Failover configuration

Guide to configure IP Failover on CentOS server in ovh farm.
nano /etc/sysconfig/network-scripts/ifcfg-eth0:0
Copy and paste this code:
DEVICE="eth0:0"
BOOTPROTO=static
IPADDR="IP.FAIL.OVER"
NETMASK="255.255.255.255"
BROADCAST="IP.FAIL.OVER"
ONBOOT=yes

IP.FAIL.OVER is ip number of your IP Failover. Now set new interface and reboot server:
ifup eth0:0
/sbin/reboot

When server restarted ping IP.FAIL.OVER:
ping IP.FAIL.OVER
If you have more IP Failover, set eth0:1, eth0:2, ..

Reference: ovh.it