User Tools

Site Tools


tinctunnel

This is an old revision of the document!


Tinc Tunnel

You should already have a Tinc tunnel running between these 2 machines: TincVPN Setup
To ensure that data is getting forwarded to the gateway and back
Run this on the client

echo '100 TUNNEL' >> /etc/iproute2/rt_tables
ip rule add from 10.0.0.0/24 table TUNNEL
ip route add default via 10.0.0.1 table TUNNEL

Forward traffic on the gateway

# Masquerade outgoing traffic
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
# Allow return traffic
iptables -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# Forward everything
iptables -A FORWARD -j ACCEPT

Test it

curl http://www.cpanel.net/showip.cgi --interface 10.0.0.2

Sources:
https://unix.stackexchange.com/questions/283801/iptables-forward-traffic-to-vpn-tunnel-if-open
https://wiki.buyvm.net/doku.php/gre_tunnel

tinctunnel.1594883327.txt.gz · Last modified: 2021/11/25 22:43 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki