Open a port with centOS

Tuesday 17th April 2007 11:52 PM

TAGS: centOS, firewall, port
Had to setup a new development server the other day, and decided to go with the recently released centOS 5. I might write a more detailed review later on, but just a small tip at the moment! Just a small thing to note, I'm not running GUI, so this is all command line only.

I needed to open the mysql port (which is port 3306) to the outside network, it wasn't too clear how to do this, but after a bit of hunting around...

# nano /etc/sysconfig/iptables

Simply add (after all of the existing entries):

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

Lastly, restart iptables:

# /etc/init.d/iptables restart

Comments on this article:


#1 Dan says:

Tuesday 12th June 2007 07:58 AM

Cheers for the tip.. I am not a full time linux admin and so I forget how to do these things.

There is one trap for young players though; you must add this line BEFORE the last one which is a "reject all" entry as the rules are processed in order... someone closely matching my description spent a good 15 minutes figuring this out...


Add Comment:


Make a Comment

*Nb, all comments are moderated to prevent spam or inappropriate content.








netforge logo
netforge provides high quality and friendly website design services to business. We're Australian based and reliable... (find out more).