搭建基于Open vSwitch的VxLAN隧道

https://www.sdnlab.com/5365.html

 

vm1配置:

# ovs-vsctl add-br br0
# ovs-vsctl add-br br1
# ovs-vsctl add-port br0 eth0  //eth0是物理网口的名字
# ifconfig eth0 0 up && ifconfig br0 192.168.146.131/24 up  //ip能外部路由器在一个网段
# route add default gw 192.168.146.2 br0  //网关ip
# ifconfig br1 10.0.0.1/24 up
# ovs-vsctl add-port br1 vx1 -- set interface vx1 type=vxlan options:remote_ip=192.168.146.136  //另外一台vm的host ip

可以增加多个vxlan端口: -- set interface vx1 type=vxlan options:remote_ip=192.168.146.139 

 

ping 10.0.0.2 

1、首包发送arp请求报文,封装在vxlan中,dip=192.168.146.136, sip=192.168.146.131, 请求10.0.0.2的mac,附带10.0.0.1的arp

如果多个vxlan端口,每个端口发送一份,dip不一样。

2、10.0.0.2在另外一台vm2,应答之后,vm1学习到mac

3、发送icmp报文,封装在vxlan中,dip=192.168.146.136, sip=192.168.146.131, da=0.2.mac,sa=0.1.mac, dip=0.2, sip=0.1

posted @ 2018-09-14 00:53  heimafeitian  阅读(285)  评论(0编辑  收藏  举报