First, the basic environment
Use VMware virtual two Linux machines. The CentOS 7,linux kernel is as follows:
4.5.3-1.el7.elrepo.x86_64
If the kernel version is too low, Vxlan is not supported. Kernel upgrades can be done with commands
RPM--import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[Plain]View PlainCopy
- RPM-UVH http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
- Yum--enablerepo=elrepo-kernel Install Kernel-ml-devel kernel-ml-y
Reboot to select New kernel after upgrade.
Second, the group Network Diagram
Two virtual machines VM1 and vm2,eth2 are network cards on the virtual machine. VXLAN10 is a virtual network card that is created to handle Vxlan. Veth1 and Veth0 are a pair of virtual ports that are created. BR-VX is the network bridge that is created.
Third, configuration commands
VM1:
[HTML]View PlainCopy
- #创建网桥br-VX and make it up
- Brctl ADDBR BR-VX
- IP link Set br-vx up
- #增加一个类型为vxlan, the Vni-id is a virtual network card with the name Vxlan10 of 100, indicating that the peer address is 192.168.233.190,
- # (The address of this address is VM2 eth2) out interface is the eth2 of the local side
- IP link Add vxlan10 type Vxlan ID remote 192.168.233.190 dstport 4789 Dev eth2
- IP link Set vxlan10 up
- #把vxlan10加入到网桥中
- Brctl addif BR-VX Vxlan10
- #创建一对虚拟网卡, set the address of the Veth0 to 192.167.1.6, and tie the veth1 to the bridge BR-VX. From Veth0
- #发出的报文将会发给veth1, because Veth1 is in the bridge, it is entered into vxlan10 and sent to the peer through the Vxlan tunnel.
- IP link Add type Veth
- Ifconfig Veth0 192.167.1.6/24 up
- Ifconfig Veth0 MTU 1450
- Ifconfig veth1 up
- Ifconfig veth1 MTU 1450
- Brctl addif BR-VX veth1
VM2:
[HTML]View PlainCopy
- #创建网桥br-VX and make it up
- Brctl ADDBR BR-VX
- IP link Set br-vx up
- #增加一个类型为vxlan, the Vni-id is a virtual network card with the name Vxlan10 of 100, indicating that the peer address is 192.168.233.180,
- # (The address of this address is VM2 eth2) out interface is the eth2 of the local side
- IP link Add vxlan10 type Vxlan ID remote 192.168.233.180 dstport 4789 Dev eth2
- IP link Set vxlan10 up
- #把vxlan10加入到网桥中
- Brctl addif BR-VX Vxlan10
- #创建一对虚拟网卡, set the address of the Veth0 to 192.167.1.7, and tie the veth1 to the bridge BR-VX. From Veth0
- #发出的报文将会发给veth1, because Veth1 is in the bridge, it is entered into vxlan10 and sent to the peer through the Vxlan tunnel.
- IP link Add type Veth
- Ifconfig Veth0 192.167.1.7/24 up
- Ifconfig Veth0 MTU 1450
- Ifconfig veth1 up
- Ifconfig veth1 MTU 1450
- Brctl addif BR-VX veth1
Iv. Verification
After building, you can use the ping command on the VM1 to verify: Vm1:ping 192.167.1.7, through the tcpdump grasp the message to see the structure.
Reference article: http://blog.csdn.net/xingyeping/article/details/51353321
Build Vxlan environment with CentOS Linux Bridge