版本 V1.0 时间 作者 2017 年 5 月 王祥 状态 反馈 support_cn@fortinet.com
目录 1 应用场景... 3 2 网络拓扑... 3 3 版本说明... 3 4 配置步骤... 4 4.1 FortiGate VXLAN 配置... 4 4.2 Ubuntu VXLAN 配置... 6 5 测试结果... 6 6 注意事项... 7
1 应用场景 VXLAN over IPsec 是一种 layer2 over layer3 技术解决方案, 将二层数据报文封 装在三层报文中, 跨越中间的三层网络, 实现两地二层数据的互通, 从而将多个数 据中心贯穿起来 2 网络拓扑 需求说明 :Ubuntu 连接的 PC2 需要访问 FGTA 同一 VXLAN VNI 节点的 PC1, FGTB 连接的 PC3 需要访问 Ubuntu 不同 VXLAN VNI 节点的 PC2 3 版本说明 VXLAN 在 v5.6 及以上版本支持 试验中使用 FGT100E:FortiGate-100E v5.6.0,build1449
4 配置步骤 4.1 FortiGate VXLAN 配置 FGTA 作为 VXLAN 网关配置 : 1 配置 VXLAN config system vxlan edit "vxlan1" set interface "wan1" set vni 10 set remote-ip "192.168.90.182" edit "vxlan2" set interface "wan1" set vni 20 set remote-ip "192.168.90.158" 2 配置软交换 config system switch-interface edit "vxlan-sw" set vdom "root" set member "port1" "vxlan1" 3 配置 VXLAN 接口 ip 地址 config system interface edit " vxlan-sw " set ip 20.20.20.1 255.255.255.0 set allowaccess ping https http edit "vxlan2" set ip 30.30.30.1 255.255.255.0 set allowaccess ping https http 注意 :vxlan2 接口没有配置软件换, 是因为没有需要通信的节点 pc 接口
4 配置 VXLAN ipv4 策略 config firewall policy edit 1 set name " vxlan-sw -vxlan2" set srcintf " vxlan-sw " set dstintf "vxlan2" set srcaddr "all" set dstaddr "all" set action accept set schedule "always" set service "ALL" edit 2 set name "vxlan2- vxlan-sw " set srcintf "vxlan2" set dstintf " vxlan-sw " set srcaddr "all" set dstaddr "all" set action accept set schedule "always" set service "ALL" FGTB 作为 VXLAN 节点配置 : 1 配置 VXLAN config system vxlan edit "vxlan2" set interface "wan1" set vni 20 set remote-ip "192.168.90.181" 2 配置软交换 config system switch-interface edit "vxlan-sw" set vdom "root" set member "port1" "vxlan2"
3 配置软交换接口 ip 地址 config system interface edit "vxlan-sw" set ip 30.30.30.2 255.255.255.0 set allowaccess ping https http 4 软交换成员之间默认互通, 不需要配置防火墙策略 注意 :PC3 访问 internet 的网关在 FGTB 上, 则默认网关配置为 FGTB 的软交换接口, 但是 PC3 访问其他 VXLAN VNI 节点的下一条在 FGTA 上, 则需要在 PC3 上写一条细化路由 4.2 Ubuntu VXLAN 配置 Ubuntu 配置如下 : apt-get install openvswitch-switch ovs-vsctl add-br br0 ovs-vsctl add-br br1 ovs-vsctl add-port br0 eth0 ifconfig eth0 0 up && ifconfig br0 192.168.90.182/24 up ifconfig br1 20.0.0.101/24 up ovs-vsctl add-port br1 vxlan1 -- set interface vxlan1 type=vxlan options:remote_ip=192.168.90.181\ options:key=10 route add net 30.30.30.0/24 gw 20.20.20.1 5 测试结果 同 VXLAN VNI 或者不同 VXLAN VNI 下的 PC 都能够正常访问, 报文如下 :
6 注意事项 1 过 VXLAN 接口的报文不会进入 NP 加速 FG100E4Q16003541 # diagnose sys session list session info: proto=1 proto_state=00 duration=367 expire=59 timeout=0 flags=00000000 sockflag=00000000 sockport=0 av_idx=0 use=4 origin-shaper= reply-shaper= per_ip_shaper= ha_id=0 policy_dir=0 tunnel=/ vlan_cos=0/255 state=may_dirty statistic(bytes/packets/allow_err): org=20400/340/1 reply=20460/341/1 tuples=2 tx speed(bps/kbps): 55/0 rx speed(bps/kbps): 55/0 orgin->sink: org pre->post, reply pre->post dev=42->40/40->42 gwy=20.20.20.1/30.30.30.101 hook=pre dir=org act=noop 30.30.30.101:15->20.20.20.1:8(0.0.0.0:0) hook=post dir=reply act=noop 20.20.20.1:15->30.30.30.101:0(0.0.0.0:0) misc=0 policy_id=2 auth_info=0 chk_client_info=0 vd=0 serial=f6c7a5bf tos=ff/ff app_list=0 app=0 url_cat=0 dd_type=0 dd_mode=0 npu_state=0x040000 no_ofld_reason: non-npu-intf 2 FortiGate 软交换 switch-interface 的成员策略有两种 implicit 和 explicit, 都能够给正常建立 VXLAN over IPSEC 隧道 当 intra-switch-policy 设置为 implicit 时 ( 默认 ), 成员之间在没有策略允许的情况下是可以相互访问的, 并且可以通过 switch-interface 接口进行三层转发, 但是 FortiGate 设备不维持成员之间的会话 当 intra-switch-policy 设置为 explicit 时, 成员之间在没有策略允许的情况下是不可以相互访问的, 成员接口之间的策略允许后,FortiGate 维护成员之间的会话, 但是这种情况 switch-interface 就像是一个透明模式的 vdom, 只能进行二层转发