Skip to content

Instantly share code, notes, and snippets.

@dineshsprabu
Last active February 3, 2016 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dineshsprabu/83a366c4061ef969da95 to your computer and use it in GitHub Desktop.
Save dineshsprabu/83a366c4061ef969da95 to your computer and use it in GitHub Desktop.
IPTable Rule for Allowing SSH and Denying all other ports
/* iptable rule for droping connections through eth0 to all ports except 22(ssh) */
>> iptables -A INPUT -i eth0 -p tcp ! --dport 22 -j DROP
/* Check applied rule */
>> iptables -L
target prot opt source destination
DROP tcp -- anywhere anywhere tcp dpt:!ssh
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment