![]() S.setsockopt(socket.IPPROTO_IP, IP_TRANSPARENT, 1) S.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) S = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ![]() Iptables -t mangle -A PREROUTING -i br1 -p tcp -j TPROXY -on-ip 127.0.0.1 -on-port 1234 -tproxy-mark 0x1/0x1Īfter that I launched a toy Python server from Cloudflare blog: import socket ![]() Ip netns exec ns0 ip route add default via 192.168.3.1 Ip netns exec ns0 ip addr add 192.168.3.2/24 dev veth1 Ip link add veth0 type veth peer name veth1 The following script worked on a clean Ubuntu 18.04.3: ip netns add ns0 I'm trying to understand how TPROXY works in an effort to build a transparent proxy for Docker containers.Īfter lots of research I managed to create a network namespace, inject an veth interface into it and add TPROXY rules.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |