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