DWQA QuestionsCategory: ServerHow can iptables only allow local access to the specified port and not allow external access.
cevin asked 1 month ago
# Generated by iptables-save v1.4.8 on Sat Jun 15 23:23:13 2013
:INPUT ACCEPT [35:6316]
:OUTPUT ACCEPT [17:1648]
-A INPUT -p tcp -m tcp --dport 30009 -j REJECT      
-A INPUT -s -p tcp -m tcp --dport 30009 -j ACCEPT
# Completed on Sat Jun 15 23:23:13 2013

That doesn’t seem to work.
On the server

telnet 30009
telnet: Unable to connect to remote host: Connection refused
1 Answers
Best Answer
Evian answered 1 month ago

Two lines in turn
Iptables executes when it encounters a match, so reject is lost first, and the later rules don’t work.