支持nat-t的tunnel要么是标准的C/S模型,能够从墙内发起建立tunnel隧道,且有保活机制使防火墙上的ct持久生效。要么像IPSec一样,能够在协议层面支持,知道tunnel是经过nat的。
linux gre 和 vxlan 作为常用的tunnel口是无法过nat的,但其性能和复杂度比ssl,ipsec这些能够过nat的tunnel要好很多。
做了些gre/vxlan过nat的测试,做了些记录:
GRE过nat
如果网关设备为ovs,直接通过流表学习到nat过的gre头即可,如果网关设备为linux bridge需要改动内核gre模块,修改量不多。
网关设备为ovs:
网关设备上ovs上配置
* 创建br0
ovs-vsctl add-br br0
ip link set up dev br0
ip addr add 211.1.1.1/24 dev br0
* 创建gre口
ovs-vsctl add-port br0 gre1 -- set interface gre1 type=gre options:local_ip=192.168.121.177 options:remote_ip=flow options:key=flow
* 创建