fragmentation needed and DF set(Code4))。
如何开启ipv4-df功能。
config vpn ipsec phase1-interface
edit "ToR2"
**set ip-fragmentation pre-encapsulation**
next
end
config vpn ipsec phase2-interface
edit "ToR2"
**set ipv4-df enable**
next
end
<aside> 💡 开启ipv4-df的同时,也必须开启pre-encapsulation。否则,使用post-encapsulation的同时开启ipv4-df,本身就可能发出ESP分片包,由于设置了DF位,FortiGate自身将无法对ESP包进行分片并发出。 参考Mantis ID 0748811,"When ipv4-df is enable, it only works with "set ip-fragmentation pre-encapsulation", if with default setting post-encapsulation, since DF is set, FGT actually won't be able to do fragmentation for the ESP."
</aside>
<aside>
💡 请注意,中间设备Router必须开启发送ICMP PMTU的功能,才能返回该种类型的ICMP,在FortiGate中,可以在全局配置下配置“set send-pmtu-icmp enable”开启(默认开启)。
</aside>
config system global
**set send-pmtu-icmp enable**
end
IPSec SA MTU,可以看到,使用AES128/SHA256算法,Tunnel MTU根据物理口port16默认的1500(三层MTU)计算为1438(包含除ESP封装外的原始数据)。
R1-FG1101E # diagnose vpn tunnel list
list all ipsec tunnel in vd 0
------------------------------------------------------
name=ToR2 ver=1 serial=1 100.0.0.2:0->100.0.3.2:0 dst_mtu=1500
bound_if=39 lgwy=static/1 tun=intf/0 mode=auto/1 encap=none/0 run_state=0 accept_traffic=1 overlay_id=0
proxyid_num=1 child_num=0 refcnt=13 ilast=5 olast=45 ad=/0
stat: rxp=5 txp=5 rxb=2252 txb=1900
dpd: mode=on-demand on=1 idle=20000ms retry=3 count=0 seqno=1
natt: mode=none draft=0 interval=0 remote_port=0
proxyid=ToR2 proto=0 sa=1 ref=2 serial=5
src: 0:0.0.0.0/0.0.0.0:0
dst: 0:0.0.0.0/0.0.0.0:0
SA: ref=3 options=10224 type=00 soft=0 **mtu=1438** expire=41675/0B replaywin=0
seqno=6 esn=0 replaywin_lastseq=00000000 itn=0 qat=0 hash_search_len=1
life: type=01 bytes=0/0 timeout=42933/43200
dec: spi=2906b1d5 esp=aes key=16 07e5122c7eb135a456777e3c9bb6fb4d
ah=sha256 key=32 546a5d82c8a5c37ba95b41a52b8c37b94743c208c9feef877ce4ec9936693880
enc: spi=29406302 esp=aes key=16 456a1087352c6abfbf02c826bbcbc60d
ah=sha256 key=32 a6a0652a576343d46367e60625e708ca631e9833e3b2692df8a98ea5558bee8f
dec:pkts/bytes=5/1900, enc:pkts/bytes=5/2252
npu_flag=00 npu_rgwy=100.0.3.2 npu_lgwy=100.0.0.2 npu_selid=5 dec_npuid=0 enc_npuid=0
run_tally=0

<aside> 💡 关于自动计算出的Tunnel SA MTU是如何来的,请参考这里。
</aside>
Tunnel netlink interface list MTU为1438。
R1-FG1101E # diagnose netlink interface list | grep ToR2
if=ToR2 family=00 type=768 index=50 **mtu=1438** link=0 master=0
PC1访问PC2后,FW1的Tunnel RT Cache PMTU为1438。
R1-FG1101E # diagnose ip rtcache list | grep 10.1.87.222 -A 1
10.0.86.221@37(port14)->10.1.87.222@50(ToR2) gwy=0.0.0.0 prefsrc=10.0.86.1
ci: ref=1 lastused=2 expire=0 err=00000000 used=0 br=0 **pmtu=1438**