There was an error while loading. Please reload this page.
1 parent dc4e728 commit 4c16e5dCopy full SHA for 4c16e5d
WiFiNatRouter.ino
@@ -24,7 +24,6 @@ void setup()
24
Serial.println("Starting NAT demo");
25
26
WiFi.begin(sta_ssid, sta_password);
27
- //WiFi.config(ip, gateway, subnet);
28
29
//Wifi connection
30
while (WiFi.status() != WL_CONNECTED) {
@@ -53,10 +52,13 @@ void setup()
53
52
Serial.print("AP IP address: ");
54
Serial.println(myIP);
55
+ // Initialize the NAT feature
56
ip_napt_init(IP_NAPT_MAX, IP_PORTMAP_MAX);
57
58
+ // Enable NAT on the AP interface
59
ip_napt_enable_no(1, 1);
60
61
+ // Set the DNS server for clients of the AP to the one we also use for the STA interface
62
dhcps_set_DNS(WiFi.dnsIP());
63
64
}
0 commit comments