6

I'm getting swamped with outbound udp requests and it's blocking my internet connection. While I figure out what's going on I'd like to block all outbound and inbound udp. I'm connecting via pppoe dial up but want to block on all ports and all connections. Is there a way to do this that won't interrupt my pppoe connection? I've tried updating iptables but this seems to only block one port at a time if I understand correctly. Though I have rules in my firewall to block the ports it seems to be too late.

For newbies like me it is difficult to get the pieces together and I couldn't find the answer on searching because didn't know to search for iptables and that doesn't cover the udp component. I have my question answered by think this should remain open for others as I believe it might be helpful.

1 Answers1

5

To just block outgoing UDP connections irrespective of port, don't specify a port. Just specify the protocol:

iptables -A OUTPUT -p udp -j DROP

The same applies for TCP (-p tcp).

muru
  • 197,895
  • 55
  • 485
  • 740
  • Thanks @muru you saved me a lot of time trying to find various tips! – user637251 Jan 06 '17 at 15:09
  • Be aware that from that particular machine you are going to experience problems when downloading/streaming larger files (e.g. docker pull, apt install, etc.). Udp is basically bi-directional, sending and receiving. – Cloudkollektiv Jan 14 '23 at 10:11