June 12, 2015

Kiểm tra và mở port VPS trên CentOS

Nếu bạn muốn mở hoặc đóng port cho VPS thì phải chỉnh sửa file cấu hình của iptables. Mặc định thì file này có đường dẫn là /etc/sysconfig/iptables

Mở port VPS

Ví dụ để mở port xxx, bạn hãy thực hiện lệnh sau:
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport xxx -j ACCEPT
Sau đó lưu lại cấu hình và khởi động lại iptables
service iptables save
service iptables restart

Đóng port VPS

Để đóng port bất kỳ, bạn chỉnh sửa trực tiếp file /etc/sysconfig/iptables, comment những dòng có port cần đóng.
Sau đó lưu lại cấu hình và khởi động lại iptables
service iptables save
service iptables restart

Kiểm tra lại port đang mở

iptables -L -n

Related Posts:

  • How to backup a full Centos Server? Method 1: The best tool to use for this is probably dump, which is a standard linux tool and will give you the whole filesystem. I would do something like this: /sbin/dump -0uan -f - / | gzip -2 | ssh -c blowfish user@back… Read More
  • Hướng dẫn cài đặt LAMP V2 trên Centos 6 LAMP V2 là gì ? Trước tiên để biết LAMP là gì các bạn có thể xem tut cài LAMP của mình tại đây:  Cài đặt LAMP trên VPS Centos Vậy LAMP V2 là gì ? Nó có gì khác so với LAMP ở tut trước ?  LAMP V2 thực tế vẫn là L… Read More
  • Cannot retrieve metalink for repository: epel on centos 6 I've got a VM running CentOS 6 (64bit) and I'm attempting to add the EPEL repo like usual to install various packages as I do quite regularly. Today, I'm experiencing some strange errors yet I'm doing absolutely nothing dif… Read More
  • HOW TO UPGRADE PHP 5.3.X TO 5.4.X OR 5.5.X ON CENTOS This tutorial was performed on CentOS 6.5 x86 (32-bit) vps. Step 1 – Login to your server via Command Line (Putty or Terminal) Step 2 – Add EPEL and Remi repositories onto your system: On CentOS 6.x 32-bit wget … Read More
  • Cài đặt và cấu hình syslog-ng trên CentOS 6Khái niệm facility level và secrity level:Facility level: đại diện cho đối tượng tạo ra thông báo (kernel, process). acility NumberKeywordFacility Description 0kemkernel messages 1useruser-level messages 2mailmail system 3d… Read More

0 comments:

Post a Comment