Enable and disable the iptables firewall and open specified ports in CentOS
Source: Internet
Author: User
# View the firewall information. run the/etc/init. d/iptablesstatus command to view the opened port. If the port to be opened is not in the open list, open the port to be used. the command is as follows: # open port 8888/sbin/iptables-IINPUT-ptcp -- dport8888-jACCEPT # save the changes/etc/ # View firewall information
Use/etc/init. d/ IptablesStatus command, you can see the opened port.
If the port to be opened is not in the open list, open the port to be used. the command is as follows:
# Open port 8888
/Sbin/iptables-I INPUT-p tcp -- dport 8888-jACCEPT
# Save the changes
/Etc/rc. d/init. d/iptables save
# Restart the firewall to make changes take effect
/Etc/init. d/iptables restart
Of course, another line is added directly to/etc/sysconfig/iptables:
-A RH-Firewall-1-INPUT-m state? State NEW-mtcp-p tcp? Dport 8888-j ACCEPT
Disable the firewall service:
#/Etc/init. d/iptables stop
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