How to open Ports in CentOS

CentOS is the most preferred alternative OS for RHEL. Those who cannot afford to purchase the support license of RHEL, they can use CentOS that comes with almost similar to RHEL.

This post tells you about the usage of CentOS when web servers are installed and accessed from remote machines.

CentOS is a Server based OS and most of the ports are closed by default and you need to open it for access from outside (remote).
For ex. if wordpress is installed in CentOS with a hostname http://127.0.0.1/wordpress  which is very well accessed within the server. When the same is tried from outside like (http://192.168.54.3/wordpress), then it will not get accessed.
The problem is the closure of ports in CentOS. So you need to open it and save it to iptables, here are the commands that will help you to do that.

CentOS
CentOS

Port number : 80 is used here

$prompt] ifconfig (find out which interface uses the assigned ip, eth1, eth0, etc)
$prompt] iptables --line -vnL
(See which line the input has to be accepted and in my case it is 6) and give the following command
$prompt] iptables -I INPUT 6 -i eth1 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
$prompt] service iptables save (Save and restart the IP Tables)
$prompt] service iptables restart

Thats all!!!! I solved this problem, when I installed MOODLE in my Blade server with Cent OS installed.

Pradeep Kumar TS

Comments

Popular Posts