First, I'd like to recommend a blog post here.
http://blog.csdn.net/zht666/article/details/17505789
This article is written in very detailed, contains the operation of the port some commands, we operate the port is actually operation iptables this file.
1. View Port
Iptables-l-N
2. Add Port
Iptables-a input-p TCP--dport 22-j ACCEPT
Note: INPUT is a group of its own, according to the actual system configuration to fill in.
Here we recommend an article:
Http://www.zybang.com/question/b0b8264a278253054b96aa87426dba1b.html
The same Add statement I choose the following sentence:
Iptables-a input-p tcp-m State--state new-m TCP--dport 22-j ACCEPT
In my actual system I changed to this:
Iptables-a in_public_allow-p tcp-m State--state new-m TCP--dport 22-j ACCEPT
3. Delete Port
To delete a port first check the NUM number by using the following statement:
Iptables-l-N--line-number
Num Target prot opt source destination
1 DROP TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:3306
2 DROP TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:21
3 DROP TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:80
See the first column of NUM, use this number to delete;
iptables-d INPUT 1
Executing the above statement removes the NUM number 3306 port number.
Linux down to open port