Score:0

wget stuck on the connecting to.. after few iptable rules

in flag

I'm using ipset module for iptables to allow only specific IPs in incoming traffic.

Here I have allowed only 2 Ips. Only these two IPs can connect to my server

However, if I do wget 142.250.195.46 it stuck on connecting to...

Here are the rules. I have allowed all outbound traffic.

iptables -I INPUT -i lo -j ACCEPT
iptables -I OUTPUT -o lo -j ACCEPT

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

iptables -A OUTPUT -p tcp --dport 443 -m state --state NEW -j ACCEPT
iptables -A OUTPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT

iptables -A INPUT -p tcp --dport 443 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT

iptables -A OUTPUT -p tcp -d 0/0 -m multiport --dport 25,80,443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -m multiport --sport 25,80,443 -m state --state ESTABLISHED -j ACCEPT

ipset create wl nethash

ipset add wl 142.250.195.46/32
ipset add wl 49.34.83.27/32

iptables -A INPUT -m set --match-set wl src -j ACCEPT

iptables -P OUTPUT ACCEPT
iptables -P INPUT DROP

Output of iptables -S

-P INPUT DROP
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -m state --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT
-A INPUT -p tcp -m multiport --sports 25,80,443 -m state --state ESTABLISHED -j ACCEPT
-A INPUT -m set --match-set wl src -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 443 -m state --state NEW -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT
-A OUTPUT -p tcp -m multiport --dports 25,80,443 -m state --state NEW,ESTABLISHED -j ACCEPT

I can't connect to any website using wget or curl

What could be the possible issue ?

us flag
Please add output of `iptables-save` to the question.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.