rtt-f030/components/net/lwip_nat
He Chunhui 7290ff5d76 fix typo 2016-03-16 08:03:33 +00:00
..
README.md [lwIP] Add NAT readme 2015-01-29 13:47:57 +00:00
SConscript [lwIP] remove IP_INPUT_HOOK 2015-01-29 15:01:26 +08:00
ipv4_nat.c fix typo 2016-03-16 08:03:33 +00:00
ipv4_nat.h fix incompatible unit in LWIP_NAT_TMR_INTERVAL_SEC 2016-03-16 07:43:38 +00:00

README.md

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);