m13253 / userland-ipip

Userland IPIP + IP6IP (6in4) / IPIP6 + IP6IP6 tunnel for Linux
GNU General Public License v3.0
23 stars 3 forks source link

IPIP6 tunnel #1

Open ameen-mcmxc opened 2 years ago

ameen-mcmxc commented 2 years ago

Hi, I want to encapsulate my IP v4 packet in the IPv6 tunnel just like shown in my topology.

So packets should be encapsulated at B4 and sent to AFTR

image

Which commands are suitable for me? I have cloned your repo and downloaded "go" on both sides of my tunnel endpoints (B4 & AFTR) machines.

Thanks Ameen

m13253 commented 2 years ago

First, build the program using Go compiler by typing:

./build.sh

The resulting program will be in ./build/ipip. You can move it to other paths at your convenience.

On B4:

sudo ip tuntap add mode tun name tun-aftr
sudo ip address add 10.0.1.1 peer 10.0.1.2/32 dev tun-aftr
sudo ip route replace 198.51.100.0/24 dev tun-aftr
sudo ./build/ipip dev tun-aftr remote 2001:db8:0:1::2 1460 &

On AFTR:

sudo ip tuntap add mode tun name tun-b4
sudo ip address add 10.0.1.2 peer 10.0.1.1/32 dev tun-b4
sudo ip route replace 10.0.0.0/24 dev tun-b4
sudo ./build/ipip dev tun-b4 remote 2001:db8:0:1::1 1460 &

The symbol & means putting the command to background. You will have to use killall to stop the background process. I am sure you want to automate this procedure. I have provided two methods in the Readme file, one is using systemd on systemd-enabled distros, the other is using /etc/network/interfaces on Debian. You can check the Readme document to learn how to automate the commands so you don't have to type every time the server is rebooted.

ameen-mcmxc commented 2 years ago

Thanks for your quick reply.

I noticed that you used "tun-rabbit" in your reply, is that a typo or what ? So, in B4 side, I should use the following command: - sudo ./build/ipip dev tun-b4 remote 2001:db8:0:1::2 1460 &

Note: I am using CentOS machines.

m13253 commented 2 years ago

I noticed that you used "tun-rabbit" in your reply, is that a typo or what ?

Yes. That was a typo. I fixed it.

I don't use CentOS and don't have plan to support CentOS. But you can use whatever automation tools you have on your distro to automatically execute the commands on system startup.