我正在使用 Ubuntu 18.04 LTS。我执行了 apt get tigervnc-standalone-server 和 tigervnc-common。我正在使用运行相同设置的另一台主机的 xstartup。当我尝试使用 tigervnc 客户端连接到盒子时,我收到一条拒绝连接 61 消息。如果直接进入盒子并尝试 vncviewer 10.207.0.201:5901,我也会收到一条拒绝连接消息,但如果我执行 vncviewer 127.0.0.1:5901,我可以连接。以下是一些背景信息。
richmaes@portal01:~$ nmap localhost
Starting Nmap 7.60 ( https://nmap.org ) at 2019-02-07 17:33 PST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000040s latency).
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
139/tcp open netbios-ssn
445/tcp open microsoft-ds
631/tcp open ipp
5901/tcp open vnc-1
Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds
然后有趣的是(我的眼睛都快瞪出来了),因为如果我使用家庭地址,5901 就在那里,但如果我使用它的静态地址,5901 就不存在了。
richmaes@portal01:~$ nmap 10.207.0.102
Starting Nmap 7.60 ( https://nmap.org ) at 2019-02-07 17:42 PST
Nmap scan report for portal01 (10.207.0.102)
Host is up (0.000051s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
139/tcp open netbios-ssn
445/tcp open microsoft-ds
Nmap 完成:0.08 秒内扫描了 1 个 IP 地址(1 个主机启动)
并且我确认我确实知道我的本地IP是多少。
richmaes@portal01:~$ ifconfig -a
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.207.0.102 netmask 255.255.255.0 broadcast 10.207.0.255
inet6 fe80::56bf:64ff:fe63:43d0 prefixlen 64 scopeid 0x20<link>
ether 54:bf:64:63:43:d0 txqueuelen 1000 (Ethernet)
RX packets 4295 bytes 3015163 (3.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1526 bytes 150636 (150.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xef180000-ef1a0000
根据 nmap,vncserver 仅监听相对于主地址的端口 5901。我已检查 iptables 或 ufw 中没有规则。这里发生了什么?
richmaes@portal01:~$ sudo iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
防火墙
richmaes@portal01:~$ sudo ufw status verbose
Status: inactive
答案1
面团!
配置文件 /etc/vnc.conf 需要一个
$localhost =“否”;
答案2
也可以在命令行上设置:
vncserver ... -localhost no