neutron基础八(qemu 桥接网络)
qemu的桥接和nat的qemu启动命令是一样的,但是后续的脚本设置不一样
试验:
1.目前在主机上建立一个vm叫centos7,作为服务器,先设置kvm透传
设置nest透传kvm,在kvm上使用kvm,主机的IP192.168.140.11netmask255.255.240.0,网关129.168.128.1
2.把建立的虚拟机centos7作为服务器主机,dhcp得到ip192.168.139.55,建立cirros的vm,
3.配置centos7和cirros,使cirros的ip192.168.139.155,使cirros通过桥接访问内部网络
4.得到的结果就是vm的网络和centos7的网络是同一个网络,能互相ping通
cat /proc/cpuinfo |grep vmx modprobe -r kvm_intel modprobe kvm_intel nested=1
使libvert虚拟机使用和主机一样的cpu
[root@centos140_11 ~]# virsh dumpxml centos7|grep cpu <vcpu placement='static'>16</vcpu> <cpu mode='host-passthrough'> </cpu>
启动vm
virsh start centos7
-----------------------------------------
然后在centos7上建立vm,首先,
先建立桥接
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-br0 DEVICE=br0 TYPE=Bridge ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none IPADDR=192.168.139.55 NETMASK=255.255.240.0 GATEWAY=192.168.128.1 DNS1=114.114.114.114 [root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 NAME="em1" DEVICE="eth0" ONBOOT="yes" NM_CONTROLLED=yes BOOTPROTO=none BRIDGE=br0 [root@centos7 ~]#
现在在centos里面建立vm
/usr/libexec/qemu-kvm -m 8192 -smp 2 -hda /home/hao/cirros-0.3.1-x86_64-disk.img -net nic -net tap,ifname=tap1,script=/home/hao/qemu-ifup,downscript=no -vnc 0.0.0.0:17 -daemonize
iplink多了一个tap1
绑定到桥上
ip link set tap1 up brctl addif br0 tap1 [root@centos7 hao]# brctl show bridge name bridge id STP enabled interfaces br0 8000.505018aa8017 yes eth0 tap1
在vm中设置
ip addr add dev eth0 192.168.139.155/20
vm百度ping不通
相关推荐
MarsCN 2014-05-15
82143754 2020-02-22
LIEVEZ 2020-08-09
成长路上 2020-06-11
zhangsyi 2020-03-26
清晨一场梦 2019-12-25
hengxie00 2019-12-25
81550996 2019-12-15
jeason 2011-03-22
GeorgeTH 2019-11-09
wanchaopeng 2019-11-03
zhjn0 2011-09-19
godot0 2019-08-17
85487419 2016-07-15
xb0 2016-07-15
88173655 2014-07-18
VictoryKingLIU 2013-05-13
xb0 2012-03-13