A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By martin_g
#61770 Yes, can be done. In esp-open-lwip/include/lwip/lwip_napt.h there is the API in the modified lwip to register a port forwarding:

Code: Select all/**
 * Register port mapping on the external interface to internal interface.
 *
 * @param proto target protocol
 * @param maddr ip address of the external interface
 * @param mport mapped port on the external interface, in host byte order.
 * @param daddr destination ip address
 * @param dport destination port, in host byte order.
 */
u8_t ICACHE_FLASH_ATTR
ip_portmap_add(u8_t proto, u32_t maddr, u16_t mport, u32_t daddr, u16_t dport);


However, this is not yet availabe on the console interface. Up to now this has to be added directly in the code.

Perhaps I will try to add this next weekend as my new project requires it anyway...
User avatar
By martin_g
#61930 Port forwarding has been added now. Use e.g.:
Code: Select allCMD>portmap add TCP 80 192.168.4.2 80

for forwarding to a HTTP server.

Port mappings as well as optionally DHCP leases (this allows for fixed addresses in the internal network) can be saved to flash memory.
User avatar
By martin_g
#63651 Uploaded a new version of the WiFi Repeater (WiFI NAT Router) to https://github.com/martin-ger/esp_wifi_repeater .

Now it is even more an IoT device as it now supports configuration as well as status and event reports via MQTT. Status reports and events (e.g. when a STA has joined) are published. Commands can be sent as the WiFi Repeater is able to subscribe to a special command topic. (For details see the Readme.md file)

Does this make sense? I think so: consider the following application scenarios:
- A home automation system can switch on and off the soft AP or change ssid/password as result of another event.
- Special actions can be triggered, when a WiFi Repeater signals the join of a well-known MAC.
- More than one WiFi Repeater can listen to the same command topic. This allows for easy management even of a number of devices.
- Status reports can even be sent to an MQTT broker in the cloud, like e.g. the "EasyIoT Cloud". This allows for visualization, remote observation, and possibly even remote management.

If one doesn't like this feature - no problem: it is disabled in the default config and can be completely removed as compile time option.