共计 844 个字符,预计需要花费 3 分钟才能阅读完成。
使用 virsh 连接到别的服务器时,使用的是 tcp 连接
virsh -c qemu+tcp://host/system
如果目标服务器没有开启 libvirtd 的 tcp 端口监听时,会出现
error: unable to connect to server at ‘host:16509’: Connection refused
error: failed to connect to the hypervisor
Ubuntu 下解决方法
sed -i ‘s/#listen_tls = 0/listen_tls = 0/g’ /etc/libvirt/libvirtd.conf
sed -i ‘s/#listen_tcp = 1/listen_tcp = 1/g’ /etc/libvirt/libvirtd.conf
sed -i ‘s/#auth_tcp = “sasl”/auth_tcp = “none”/g’ /etc/libvirt/libvirtd.conf
vi /etc/default/libvirt-bin
修改为 libvirt_opts = “-d -l”
增加 - l 监听 tcp
service libvirt-bin restart
CentOS 下解决方法
sed -i ‘s/#listen_tls = 0/listen_tls = 0/g’ /etc/libvirt/libvirtd.conf
sed -i ‘s/#listen_tcp = 1/listen_tcp = 1/g’ /etc/libvirt/libvirtd.conf
sed -i ‘s/#auth_tcp = “sasl”/auth_tcp = “none”/g’ /etc/libvirt/libvirtd.conf
sed -i ‘s/#LIBVIRTD_ARGS=”–listen”/LIBVIRTD_ARGS=”–listen”/g’ /etc/sysconfig/libvirtd
service libvirtd restart
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2015-08/121572.htm