在windows机器使用vncviewer进行测试连接虚拟机,在vncviewer连接种输入ip:5922,发现连不上去,netstat 查看没有ESTABLISHED的连接建立:
[root@localhost gao]# netstat -natp | grep qemu
tcp 0 0 0.0.0.0:5922 0.0.0.0:* LISTEN 6850/qemu-system-x8
tcp6 0 0 :::5922 :::* LISTEN 6850/qemu-system-x8
整理下需要3个步骤:
1、确保IP、ROUTE配置正确,能ping通vnc server所在的服务器;
2、临时关闭防火墙:
[root@localhost ~]# iptables -L -v //查看iptables 策略
[root@localhost ~]# iptables -F //删除iptables 策略
3、临时关闭selinux:
[root@localhost ~]# getenforce //查看selinux状态
[root@localhost ~]# setenforce 0 //关闭selinux
执行上面的操作基本就可以远程连接了,如下:
[root@localhost ~]# netstat -natp | grep qemu
tcp 0 0 0.0.0.0:5911 0.0.0.0:* LISTEN 7504/qemu-system-x8
tcp 0 0 192.169.1.197:5911 192.169.0.24:60683 ESTABLISHED 7504/qemu-system-x8
tcp6 0 0 :::5911 :::* LISTEN 7504/qemu-system-x8
附:vnc server的安装
[root@localhost ~]# yum search vnc
[root@localhost ~]# yum -y install tigervnc-server
[root@localhost ~]# yum install vnc-server vnc*
[root@localhost ~]# service vncserver restart