//只允许127.0.0.1访问6379
iptables -A INPUT -s 127.0.0.1 -p tcp --dport 6379 -j ACCEPT
//其他ip访问全部拒绝
iptables -A INPUT -p TCP --dport 6379 -j REJECT

远程测试下

没拒绝前

iptables禁止外网访问redis server服务默认端口6379的命令

拒绝后

iptables禁止外网访问redis server服务默认端口6379的命令

相关文章: