Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iptables drop not working

Status
Not open for further replies.
Jul 16, 2007
2
US
This IP tables command is still letting connections through other than myip:
iptables -I INPUT 1 -m state --state NEW -m tcp -p tcp -s myip/32 --dport 3306 -j ACCEPT
iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp --dport 3306 -j DROP

Why isnt that working?
 
Why are you specifying line numbers?

Try this instead

Code:
iptables -A INPUT -p tcp -s myip/32 --dport 3306 -j ACCEPT
iptables -A INPUT -p tcp -s 0.0.0.0/0 --dport 3306 -j DROP

It appends the rules in the chain sequentially. Matching may not be needed because you're specifying TCP packets destined for the MySQL port which applies to all packets regardless of state.

Have Fun!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top