Thứ Bảy, 4 tháng 7, 2015

Check and open port on CentOS VPS

In this article, I will show you how to check and open the port on the server CentOS.


If you want to open or close ports VPS must modify the iptables configuration file. By default, this file path is / etc / sysconfig / iptables

1. Open port VPS

For example, to open port xxx, you execute the following command:

iptables -A INPUT -m state -p tcp -m tcp --ctstate NEW -j ACCEPT --dport xxx

Then save the configuration and restart iptables

service iptables save
service iptables restart

2. Close port VPS

To close any port, you directly edit the file / etc / sysconfig / iptables, comment the line port should play.

Then save the configuration and restart iptables

service iptables save
service iptables restart

3. Check the port is open

iptables -L -n

Không có nhận xét nào:

Đăng nhận xét