I want to allow only internet access (it is useful for update) and ssh on my server. I found this set of rules:
sudo iptables -P INPUT DROP
sudo iptables -P OUTPUT DROP
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport [port number] -j ACCEPT
sudo iptables -A OUTPUT -o lo -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport [port number] -m state --state ESTABLISHED -j ACCEPT
sudo service iptables save
sudo netfilter-persistent reload
This is working well but I can't update my system or access internet. Which rules should I add to allow outgoing internet connection?
Let's start
Delete current rules and chains:
Allow loopback:
Drop
ICMP
:Allow established connections:
Allow
SSH
:Default policies:
Save:
This is it. I think :)