本机状态是物理机上的vmware里装有ubuntu16.04, ubuntu16.0中安装了KVM ubuntu123
ubuntu16.04使用的是NAT模式,自己配置了静态ip,能连外网
后面安装KVM时,指定KVM与ubuntu16.04之间的连接为桥接模式,网卡为br0,将ens33网卡原本的ip绑定到了br0网桥上。
这是安装好KVM后ubuntu16.04 的网卡情况
现在的情况是无法连接外网 只能ping 通KVM的地址
而KVM 能连外网
由于网上说NetworkManager 不支持网桥,所以我之前有使用systemctl disable NetworkManager 永久关闭了网桥
network-manager与interfaces的关系:
首先,当系统内没有第三方网络管理工具(比如nm)时,系统默认使用interfaces文件内的参数进行网络配置。
接着,当系统内安装了 nm之后,nm默认接管了系统的网络配置,使用nm 自己的网络配置参数来进行配置。
但是,如果用户在安装nm之后(Desktop版本默认安装了nm),自己手动修改了interfaces 文件,那nm 就自动停止对系统网络的管理,系统改使用interfaces 文件内的参数进行网络配置。
此时,再去修改nm 内的参数,不影响系统实际的网络配置。若要让nm 内的配置生效,必须重新启用nm 接管系统的网络配置。
1,要看nm是否接管,如果没有接管,系统实际的IP设置以interfaces 中的为准。反之,以nm 中的为准。
2,当nm 停止接管的时候,网络连接图标就丢失了。
关闭NetworkManager服务后可以发现右上角网络连接图标消失
1.查看NetworkManager状态,右上角出没有网卡图标
service NetworkManager status
2.重启网络服务
/etc/init.d/networking restart失败
3.然后我临时启动service NetworkManager start,右上角出现了网卡图标 重启后失效
或者systemctl start NetworkManager
systemctl enable NetworkManager 可以设置为开机自启动
4. 查看网络启动失败原因
查看我的interfaces配置和NetworkManager.conf
找不到任何问题,重启了ubuntu,结果发现一切都正常了,也能连外网。。
网桥情况
brctl show 查看桥接列表
可看到ens33绑定到了网桥br0上
virsh list --all 查看KVM实例
KVM 的信息
virt-install
–name ubuntu123
–ram 1024
–vcpus=1
–disk path=/kvm/vm/vm1.img,size=10
–network bridge=br0
–os-type=linux
–cdrom /kvm/ubuntu-16.04.4-desktop-amd64.iso
–vnclisten=0.0.0.0 --vncport=5900 --vnc
宿主机上/etc/libvirt/qemu/ubuntu123.xml关于虚拟机的配置文件
之前安装时一切正常,今天重启了宿主机ubuntu16.04后打开KVM 报错
wu@wu-virtual-machine:/kvm/vm$ virsh start ubuntu123
错误: 域已经活跃
virt-manager打开图形化页面报错
no bootable device
wu@wu-virtual-machine:/kvm/vm$ sudo cat /etc/libvirt/qemu/ubuntu123.xml
[sudo] wu 的密码:
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit ubuntu123
or other application using the libvirt API.
-->
<domain type='kvm'>
<name>ubuntu123</name>
<uuid>b2434999-c7d8-4d57-9982-2ea649dca119</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
</features>
<cpu mode='custom' match='exact'>
<model fallback='allow'>Broadwell-noTSX-IBRS</model>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/kvm-spice</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/kvm/vm/vm1.img'/>
<target dev='hda' bus='ide'/>
<address type=