I. Open/Close firewall command under Linux
A: Permanent, no recovery after reboot
Open: Chkconfig iptables on
OFF: Chkconfig iptables off
B: Immediate effect, recovery after reboot
Open: Service iptables start
Close: Service iptables stop
When you open a firewall, you can use the following two methods for opening ports:
1: Using commands
1), you can see which ports are opened first NETSTAT-ANP
2), turn off the port number:
Iptables-a input-p TCP--drop port number-j drop
Iptables-a output-p TCP--dport port number-j DROP
3), start the slogan:
Iptables-a input-p TCP--dport port number-j ACCEPT
2: Modify the configuration file
Modify the/etc/sysconfig/iptables file to add the following:
-A input-p tcp-m state--state new-m TCP--dport 9040-j ACCEPT open 9040
-A input-p tcp-m state--state new-m TCP--dport 9041-j ACCEPT open 9041
You can save the configuration Iptables service save after a successful modification
Note: The Linux open port command for each open port requires a corresponding listener to
Two. CentOS Linux firewall configuration and shutdown
Execute the "Setup" command to start the text mode configuration Utility, select "Firewall Configuration" in "Select a tool", and then select the "Run Tool" button, the firewall configuration interface will appear, "Security level
"Set to" Disabled "and select" OK ".
or with a command:
#/sbin/iptables-i input-p tcp–dport 9040-j ACCEPT
#/sbin/iptables-i input-p tcp–dport 9041-j ACCEPT
#/etc/rc.d/init.d/iptables Save
When you restart your computer, the firewall defaults to 9040 and 9041 ports
This article is from the "Tianjin Emirates" blog, please be sure to keep this source http://284397316.blog.51cto.com/10456921/1675905
Linux Firewalls and open ports