#实验环境:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8F/AB/wKioL1joosaxkjCVAAA4CBuVqYg103.png "title=" capture. PNG "alt=" Wkiol1joosaxkjcvaaa4cbuvqyg103.png "/>
#本次实验要让192.168.1.3 ping through 192.168.1.2 across physical nodes
#两台物理机:
Kvm_1 |
192.168.174.134 |
Kvm_2 |
192.168.174.135 |
#在KVM_1主机上操作
#安装KVM相关软件
[[Email protected]_1 ~]# yum-y install QEMU-KVM libvirt virt-install bridge-utils
[Email protected]_1 ~]# systemctl start Libvirtd.service
[Email protected]_1 ~]# brctl ADDBR br-vx #创建网桥
[[Email protected]_1 ~]# IP link set br-vx up #启动网桥
[[Email protected]_1 ~]# IP link add vxlan10 type Vxlan ID ' remote 192.168.174.135 dstport 4789 Dev eno33554960
#创建vxlan隧道 remote address dstport as remote port dev for local physical egress
[[Email protected]_1 ~]# IP link set vxlan10 up #开启隧道
[Email protected]_1 ~]# brctl addif br-vx vxlan10 #将隧道加入网桥
#在KVM_2主机上操作
#安装KVM相关软件
[[Email protected]_2 ~]# yum-y install QEMU-KVM libvirt virt-install bridge-utils
[Email protected]_2 ~]# systemctl start Libvirtd.service
[Email protected]_2 ~]# brctl ADDBR br-vx #创建网桥
[[Email protected]_2 ~]# IP link set br-vx up #启动网桥
[[Email protected]_2 ~]# IP link add vxlan10 type Vxlan ID ' remote 192.168.174.134 dstport 4789 Dev eno16777736
#创建vxlan隧道 remote address dstport as remote port dev for local physical egress
[[Email protected]_2 ~]# IP link set vxlan10 up #开启隧道
[Email protected]_2 ~]# brctl addif br-vx vxlan10 #将隧道加入网桥
#创建虚拟机 here is a cirros mirror.
[Email protected]_1 ~]# virt-install--name=vm4--network bridge=br-vx--graphics vnc,listen=0.0.0.0--noautoconsole-- ram=512--vcpus=1--boot HD--disk path=/opt/cirros-0.3.4-x86_64-disk.img
[[Email protected]_1 ~]# Brctl Show
Bridge nameBridge IDSTP enabledinterfaces
BR-VX8000.265a5b09d49enovnet0
Vxlan10
Virbr08000.52540057b868Yesvirbr0-nic
[Email protected]_2 ~]# virt-install--name=vm4--network bridge=br-vx--graphics vnc,listen=0.0.0.0--noautoconsol E--ram=512--vcpus=1--boot HD--disk path=/opt/cirros-0.3.4-x86_64-disk.img
[[Email protected]_2 ~]# Brctl Show
Bridge name Bridge ID STP enabled interfaces
BR-VX 8000.e6d9912583a0 no vnet0
Vxlan10
Virbr0 8000.5254006a8c44 Yes virbr0-nic
#创建虚拟机时 Network chooses to connect to the BR-VX instead of the default network (VIRBR0)
#用VNC连接到虚拟机
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/8F/AD/wKiom1joqPjhUWTEAADyv8Vkq4A142.png "title=" capture. PNG "alt=" Wkiom1joqpjhuwteaadyv8vkq4a142.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8F/AD/wKiom1joqTeQFh2JAABNSFJnE94268.png "title=" capture. PNG "alt=" Wkiom1joqteqfh2jaabnsfjne94268.png "/>
#由于我们没有搭建DHCP so you need to set the IP address manually
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8F/AD/wKiom1joqiHz64vyAAAQ5_vaTk4230.png "title=" capture. PNG "alt=" Wkiom1joqihz64vyaaaq5_vatk4230.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8F/AD/wKiom1joqmCgqaXnAAASIlEiv1Q139.png "title=" capture. PNG "alt=" Wkiom1joqmcgqaxnaaasileiv1q139.png "/>
#重启
#KVM_2上的虚拟机进行相同的操作
#测试 192.168.1.3 Ping the virtual machine on another physical machine 192.168.1.2
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/8F/AB/wKioL1jorELjHtK6AABn9mf2-mY037.png "title=" capture. PNG "alt=" Wkiol1joreljhtk6aabn9mf2-my037.png "/>
#注意: Since we are using commands to configure, the physical machine will not be restarted.
# So here's the configuration file for BR-VX
[Email protected]_2 ~]# CAT/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-BR-VX
Device=br-vx
Stp=no
Type=bridge
Bootproto=none
Defroute=yes
Ipv4_failure_fatal=no
Ipv6init=yes
Ipv6_autoconf=no
Ipv6_defroute=yes
Ipv6_failure_fatal=no
Name=br-vx
Uuid=8fc90c0c-81b9-496c-b25f-de6e8a206bf9
Onboot=yes
ipaddr=192.168.1.1 #这里的IP地址是网桥的IP地址, convenient to do DHCP
Prefix=24
This article is from the "Chauncey" blog, make sure to keep this source http://cqwujiang.blog.51cto.com/10808946/1914123
Build Vxlan with Linux Bridge to enable virtual machines to communicate across physical machines