xref: /nrf52832-nimble/rt-thread/components/net/lwip_nat/README.md (revision 167494296f0543431a51b6b1b83e957045294e05)
1lwIP NAT componenent
2
3If you want to use lwIP NAT componenent, please define LWIP_USING_NAT in rtconfig.h.
4
5In this case the network 213.129.231.168/29 is nat'ed when packets are sent to the
6destination network 10.0.0.0/24 (untypical example - most users will have the other
7way around).
8
9Use following code to add a NAT entry:
10
11  ip_nat_entry_t nat_entry;
12
13  nat_entry.out_if = (struct netif *)&emac_if1;
14  nat_entry.in_if = (struct netif *)&emac_if2;
15  IP4_ADDR(&nat_entry.source_net, 213, 129, 231, 168);
16  IP4_ADDR(&nat_entry.source_netmask, 255, 255, 255, 248);
17  IP4_ADDR(&nat_entry.dest_net, 10, 0, 0, 0);
18  IP4_ADDR(&nat_entry.source_netmask, 255, 0, 0, 0);
19  ip_nat_add(&_nat_entry);
20