Skip to content

Instantly share code, notes, and snippets.

@pioz
Created September 23, 2016 10:12
Show Gist options
  • Select an option

  • Save pioz/88943cd9917c46b91ad3f8a7ea345b30 to your computer and use it in GitHub Desktop.

Select an option

Save pioz/88943cd9917c46b91ad3f8a7ea345b30 to your computer and use it in GitHub Desktop.
Drop a range of ports except for localhost
iptables -A INPUT -p tcp --match multiport --dports 3000:6000 -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --match multiport --dports 3000:6000 -j DROP
# to remove this rules
iptables -D INPUT -p tcp --match multiport --dports 3000:6000 -s 127.0.0.1 -j ACCEPT
iptables -D INPUT -p tcp --match multiport --dports 3000:6000 -j DROP
# Use iptables-persist to make this rules persistant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment