最近学习了实现fullconenat的方法,受益匪浅
参考借鉴以下博文及源码,侵删:
https://www.right.com.cn/forum/thread-319827-1-1.html
https://github.com/LGA1150/openwrt-fullconenat
https://github.com/Chion82/netfilter-full-cone-nat
https://blog.chionlab.moe/2018/02/09/full-cone-nat-with-linux/
流程个人总结简化如下:
1、进入openwrt源代码目录,安装fullconenat
git clone -b master --single-branch https://github.com/LGA1150/openwrt-fullconenat package/fullconenat
2、打patch(之后即可在/etc/config/firewall中,找到wan对应的zone,新增option fullcon '1'来使能fullconenat)
https://github.com/LGA1150/fullconenat-fw3-patch中的fullconenat.patch放在package/network/config/firewall/patches目录下
3、make menuconfig,在Network > Firewall中勾选iptables-mod-fullconenat,编译烧录镜像
4、insmod xt_FULLCONENAT.ko,并在/etc/config/firewall中,找到wan对应的zone,新增option fullcon '1';reload防火墙
此时利用stun检测nat类型
(stun搭建过程 https://blog.csdn.net/xuzhen5062/article/details/106377911)
得到Independent Mapping, Independent Filter,即为fullcone NAT