0

I setup a Ubuntu VM with 2 OpenVPN tunnels up and running. What I want is a simple forwarding (complete traffic) coming from local LAN interface 1 (ens160 10.0.247.2/24) forwarded to VPN interface tun0 and all traffic coming from local LAN interface 2 (ens224 10.0.246.2/24) to VPN tun1. At the moment it does not differ, if traffic is coming from LAN1 or LAN2, because it is simply routed to tun0. VPN connections are dynamic (Public VPN Providers). Can someone help me ?

Here is the output of route -n: Picture

And these are the iptables and routing settings I already tried:

iptables -A FORWARD -s 10.0.247.0/24 -i ens160 -o tun0 -m conntrack --ctstate NEW -j ACCEPT

iptables -A FORWARD -s 10.0.246.0/24 -i ens224 -o tun1 -m conntrack --ctstate NEW -j ACCEPT

iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

iptables -A POSTROUTING -o tun0 -t nat -j MASQUERADE iptables -A POSTROUTING -o tun1 -t nat -j MASQUERADE

sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

Thanks in advance :-) Jan

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.