我最近得到了运行CentOS 6.X的VPS,我安装了Gnome并configuration了VNC。 vncserver运行良好,但我无法连接到它。 我从外面检查了端口,发现端口5901已经closures。 我编辑了iptables并重新启动了iptables服务,但没有任何反应。 我甚至停止了iptables服务,但端口似乎closures。 这是怎么回事?
提前致谢。
[ 编辑 ]好的,说实话,我不知道如果vncserver是否正确运行。 它没有给出任何错误,但是在它的日志中有一些与gnome相关的错误。 但是这可能与港口被closures有什么关系?
[ 编辑 ]这是我尝试的2个vncconfiguration(xstartup):
#!/bin/sh # Uncomment the following two lines for normal desktop: # unset SESSION_MANAGER # exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & # xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & xterm -geometry 1024x768 -ls -name "$VNCDESKTOP Desktop" & twm & ~
和这个:
#!/bin/sh ( while true; do xterm; done ) & # Uncomment the following two lines for normal desktop: unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & # xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & xterm -geometry 1024x768 -ls -name "$VNCDESKTOP Desktop" & gnome-session & ~
首先validation你的vnc服务器是否正在运行:
ps -ef | grep -i vnc
那么确保它在听
netstat -nlptu
如果这不起作用,请查看日志中的错误,并尝试禁用selinue
setenforce 0
还张贴您的VNCconfiguration将有所帮助。
启动VNC服务器,然后尝试使用telneting:
telnet localhost [port number]
其中[端口号]是您configuration的任何端口。 如果服务器正在运行,您应该看到类似“RFB 003.003”的输出。 如果连接被拒绝,那么服务器可能没有运行。
[编辑]
我在@pboin上。 我认为你的iptables仍然阻塞。
编辑/ etc / sysconfig / iptables文件:
# vi /etc/sysconfig/iptables
加
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport [port number] -j ACCEPT
其中[端口号]是您正在使用的端口。 然后使用以下命令重启iptables
# service iptables restart
然后再次尝试远程连接。