Answer the question
In order to leave comments, you need to log in
How to properly open port for IP in iptables?
For the second day I have been racking my brains and hated iptables.
I open the port for IP and close it for everyone else.
-A INPUT -s 123.124.125.126/32 -p tcp -m tcp --dport 32808 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 32808 -j REJECT --reject-with icmp-port-unreachable
~# telnet 223.224.225.226 32808
Trying 223.224.225.226...
telnet: Unable to connect to remote host: Connection refused
-A INPUT -s 123.124.125.126/32 -p tcp -m tcp --dport 32808 -j ACCEPT
Answer the question
In order to leave comments, you need to log in
iptables -A INPUT -s 123.124.125.126/32 -m state --state NEW tcp --dport 32808 -j ACCEPT
iptables -A INPUT -m state --state NEW tcp --dport 32808 -j DROP
this is for one port 32808 and must go in order
if there are more rules, then first allowing, then blocking
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question