分类: 虚拟化
2014-03-24 15:24:33
使用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
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
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