Iptables – How to block all traffic to all ports except 80/443 in OpenWRT

firewalliptablesopenwrt

I'm trying to do some testing and would like to setup my network to only allow traffic on 80/443, expect for specific IP addresses where I will specify a TCP port and UDP port.

Once completed, I want to test a website that has standard HTTP 80/443 traffic but am doing specific WebRTC testing via a proxy on those ports at a specified IP address (later to be a set of addresses).

Options I have are to use my OpenWRT luci based router (https://github.com/openwrt/luci), Windows firewall or Mac. I'm not sure where to start or how to proceed so any help would be greatly appreciated!

Best Answer

Did you try any of this?

https://openwrt.org/docs/guide-user/firewall/firewall_configuration

Depends on your setup, you could set the firewall on the network-level, if you are blocking traffic from outside your network, or at the machine-level, if you are blocking traffic from inside you LAN. My personal preference is a combination of both.

I hope this help