我在我的Ubuntu 10.04服务器上安装了ufw。 运行在该服务器上的唯一东西就是ElasticSearch和Redis。 Redis使用端口6379.我只希望两个不同的IP能够在该端口上访问本机的IP地址。 我运行了以下命令:
sudo ufw allow from xx.xx.xx.x1 to any port 6379 sudo ufw allow from xx.xx.xx.x2 to any port 6379 sudo ufw status To Action From -- ------ ---- 22 ALLOW Anywhere 6379 ALLOW xx.xx.xx.x1 6379 ALLOW xx.xx.xx.x2 80 ALLOW Anywhere 8080 ALLOW Anywhere 8080/tcp ALLOW Anywhere
对我来说,这两个IP似乎应该能够访问该服务器上的IP地址。 但他们无法build立联系。 我还需要打开其他的端口才能发生这种情况吗?
我想到了。 删除跟随规则修复它,使只有那些IP能够连接。
ufw delete allow 8080 8080 ALLOW Anywhere