是防火墙的问题,我们不能关闭或清空防火墙,通过添加规则即可
安装memcached后执行 iptables -A INPUT-m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT,按道理应该就可以了,但客户端连接时仍然提示no route to host,查看iptables -L 时,发现11211的规则在这条规则
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited的下面,原因就在这,需要手动修改/etc/iptables.up.rules
需要执行iptables-save > /etc/iptables.up.rules
后重启机器就没有问题了
安装memcached后执行 iptables -A INPUT-m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT,按道理应该就可以了,但客户端连接时仍然提示no route to host,查看iptables -L 时,发现11211的规则在这条规则
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited的下面,原因就在这,需要手动修改/etc/iptables.up.rules
把 iptables -A INPUT-m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT放在REJECT all -- anywhere anywhere reject-with icmp-host-prohibited的前面,
保存本文件,然后加载规则,使之生效,只需要加载一次即可。
iptables-restore < /etc/iptables.up.rules
然后再查看最新的配置,应该所有的设置都生效了.
iptables -L
需要执行iptables-save > /etc/iptables.up.rules
后重启机器就没有问题了