`

linux 防火墙设置

阅读更多

防火墙设置

[root@eegooserver3 mysql]# vi /etc/sysconfig/iptables

# FIRewall configuration written by system-config-firewall

# Manual customization of this file is not recommended.

*filter

:INPUT ACCEPT [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

-A INPUT -p icmp -j ACCEPT

-A INPUT -i lo -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 88 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 6310 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 9810 -j ACCEPT

-A INPUT -j REJECT --reject-with icmp-host-prohibited

-A FORWARD -j REJECT --reject-with icmp-host-prohibited

COMMIT

~

~

~

~

[root@eegooserver3 mysql]# service iptables reload

[root@eegooserver3 mysql]# service iptables restart

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Unloading modules:                               [  OK  ]

iptables: Applying firewall rules:                         [  OK  ]

[root@eegooserver3 mysql]# netstat -atln

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address               Foreign Address             State     

tcp        0      0 0.0.0.0:6310                0.0.0.0:*                   LISTEN     

tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN     

tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN     

tcp        0     48 172.16.19.9:22              172.16.19.51:63551          ESTABLISHED

tcp        0      0 :::22                       :::*                        LISTEN     

tcp        0      0 ::1:25                      :::*                        LISTEN     

[root@eegooserver3 mysql]#

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics