View port usage and enable Port commands on Centos

Source: Internet
Author: User
Centos command to view port usage, for example, to view port 80 usage use the following command: lsof-itcp: 80 to list all port netstat-ntlp1, open port (take Port 80 as an example) Method 1: & Centos command to view port usage, for example, to view port 80 usage, use the following command: lsof-I tcp: 80 to list all ports netstat-ntlp 1. enable port (take Port 80 as an example) method 1:/sbin/iptables-I INPUT-p tcp -- dport 80-j ACCEPT write modification/etc/init. d/iptables save and modify service iptables restart to restart the firewall. Method 2: vi/etc/sysconfig/iptables open the configuration file and add the following statement: -a input-p tcp-m state -- state NEW-m tcp -- dport 80-j ACCEPT restart firewall. modification completed. 2. Method 1 is disabled: /sbin/iptables-I INPUT-p tcp -- dport 80-j DROP write modification/etc/init. d/iptables save and modify service iptables restart to restart the firewall. Method 2: vi/etc/sysconfig/iptables open the configuration file and add the following statement: -a input-p tcp-m state -- state NEW-m tcp -- dport 80-j DROP restart the firewall. the modification is complete. 3. check the port status/etc/init. d/iptables status
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.