首页 未分类 正文内容

linux vnc viewer登陆时报错10060

admin 未分类 2019-10-15 14:57:10 96

用VNC Viewer连接远程centos系统提示报错"connect:Connection timed out(10060)"


经过查询是centos系统防火墙拦截请求造成的问题的;


有两种方法解决


一种是简单粗暴,但是不安全的办法,就是直接把防火墙关闭掉

service iptables stop


另一种是设置防火墙端口让vnc访问请求通过

service iptables restart

iptables -I INPUT -p tcp --dport 5901 -j ACCEPT

iptables -I INPUT -p tcp --dport 5902 -j ACCEPT

service iptables status

输出结果:


service iptables restart

iptables:将链设置为政策 ACCEPT:filter [确定]

iptables:清除防火墙规则: [确定]

iptables:正在卸载模块: [确定]

iptables:应用防火墙规则: [确定]

[root@vultr ~]# iptables -I INPUT -p tcp --dport 5901 -j ACCEPT

[root@vultr ~]# iptables -I INPUT -p tcp --dport 5902 -j ACCEPT

[root@vultr ~]# service iptables status

表格:filter

Chain INPUT (policy ACCEPT)

num target prot opt source destination

1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5902

2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5901

3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED

4 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0

5 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22

7 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited


Chain FORWARD (policy ACCEPT)

num target prot opt source destination

1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited


Chain OUTPUT (policy ACCEPT)

num target prot opt source destination


service iptables save

//将规则保存在/etc/sysconfig/iptables文件里

service iptables restart

//重启Iptables服务


关于VNC服务使用的端口号与桌面号相关,VNC使用TCP端口从5900开始,对应关系如下

桌面号为“1” ---- 端口号为5901

桌面号为“2” ---- 端口号为5902

桌面号为“3” ---- 端口号为5903


文章目录
    搜索