I am new to iptables and I need to block all HTTP/HTTPS traffic except to a certain IP (I am using below the IP of example.com)

iptables -A INPUT -p tcp -s –-dport 443 -j ACCEPTiptables -A OUTPUT -p tcp -d –-sport 443 -j ACCEPTiptables -A INPUT -p tcp -s -–dport 80 -j ACCEPTiptables -A OUTPUT -p tcp -d -–sport 80 -j ACCEPT

For the DNS resolution I also have:

iptables -A INPUT -p udp -s –-dport 53 -j ACCEPT

2020欧洲杯手机版注册However, every time I set the default policies to DROP, I cannot access the IP despite my own rules. I have tried using -m state --state NEW,ESTABLISHED but with no luck. What am I missing here?

New contributor
Yann Gagne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.Check out our Code of Conduct.
  • 1
    Please note that Stack Overflow is for programming questions and not general computing issues. Question may be appropriate for or but do check their help before posting. – kaylum 2 days ago

Browse other questions tagged or ask your own question.