How to create IP-IP tunnel between FreeBSD and Linux March 2nd, 2010
Sometimes, I need to connect remote Unix servers with tunnels to provide some specific services or to get access to some internal networks. I was very surprised, when my friend, young system administrator, asked me about how to bring up IP-IP tunnel between different Unix operating systems (FreeBSD and Linux in his case) and said, that he can’t find information about this configuration. As the result of my discovering, this HOWTO has been created.
Lets see to what we have and what we need to do.
We have 2 servers:
- Server1:
- OS: Linux
- Network Interface: eth0
- IP: 100.100.100.100
- Server2:
- OS: FreeBSD
- Network Interface: fxp0
- IP: 200.200.200.200
We need to get IPv4 over IPv4 tunnel with the following parameters between described servers:
- Server1: 10.0.0.1 / 255.255.255.252
- Server2: 10.0.0.2 / 255.255.255.252
To setup described configuration on Linux server we need to do following steps:
- Create ipip tunnel interface:
# ip tunnel add tun0 mode ipip \\ > remote 200.200.200.200 local 100.100.100.100 dev eth0
- Set interface IP addresses:
# ifconfig tun0 10.0.0.1 netmask 255.255.255.252 \\ > pointopoint 10.0.0.2

