KVM或Xen遇到Unable to retrieve http images/install.img

用virt-install安装kvm或xen,如果是用URL安装,会遇到这个问题:

Unable to retrieve http://192.168.22.242/images/install.img

或者 Unable to retrieve http://mirrors.sohu.com/centos/6.5/os/x86_64/images/install.img 

解决方法

1,首先启动httpd服务,打开iptables的80端口,保证页面能访问

2,检查ip转发是否开启

1 2 3 4 5 6 7 cat  /etc/sysctl .conf | grep  ip_forward net.ipv4.ip_forward = 1 如果没有开启,则 vim  /etc/sysctl .conf net.ipv4.ip_forward = 1     /sbin/sysctl  -p

3,查看网络 

是否没有配置br0,只是yum安装的

1 2 3 # brctl show bridge namebridge idSTP enabledinterfaces virbr08000.feffffffffffyesvif4.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 cp  /etc/sysconfig/network-scripts/ifcfg-eth0  /etc/sysconfig/network-scripts/ifcfg-br0     cat  /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 TYPE=Ethernet UUID=**** ONBOOT= yes NM_CONTROLLED=no BOOTPROTO=static BRIDGE=br0 DEFROUTE= yes IPV4_FAILURE_FATAL= yes IPV6INIT=no NAME= "System eth0" HWADDR=****    cat  /etc/sysconfig/network-scripts/ifcfg-br0  DEVICE=br0 TYPE=Bridge ONBOOT= yes NM_CONTROLLED=no BOOTPROTO=none IPADDR=**** PREFIX=** GATEWAY=**** DNS1=114.114.114.114 DOMAIN=114.114.114.114 DEFROUTE= yes NAME= "System br0"    service network restart

1 2 3 4 # brctl show bridge name    bridge  id            STP enabled    interfaces br             08000.0800278072e5  no             eth0 virbr          08000.feffffffffff   yes             vif4.0

4,virt-install 后面接虚拟网卡的参数 -w bridge:br0


5,检查http挂载的iso目录.treeinfo

[images-x86_64]

initrd = images/pxeboot/initrd.img

kernel = isolinux/vmlinuz

[images-xen]

kernel = isolinux/vmlinuz

initrd = isolinux/initrd.img


这样一通搞下来,应该没问题的,欢迎拍砖

本文转自 bbotte 51CTO博客,原文链接:http://blog.51cto.com/bbotte/1539597,如需转载请自行联系原作者

点赞