Edit/etc/sysconfig/iptables, add
- s 127.0.0.1 --dport 6379-J Accept-s 126.212.173.185 --dport 6379-j ACCEPT
The above add red place is only to the local and 126.212.173.185 open 6379 port, other IP with Telnet is not connected,
If there is no limit to access IP, you do not need to add the- s IP address , for example
-A input-m state--state new-m tcp-p TCP--dport 6379-j ACCEPT
Yes, be sure to add it at the end
-A input-j REJECT--reject-with icmp-host-prohibited-A forward-j REJECT --reject-with icmp-host- Prohibitedcommit
Otherwise, the firewall will not work.
Restarting the firewall
Service Iptables Start
The new firewall rules are well-equipped.
Attached: Full firewall configuration
# Firewall configuration written by system-config-firewall# Manual Customization of Thisfile 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 21-J ACCEPT-A input-m state--state new-m tcp-p TCP--dport 20-J Accept#mysql-A input-m state--state new-m tcp-p TCP--dport 3306-J Accept#web Server-A input-m state--state new-m tcp-p TCP--dport 80-J ACCEPT#redis-A input-m state--state new-m tcp-p tcp-s 127.0.0.1--dport 6379-J ACCEPT-A input-j REJECT--reject-with icmp-host-prohibited-A forward-j REJECT--reject-with icmp-host-Prohibitedcommit
Linux firewall open ports for fixed IP open ports