I've currently got a Linux router running iptables-services. I've set up forwarding on the server and masquerade out as the public interface's IP on the outbound using the POSTROUTING chain.

I'm trying to simulate a disconnect for an application I'm working on - as if the client sending traffic to my UDP port has stopped doing so, or alternatively my traffic returning to them stops. To achieve this, I'd like to drop traffic on the router itself.

Addresses for talking sake are for my machine, for router local interface, router public is, and public peer address is

I would like to drop traffic being forwarded by the router (with NAT masquerading) from my local IP destined for the public peer. Say drop all outbound UDP traffic on port 1000 from Or alternatively, do the same, but catch it on the inbound - so trying to reach my PC at

I want to interrupt / override the process of UPnP by blocking any traffic from reaching the UDP listen port on my local machine through the router.

  • 1
    Without knowing what you have tried so far, does iptables -I FORWARD --protocol udp --dport 1000 -j REJECT work for you? – Thomas Mar 18 '18 at 17:29
  • I don't have a linux router set up to test this but I think you should be able to build what you want with man tc, man tc-flow and man netem. – flerb Mar 23 '18 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.