centos中安装rabbitmq干服务端,在宿主机客户端程序无法访问,显示连接超时

centos中安装rabbitmq作服务端,在宿主机客户端程序无法访问,显示连接超时
我在windows系统中用vmware虚拟机另装了个centos 7.0 系统。

做操作如下:

1. 我在虚拟机上部署了RabbitMQ 服务端,开放默认端口5672,已安装网页管理插件, 在虚拟机内置浏览器能够正常访问网页管理;
2. 我在主机上,用JAVA程序作为客户端,通过设置setHost(ip地址), setPort(端口号) 尝试推送消息到RabbitMQ, 一直碰到上述问题。

虚拟机中已做设置如下:
1. 关闭防火墙,关闭selinux
2. 网络连接方式已尝试过bridged、NAT、host-only

在主机上做过如下操作:
1. 终端ping过虚拟机上三种方式下的ip地址,均可以ping通
2. 在浏览器端使用ip:port的方式尝试访问虚拟机,显示连接超时
3. 在Java程序中,尝试连接虚拟机中的程序服务端,显示连接超时报错如下:

   Exception in thread "main" java.net.ConnectException: Connection timed out: connect

请问,有什么设置我是没注意到的吗?
------解决思路----------------------
引用:
it works after running the arguments iptables -F and iptables -X in the vm terminal, but i am still confused about what i did wrong all these days. About the two arguments, i will figure it out why they could make such big difference to my work.

And what dose the message i posted in the last comment mean?  where did i neglect? Thank you!


well, iptables was never in my consideration since you said up front that iptables on VM has been turned off.

let me summarize "what you did wrong":

1. rabbitmq was not configured right so it only listened on the localhost;
2. iptables was not configured right so it blocked the connection from host;

removing the entire chain from iptables is not recommended. You should add this exception to the iptables instead.