Skip to content

Commit 7e11b8e

Browse files
committed
[lwIP] Add NAT readme
1 parent 627d025 commit 7e11b8e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

components/net/lwip_nat/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
lwIP NAT componenent
2+
3+
If you want to use lwIP NAT componenent, please define LWIP_USING_NAT in rtconfig.h.
4+
5+
In this case the network 213.129.231.168/29 is nat'ed when packets are sent to the
6+
destination network 10.0.0.0/24 (untypical example - most users will have the other
7+
way around).
8+
9+
Use 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);

0 commit comments

Comments
 (0)