Skip to content

Instantly share code, notes, and snippets.

@Martin91
Created July 22, 2018 07:46
Show Gist options
  • Save Martin91/c59ce0019703f9f076cfd70185f63ac5 to your computer and use it in GitHub Desktop.
Save Martin91/c59ce0019703f9f076cfd70185f63ac5 to your computer and use it in GitHub Desktop.
iptables to allow only localhost to access specified port
# Allow access only localhost by port 1991
sudo iptables -A INPUT -i lo -p tcp --dport 1991 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 1991 -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment