I'm trying to capture connections using tproxy, but I'm unable to receive IPv6 TCP connections. IPV4 TCP and both UDP work properly. TCP v4 and v6 are both received from the same accept call. I'm on Android 9.
PORT=2080
MARK=2080
iptables -t $TABLE -A $CHAIN -p tcp -j TPROXY --on-port $PORT --tproxy-mark $MARK
iptables -t $TABLE -A $CHAIN -p udp -j TPROXY --on-port $PORT --tproxy-mark $MARK
ip rule add fwmark $MARK lookup 100
ip route add local default dev lo table 100
ip6tables -t $TABLE -A $CHAIN -j LOG --log-prefix='[iptables] '
ip6tables -t $TABLE -A $CHAIN -p tcp -j TPROXY --on-port $PORT --tproxy-mark $MARK
ip6tables -t $TABLE -A $CHAIN -p udp -j TPROXY --on-port $PORT --tproxy-mark $MARK
ip -6 rule add fwmark $MARK lookup 100
ip -6 route add local default dev lo table 100
The log output shows ICMP packets and TCP packets with IPv6 and IPv4 addresses, but only IPv4 gets accepted on the listener.
Occasionally something connects from WSL on my laptop, but nothing else connects over ipv6 and browser tests such as https://ipv6-test.com/ say ipv6 failed.
Running the command
curl google.com
in WSL hangs until I press ctrl+c, at which point the accept call returns the now useless socket.
Asked by Arlen Beiler
(111 rep)
Jul 21, 2022, 03:20 AM