ovs tunnel
实验拓扑
实验拓扑搭建基础脚本
1 | #vbox虚拟机1 |
GRE TUNNEL 配置
vbox虚拟机1
1
ovs-vsctl add-port sw1 tun0 -- set Interface tun0 type=gre options:remote_ip=10.30.10.141
vbox虚拟机2
1
ovs-vsctl add-port sw2 tun0 -- set Interface tun0 type=gre options:remote_ip=10.30.10.145
查看配置
vbox虚拟机1
1
2
3
4
5
6
7
8
9
10
11
12
13root@controller-VirtualBox:~# ovs-vsctl show
29c5cc05-2a31-4f14-a304-3a697698f96a
Bridge "sw1"
Port "sw1"
Interface "sw1"
type: internal
Port "sw1-p1"
Interface "sw1-p1"
Port "tun0"
Interface "tun0"
type: gre
options: {remote_ip="10.30.10.141"}
ovs_version: "2.5.2"vbox虚拟机2
1
2
3
4
5
6
7
8
9
10
11
12
13
14root@controller-VirtualBox:~# ovs-vsctl show
0f92aaa0-5385-48f5-a54a-644e05652f59
Bridge "sw2"
Port "sw2-p1"
Interface "sw2-p1"
Port "sw2"
Interface "sw2"
type: internal
Port "tun0"
Interface "tun0"
type: gre
options: {remote_ip="10.30.10.145"}
ovs_version: "2.5.2"
root@controller-VirtualBox
连通性测试,在vbox虚拟机1 left ns中ping虚拟机2 right
1 | root@controller-VirtualBox:~# ip netns exec left ping 10.0.0.2 |
VXLAN TUNNEL配置
vbox虚拟机1
1
ovs-vsctl add-port sw1 tun0 -- set Interface tun0 type=vxlan options:local_ip=10.30.10.145 options:remote_ip=10.30.10.141
vbbox虚拟机2
1
ovs-vsctl add-port sw2 tun0 -- set Interface tun0 type=vxlan options:local_ip=10.30.10.141 options:remote_ip=10.30.10.145
查看配置
vbox虚拟机1
1
2
3
4
5
6
7
8
9
10
11
12
13root@controller-VirtualBox:~# ovs-vsctl show
29c5cc05-2a31-4f14-a304-3a697698f96a
Bridge "sw1"
Port "sw1"
Interface "sw1"
type: internal
Port "sw1-p1"
Interface "sw1-p1"
Port "tun0"
Interface "tun0"
type: vxlan
options: {local_ip="10.30.10.145", remote_ip="10.30.10.141"}
ovs_version: "2.5.2"vbox虚拟机2
1
2
3
4
5
6
7
8
9
10
11
12
13
14root@controller-VirtualBox:~# ovs-vsctl show
0f92aaa0-5385-48f5-a54a-644e05652f59
Bridge "sw2"
Port "sw2-p1"
Interface "sw2-p1"
Port "sw2"
Interface "sw2"
type: internal
Port "tun0"
Interface "tun0"
type: vxlan
options: {local_ip="10.30.10.141", remote_ip="10.30.10.145"}
ovs_version: "2.5.2"
root@controller-VirtualBox:~#
连通性测试,在vbox虚拟机1 left ns中ping虚拟机2 right
1 | root@controller-VirtualBox:~# ip netns exec left ping 10.0.0.2 |
ipsec_gre配置
如果运行失败或则无法创建接口,首先安装1
apt-get install openvswitch* -y
vbox虚拟机1
1
ovs-vsctl add-port sw1 tun0 -- set interface tun0 type=ipsec_gre options:remote_ip=10.30.10.141 options:psk=test123
vbbox虚拟机2
1
ovs-vsctl add-port sw2 tun0 -- set interface tun0 type=ipsec_gre options:remote_ip=10.30.10.145 options:psk=test123
在ipsec gre tunnel情况下,我的环境中并没有完成连通,而且日志中也没有报错;具体原因还需要探究。当然我已经翻阅论坛,然并卵,哎。。。,暂且未解之谜吧