summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2015-01-29 13:47:57 +0000
committerBernard Xiong <[email protected]>2015-01-29 13:47:57 +0000
commit7e11b8eb626bf00ddc4a6d29ac54d179455d026c (patch)
treec59d2b134695f91af151ff507567c65b825307f8 /components
parent627d025cda09850218938a22d86c9d01e9b6d0d2 (diff)
[lwIP] Add NAT readme
Diffstat (limited to 'components')
-rw-r--r--components/net/lwip_nat/README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/components/net/lwip_nat/README.md b/components/net/lwip_nat/README.md
new file mode 100644
index 0000000000..9672a11b54
--- /dev/null
+++ b/components/net/lwip_nat/README.md
@@ -0,0 +1,19 @@
+lwIP NAT componenent
+
+If you want to use lwIP NAT componenent, please define LWIP_USING_NAT in rtconfig.h.
+
+In this case the network 213.129.231.168/29 is nat'ed when packets are sent to the
+destination network 10.0.0.0/24 (untypical example - most users will have the other
+way around).
+
+Use following code to add a NAT entry:
+
+ ip_nat_entry_t nat_entry;
+
+ nat_entry.out_if = (struct netif *)&emac_if1;
+ nat_entry.in_if = (struct netif *)&emac_if2;
+ IP4_ADDR(&nat_entry.source_net, 213, 129, 231, 168);
+ IP4_ADDR(&nat_entry.source_netmask, 255, 255, 255, 248);
+ IP4_ADDR(&nat_entry.dest_net, 10, 0, 0, 0);
+ IP4_ADDR(&nat_entry.source_netmask, 255, 0, 0, 0);
+ ip_nat_add(&_nat_entry);