https://blog.csdn.net/maimang1001/article/details/124857591
https://blog.csdn.net/weixin_35056480/article/details/116803025
iptables详解(13):iptables动作总结之二-朱双印博客
https://blog.csdn.net/IO_print/article/details/115323357
(157条消息) 一图搞懂网络NAT映射_龙赤子的博客-CSDN博客_nat映射
ubuntu双网卡设置内外网上网问题,实现路由转发 - 360文档中心
(155条消息) NAT基础:NAT技术原理,静态NAT、动态NAT、NAPT、Easy IP、NAT Server的原理,以及各NAT的配置方法和转换示例。_Python-派大星的博客-CSDN博客
1.13 以太网DataSpec - 2021_红旗智能座舱操作系统 - Confluence
Ubuntu设置双网卡, 让开发板可以通过PC的网卡上网_51CTO博客_ubuntu双网卡共享上网
Linux-SNAT和DNAT - 腾讯云开发者社区-腾讯云
//arp内核过滤
arptables- 内核ARP过滤管理丶Java教程网-IT开发者们的技术天堂
//iptables包的记录日志
nf_conntrack的记录:
kernel/msm-5.4/net/netfilter/nf_conntrack_proto.c
注册conntrack的几个hook:
/* Connection tracking may drop packets, but never alters them, so
* make it the first hook.
*/
static const struct nf_hook_ops ipv4_conntrack_ops[] = {
{
.hook = ipv4_conntrack_in,
.pf = NFPROTO_IPV4,
.hooknum = NF_INET_PRE_ROUTING,
.priority = NF_IP_PRI_CONNTRACK,
},
{
.hook = ipv4_conntrack_local,
.pf = NFPROTO_IPV4,
.hooknum = NF_INET_LOCAL_OUT,
.priority = NF_IP_PRI_CONNTRACK,
},
{
.hook = ipv4_confirm,
.pf = NFPROTO_IPV4,
.hooknum = NF_INET_POST_ROUTING,
.priority = NF_IP_PRI_CONNTRACK_CONFIRM,
},
{
.hook = ipv4_confirm,
.pf = NFPROTO_IPV4,
.hooknum = NF_INET_LOCAL_IN,
.priority = NF_IP_PRI_CONNTRACK_CONFIRM,
},
};