Ip Tables Allow Http and Https

Ip Tables Allow Http and Https

I am setting up a basic Firewall rules for my Laptop but I cant seem to get HTTP and HTTPS, thus using of the Webbrowser to work.

My current rules are like this

# 1. Delete all existing rules
iptables -F

# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP


# 3. Allow outgoing SSH for Ethernet(enp12s0) and Wlan(wlp6s0)

iptables -A INPUT -i wlp6s0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -i enp12s0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT  -o wlp6s0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT  -o enp12s0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT

# 4. Allow HTTP and HTTPS

iptables -A OUTPUT -j ACCEPT -m state   --state NEW,ESTABLISHED,RELATED -o wlp6s0 -p tcp   -m multiport --dports 80,443
iptables -A OUTPUT -j ACCEPT -m state   --state NEW,ESTABLISHED,RELATED -o enp12s0 -p tcp   -m multiport --dports 80,443
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED -i wlp6s0 -p tcp -m multiport --sports 80,443
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED -i enp12s0 -p tcp -m multiport --sports 80,443

How can I allow the HTTP and HTTPS traffic so that I can use my browser again?

5

1 Answer

Through bodhi.zazen`s comment I found the solution.

Setting

iptables -A OUTPUT -m state --state NEW -p udp --dport 53 -j ACCEPT
iptables -A OUTPUT -m state --state NEW -p tcp --dport 53 -j ACCEPT

and allowing Input from a previous established connection with eiter

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

or

iptables -A INPUT -m state --state ESTABLISHED -p udp --sport 53 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED -p tcp --sport 53 -j ACCEPT

fixes the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.