CentOS enable and disable the firewall port in centOS firewall 1. enable the port (take Port 80 as an example) Java code Method 1: /sbin/iptables-IINPUT-ptcp -- dport80-jACCEPT write modify/etc/ini... centOS enable and disable the firewall port in centOS firewall 1. enable the port (take Port 80 as an example) Java code 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 the firewall. modification is complete. 2. disable Port Java code Method 1: /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. Java code/etc/init. d/iptables status
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