centos7 安装Open vSwitch:#yum install -y openvswitch
搭建过程可参考https://blog.csdn.net/SDNLAB/article/details/42236983?utm_source=blogxgwz7
说下搭建GRE过程要注意的问题
两台虚拟的br1配置时要加上ens33网卡,可用ifconfig查询
ovs-vsctl add-port br0 ens33
最后互ping通讯时要关闭防火墙否则可能会不成功
systemctl stop firewalld
抓包时先要在宿主机内下载抓包软件,我下的为wireshark抓包软件,ping的过程中搜索gre就会出现想要的数据包
具体操作步骤
第一台机
[root@localhost ]# yum install -y openvswitch
[root@localhost ]# systemctl start openvswitch.service
[root@localhost ]# systemctl stop firewalld
[root@localhost ]# ovs-vsctl add-br br0
[root@localhost ]# ovs-vsctl add-br br1
[root@localhost ]# ifconfig br1 192.168.5.23/24 up
[root@localhost ]# route add default gw 192.168.5.1 dev br1
[root@localhost ]# ovs-vsctl add-port br1 ens33
[root@localhost ]# ifconfig br0 192.168.4.10/24 up
[root@localhost ]# ovs-vsctl add-port br0 gre1 – set interface gre1 type=gre option:remote_ip=192.168.5.238
第二台机
[root@localhost ]# yum install -y openvswitch
[root@localhost ]# systemctl start openvswitch.service
[root@localhost ]# systemctl stop firewalld
[root@localhost ]# ovs-vsctl add-br br0
[root@localhost ]# ovs-vsctl add-br br1
[root@localhost ]# ifconfig br1 192.168.5.238/24 up
[root@localhost ]# route add default gw 192.168.5.1 dev br1
[root@localhost]# ovs-vsctl add-port br1 ens33
[root@localhost ]# ifconfig br0 192.168.4.11/24 up
[root@localhost ]# ovs-vsctl add-port br0 gre1 – set interface gre1 type=gre option:remote_ip=192.168.5.23
最后互pingip即可