来源 https://zhuanlan.zhihu.com/p/101812773
利用 VyOS 我们可以快速的配置出一种没有灵魂的 VXLAN (没有 control plane),简洁的配置可以帮助我们测试 VXLAN 流量或者是帮助初学者学习 VXLAN。新版本的 VyOS 命令行有一些变化,官网的配置示例没有更新,所以这里记录一下我使用的配置命令。
测试的 VyOS 版本为 vyos-1.2-rolling-201912010217-amd64
VPC 1 和 VPC 2 之间虽然跨越了三层网络,但是我们利用 VXLAN 对数据包进行封装就可以使它们处于同一个二层网络。
Router(config)#int e0/0
Router(config-if)#no sh
Router(config-if)#ip add 10.1.2.1 255.255.255.0
Router(config-if)#int e0/1
Router(config-if)#no sh
Router(config-if)#ip add 10.1.3.1 255.255.255.0
vyos@VyOS1# set interfaces ethernet eth0 address 10.1.2.2/24
vyos@VyOS1# set interfaces ethernet eth1 vif 10
vyos@VyOS1# set protocols static route 0.0.0.0/0 next-hop 10.1.2.1
vyos@VyOS1# set interfaces vxlan vxlan101 remote ‘10.1.3.3‘
vyos@VyOS1# set interfaces vxlan vxlan101 port ‘4789‘
vyos@VyOS1# set interfaces vxlan vxlan101 link ‘eth0‘
vyos@VyOS1# set interfaces vxlan vxlan101 vni ‘101‘
vyos@VyOS1# set interfaces bridge br10
vyos@VyOS1# set interfaces bridge br10 member interface eth1
vyos@VyOS1# set interfaces bridge br10 member interface vxlan101
vyos@VyOS2# set interfaces ethernet eth0 add 10.1.3.3/24
vyos@VyOS2# set interfaces ethernet eth1 vif 10
vyos@VyOS2# set protocols static route 0.0.0.0/0 next-hop 10.1.3.1
vyos@VyOS2# set interfaces vxlan vxlan101 remote ‘10.1.2.2‘
vyos@VyOS2# set interfaces vxlan vxlan101 port ‘4789‘
vyos@VyOS2# set interfaces vxlan vxlan101 link ‘eth0‘
vyos@VyOS2# set interfaces vxlan vxlan101 vni ‘101‘
vyos@VyOS2# set interfaces bridge br10
vyos@VyOS2# set interfaces bridge br10 member interface eth1
vyos@VyOS2# set interfaces bridge br10 member interface vxlan101
VPCS> ping 192.168.1.2
84 bytes from 192.168.1.2 icmp_seq=1 ttl=64 time=3.372 ms
84 bytes from 192.168.1.2 icmp_seq=2 ttl=64 time=4.520 ms
84 bytes from 192.168.1.2 icmp_seq=3 ttl=64 time=4.519 ms
84 bytes from 192.168.1.2 icmp_seq=4 ttl=64 time=4.370 ms
84 bytes from 192.168.1.2 icmp_seq=5 ttl=64 time=4.977 ms
============ End
原文:https://www.cnblogs.com/lsgxeva/p/14106634.html