CentOS View port occupancy and open port command details

Source: Internet
Author: User
CentOS View port occupancy commands, such as viewing 80 port occupancy Use the following command:
Lsof-i tcp:80
List all ports
Netstat-ntlp
1, open the Port method one:
/sbin/iptables-i input-p TCP--dport 80-j ACCEPT  Write modify


/etc/init.d/iptables  save modify


service Iptables Restart reboot  firewall, modify to take effect
Method Two:
Vi/etc/sysconfig/iptables  Open Configuration
File add the following statement:
<div class= "Codetitle" ><span><a style= "Cursor:pointer" Data= "25584" class= "copybut" id= "copybut25584" "Onclick=" docopy (' code25584 ') ><u> copy code </u></a></span> code as follows: </div><div class= "Codebody" id= "code25584" >-A input-p tcp-m State--state new-m TCP--dport 80-j  reboot firewall, modify complete
ACCEPT >
2, close the Port method one:
/sbin/iptables-i input-p TCP--dport 80-j DROP  Write modify
/etc/init.d/iptables  save modify

service Iptables re Start  reboot firewall, change takes effect
Method Two:
Vi/etc/sysconfig/iptables  Open Configuration
File add the following statement:
<div class= "Codetitle" ><span><a style= "Cursor:pointer" Data= "17298" class= "copybut" id= "copybut17298" "Onclick=" docopy (' code17298 ') ><u> copy code </u></a></span> code as follows: </div><div class= "Codebody" id= "code17298" >-a input-p tcp-m State--state new-m TCP--dport 80-j DROP  Restart Firewall, modified to complete
</div> ;

3. View 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.