Command code?
【root@localhost? ~]#? vi? /etc/sysconfig/iptables
Correct configuration file?
Configuration code?
#? Firewall? Configuration? Written? By who? System-Configuration-Firewall
#? Manual? Customization? Yes? This? Documents? Is it? Isn't it? Recommended.
* Filter
: input? Accept? [0:0]
: Forward? Accept? [0:0]
: output? Accept? [0:0]
-A? Input? -m? Status? -Status? Established, related? -j? accept
-A? Input? -p? icmp? -j? accept
-A? Input? -Me? lo? -j? accept
-A? Input? -m? Status? -Status? New? -m? tcp? -p? tcp? -Port? 22? -j? accept
-A? Input? -m? Status? -Status? New? -m? tcp? -p? tcp? -Port? 80? -j? Accept?
-A? Input? -j? Refuse? -Refuse? Icmp- Host-Forbidden
-A? Forward? -j? Refuse? -Refuse? Icmp- Host-Forbidden
commit a crime
Configure [*] wildcard code?
-A? Input? -m? Status? -Status? New? -m? tcp? -p? tcp? -Port? *? -j? Accept?
Note: the newly opened port must be after port 22?
Restart the firewall for the configuration to take effect?
Command code?
【root@localhost? ~]#? /etc/init.d/iptables? Restart?
Other?
View open ports?
Command code?
【root@localhost? ~]#? /etc/init.d/iptables? Status?
Turn off the firewall
Command code?
【root@localhost? ~]#? /etc/init.d/iptables? Stop?