Current location - Quotes Website - Collection of slogans - Excuse me, how does CentOS disable the 1-9999 port in the firewall except port 22, 80 and 443?
Excuse me, how does CentOS disable the 1-9999 port in the firewall except port 22, 80 and 443?
Configuring iptables under CentOS allows some ports to be peer-to-peer, while others are blocked.

Change as follows:

iptables? -F? /*? Clear all the rules? */

iptables? -A? Input? -p? tcp? -Port? 22? -j? Accept? /* Allow packets to enter from port 22 */

iptables? -A? Output? -p? tcp? Exercise? 22? -m? Status? -Country? Established? -j? Accept? /* Allow packets coming through port 22 to return */

iptables? -A? Input? -s? 127.0.0. 1? -Dee? 127.0.0. 1? -j? Accept? /* Allow this computer to access this computer */

iptables? -A? Output? -s? 127.0.0. 1? -Dee? 127.0.0. 1? -j? accept

iptables? -A? Input? -p? tcp? -s? 0/0? -Port? 80? -j? Accept? /* Allow all IP access to port 80 */

iptables? -A? Output? -p? tcp? Exercise? 80? -m? Status? -Country? Established? -j? accept

iptables? -P? Input? drip

iptables? -P? Forward? drip

iptables? -P? Output? drip

Iptables- save? & gt? /etc/sysconfig/iptables? /* Save the configuration */

iptables? -Me? /*? Show iptables list? */If you need to install software or download files on the server, you need to run it.

This allows the server to access the external network, but it needs to be denied access again after using the network.

If computers between clusters need to access each other, you can reject all the rules added before.