IPIP tunnel

Connect two LANs through an IPIP tunnel.

Network

Scroll sideways to exploreOpen full diagram
PC1–R1 and R3–PC2 are private LANs; R1 and R3 reach each other through transit router R2.
The dashed path is the tunnel to create.
Open a console

1. Test initial connectivity

R1

ping -n -c 3 -W 1 212.220.12.5

PC1

ping -n -c 3 -W 1 10.0.0.2

R3 replies, but PC2 is not yet reachable.

2. Create the tunnel

R1

ip tunnel add tun0 mode ipip local 212.220.12.1 remote 212.220.12.5
ip address add 10.255.0.1/30 dev tun0
ip link set dev tun0 up
ip route replace 10.0.0.0/24 via 10.255.0.2 dev tun0

R3

ip tunnel add tun0 mode ipip local 212.220.12.5 remote 212.220.12.1
ip address add 10.255.0.2/30 dev tun0
ip link set dev tun0 up
ip route replace 192.168.1.0/24 via 10.255.0.1 dev tun0

3. Verify encapsulation

R2

timeout 120 tcpdump -U --immediate-mode -i eth0 -w /tmp/lab-ipip.pcap "ip proto 4" &
capture_pid=$!
sleep 1

PC1

ping -n -c 3 -W 1 10.0.0.2

PC2

ping -n -c 3 -W 1 192.168.1.2

R2

sleep 2
kill -INT "$capture_pid"
wait "$capture_pid" || true
tcpdump -nn -e -r /tmp/lab-ipip.pcap "ip proto 4"

Both pings should succeed. Find the outer IPv4 header with 212.220.12.1/.5 and the inner header with the PC addresses.

Validation

Click "Check". Once all steps pass, click "End".