When Linux opens the firewall, you will find that it is no problem to log on to port 23 from the local computer, but if you log on to the Linux system from another PC, you will notice that the error is prompted:
Unable to open connection to host on port 23: Connection Failed
Because the Linux firewall by default is 23 port, if Allow remote login, you can turn off the firewall, you can open the firewall open 23 ports, specific as follows:
Immediate effect, reboot disabled
Open: Service iptables start
OFF: Service iptables stop
Effective after reboot
Open: Chkconfig iptables on
Close: Chkconfig iptables off
When the firewall is turned on, make the following settings to open the relevant port
Modify the/etc/sysconfig/iptables file and add the following:
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 23-j ACCEPT
View Firewall iptables-l
------------------
NETSTAT-NUPL (Port of UDP type)
NETSTAT-NTPL (Port of TCP type)
You can use the lsof command to see if an end port is open. The view port can be used in this way, and I'll take port 80 as an example:
Lsof-i:80
If there is a display indicating that it has been opened, if there is no indication that the description is not open.
Reprint Address: http://hi.baidu.com/wlbing0625/item/fc3f8ec6b1f38dc2984aa096
how to turn on/off a specified port method through the Linux system iptables firewall
Typically, Iptables is already included in the Linux distribution.
Run Iptables--version to see if the system is installed Iptables
Start iptables
Service Iptables Start
Iptables--list//* view iptables rule set *//
Here's what iptables looks like when you don't have a plan defined:
Chain INPUT (Policy ACCEPT)
Target Prot opt source destination
Chain FORWARD (Policy ACCEPT)
Target Prot opt source destination
Chain OUTPUT (Policy ACCEPT)
Target Prot opt source destination
How to toggle the specified port on/off
For example:
Open Port 81:
Iptables-i input-i eth0-p TCP--dport 81-j ACCEPT
Iptables-i output-o eth0-p TCP--sport 81-j ACCEPT
Close Port 81:
Iptables-i input-i eth0-p TCP--dport 81-j DROP
Iptables-i output-o eth0-p TCP--sport 81-j DROP
and then save
/etc/rc.d/init.d/iptables Save
You can use the lsof command to see if an end port is open. View ports can be used in this way.
I'll take 81 ports for example:
lsof-i:81
If there are indications that the instructions have been opened. If there is no indication that there is no open reprint address: http://www.itokit.com/2012/0317/73346.html