当我尝试vnc到使用virt-install创建的新VM时,我遇到了一个问题。使用以下命令使用virt-install指定vnc时:
--vnc \
--vncport=5905 \
--noautoconsole
VM已创建,5905正在侦听,但仅在ipv4上进行侦听,如下所示:
# netstat -l | grep 5905
tcp 0 0 localhost:5905 0.0.0.0:* LISTEN
问题是,当我尝试使用"ssh -v -L 5905:localhost:5905 myhost“建立SSH隧道时,我得到了一个连接被拒绝的错误,因为vnc端口正在尝试从主机vnc本地环回接口转发,而vnc端口没有在侦听它:
debug1: Connection to port 5905 forwarding to localhost port 5905 requested.
debug1: channel 3: new [direct-tcpip]
channel 3: open failed: connect failed: Connection refused
debug1: channel 3: free: direct-tcpip: listening port 5905 for localhost port 5905, connect from ::1 port 57890 to ::1 port 5905, nchannels 4
我也可以通过将vnc连接到主机ipv4本地环回来解决这个问题,但我不确定如何做到这一点。理想情况下,我希望vnc同时监听ipv4和ipv6。
发布于 2020-04-28 23:27:47
通过编辑图形参数中的xml,我能够让VM监听ipv6:
<graphics type='vnc' port='5905' autoport='no' listen='localhost'>
<listen type='address' address='localhost'/>
</graphics>
您可以使用以下命令在virt-install命令中指定:
--graphics vnc,listen=localhost,port=5905 \
如果您问我,virt-install应该缺省为本地主机,而不是它的ipv4本地环回:/
https://stackoverflow.com/questions/61483625
复制相似问题