Hi all!
I need a static IP for my project at ESP8266. The local server runs on Raspberry Pi3 server-0.41.7-java8, library v0.6.1 on NodeMCU.
I carefully read all topics related to static addresses, but I can not solve the problem.
This is the code I use.
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "*******";
char ssid[] = "*****";
char password[] = "******";
IPAddress server_ip (xxx, xxx, xxx, xxx);
byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xFF };
IPAddress arduino_ip ( 192, 168, 100, 112);
IPAddress dns_ip ( 8, 8, 8, 8);
IPAddress gateway_ip ( 192, 168, 100, 100);
IPAddress subnet_mask(255, 255, 255, 0);
void setup() {
Serial.begin(115200);
Serial.println();
WiFi.config(arduino_ip, gateway_ip, subnet_mask);
WiFi.begin(ssid, password);
Serial.print("localIP: ");
Serial.println(WiFi.localIP());
// Blynk.config(auth, server_ip, 8080);
Blynk.config(auth, "******.ddns.net", 8080);
while (Blynk.connect(1000) == false) {
}
}
void loop() {
Blynk.run();
}
I have a dynamic external IP and configured port forwarding to the server.
Problem in this lines:
// Blynk.config (auth, server_ip, 8080);
Blynk.config (auth, "*****. Ddns.net", 8080);
If select a line with a specified current external IP, then everything works. But if I choose a line with a domain name, then I get into the permanent
[] Connecting to ******. ddns.net:8080
That is, the IP address assigned by ESP is correct, but the connection to the local server by the domain name does not occur.
The domain name is relevant, linking to the IP is correct.
Sorry for my English