I have the following rules in INPUT chain:
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -s 127.0.0.1/32 -j ACCEPT
-A INPUT -s 10.0.0.0/8 -j ACCEPT
-A INPUT -s 172.16.0.0/12 -j ACCEPT
-A INPUT -s 192.168.0.0/16 -j ACCEPT
-A INPUT -j DROP
It is dead simple: traffic from private addreses is allowed, the rest is dropped. If I attempt a TCP connection from any public address, it is dropped, as expected. However, UDP traffic is allowed through, on any port. What am I missing here? System is Debian 9, kernel version 4.9.30-2+deb9u5.
EDIT: I was wrong, TCP traffic passes through as well (it was blocked elsewhere). So with these rules, all traffic is accepted. How is this possible?
EDIT 2: I was wrong again, my testing method was flawed. Some connections were getting through at one point, but the only logical explanation is that they were already established, which was resolved after I rebooted the machine. Thanks for the help, everybody.