tproxy is a feature in Linux which allows an intermediate router to run a proxy server which can intercept and modify network traffic transparently (i.e. the end systems cannot tell that this has been done, as the source/destination IP addresses in the packets are not modified.) tproxy also works with IPv6, whereas non-transparent mechanisms such as the iptables REDIRECT target do not because of the lack of NAT support in the Linux IPv6 stack. Java’s standard library does not provide built-in support for using tproxy, and it has a few annoyances which make it tricky to implement. This blog post covers how I managed to get tproxy to work in a Java program.