两台机器间libevent通信:No route to host问题

最近学习libevent库,遂在两台虚拟机间模拟通信,程序没逻辑错误,但客户端总是提示No route to host问题,想到可能是linux的防火墙问题导致的,于是关掉防火墙:

Ubuntu系统防火墙关起命令:

关闭:sudo uwf disable
开启:sudo uwf enable

CentOS系统关起命令:

1)  彻底关闭,重启后不会复原
开启: chkconfig iptables on
关闭: chkconfig iptables off

2) 即时关闭,重启后复原
开启: service iptables start
关闭: service iptables stop

防火墙文件的位置:/etc/sysconfig/iptables 文件,后续对于防火墙的配置修改可以在上述路劲进行改动。

关掉防火墙之后,两台虚拟机器间可以进行正常通信了,通信逻辑代码在后续会贴出~~

原文地址:https://www.cnblogs.com/foundwant/p/4913870.html