拓扑图如下
使用centos7
安装openvswitch(两台主机都要安装)
yum install openvswitch -y
启动
systemctl start openvswitch
主机1
添加网桥
ovs-vsctl add-br br-in
在网桥上添加端口
ovs-vsctl add-port br-in tep0 -- set interface tep0 type=internal
给接口设置IP
ifconfig tep0 192.168.0.200 netmask 255.255.255.0
在网格上添加类型为gre的端口 并指定了对端的地址
ovs-vsctl add-port br-in gre10 -- set interface gre10 type=gre options:remote_ip=192.168.60.78
主机2
添加网桥
ovs-vsctl add-br br-in
在网桥上添加端口
ovs-vsctl add-port br-in tep0 -- set interface tep0 type=internal
给接口设置IP
ifconfig tep0 192.168.0.201 netmask 255.255.255.0
在网格上添加类型为gre的端口 并指定了对端的地址
ovs-vsctl add-port br-in gre10 -- set interface gre10 type=gre options:remote_ip=192.168.60.88
配置完成进行ping测试