Goal: Ensure all traffic is forced over VPN tunnel from all network interfaces (wlan0,rmnet0,rmnet1), that is all traffic is dropped when not connected to VPN. In other words, Internet traffic should not be allowed, and only traffic over the VPN is acceptable.
So far... Android Device with iptables binary, wlan & 3g connection VPN gateway @ 10.10.10.10 (not real address).
iptables -P OUTPUT DROP
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i tun0 -m conntrack --ctstate NEW -j ACCEPT
iptables -A INPUT -j DROP
iptables -A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o tun0 -m conntrack --ctstate NEW -j ACCEPT
iptables -A OUTPUT -d 10.10.10.10 -m conntrack --ctstate NEW -j ACCEPT
iptables -A OUTPUT -j DROP
Results:
Traffic appears to be blocked - but so too is connection to VPN.
Any ideas? Appreciate this is only mobile data rmnet0 interface and doesn't have WiFi in here yet.