Run the following commands in turn: /sbin/iptables -I input -p tcp-dport 80 -j accept # open port 80 /sbin/iptables -I input -p tcp-dport 22 -j accept # open port 22 /etc/rc.d/init.d/iptables save # save the configuration/etc/rc.
Check the status of the opened ports /etc/init.d/iptables. The results are as follows: Number of filter chain inputs (policy acceptance) Target protection options Source Target 2 accepts TCP-0.0.0.0/0 TCP DPT: 22 3 accepts TCP-0.0.0/0.0.0/0 TCP DPT: 80.