Hello, I have a web server code running on my Arduino Uno with an Ethernet shield. It works fine on the local network, but when I try to access it from my mobile data, it doesn't work. I suspect that port forwarding is the issue because when I check my port, I can't see any open ports. I've configured the router settings, DHCP, and port forwarding, but it's still not working. I have a TP-Link router connected after my Huawei modem. I'm not the owner of the ISP, as I'm renting, and I can't contact the provider. This is crucial for my project. I've read various posts with similar problems but still can't solve mine. I want a solution to access the Arduino either through port forwarding or a different method.
I have different arduino projects that i want to implement it into a web page with analog reads, digital input, home automation, simple relay turn on or off. etc.
Some ideas will be good, thank you
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x1E, 0xA6 };
EthernetServer server(6567);
// Conținutul fișierului de autorizare
const char authContent[] = "Congrats! You have successfully verified your domain.";
void setup() {
Serial.begin(9600);
// Adresa MAC
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x1E, 0xA6 };
// Adresa IP statică
IPAddress ip(xxx,xxx,0,178);
Ethernet.begin(mac, ip);
server.begin();
Serial.println("Serverul web a fost pornit!");
Serial.print("Adresa MAC: ");
for (int i = 0; i < 6; ++i) {
Serial.print(mac[i], HEX);
if (i < 5) Serial.print(':');
}
Serial.println();
// Afișează adresa IP în Serial Monitor
Serial.print("Adresa IP: ");
Serial.println(ip);
Serial.println("Serverul web a fost pornit!");
}
void loop() {
EthernetClient client = server.available();
if (client) {
Serial.println("Client conectat");
while (client.connected()) {
if (client.available()) {
// Declară variabila 'request' și atribuie-i valoarea citită din client
String request = client.readStringUntil('\r');
Serial.println(request);
if (request.indexOf("/") != -1) {
Serial.println("Cerere pentru pagina principala.");
// Răspuns HTML simplu
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
client.println("<html><body><h1>Salut de la Arduino Web Server!</h1></body></html>");
}
else if (request.indexOf("/.well-known/pki-validation/") != -1) {
// Tratează cererea pentru .well-known/pki-validation/
Serial.println("Cerere pentru .well-known/pki-validation/");
sendAuthorizationFile(client);
}
else {
client.println("HTTP/1.1 404 Not Found");
client.println("Content-Type: text/plain");
client.println("Connection: close");
client.println();
}
break;
}
}
client.stop();
Serial.println("Client deconectat");
}
}
void sendAuthorizationFile(EthernetClient &client) {
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/plain");
client.println("Connection: close");
client.println();
client.print(authContent);
}
i tried with noip but still nothing
IPAddress ip(xxx,xxx,0,178);
6567 xxx.xxx.0.178 6567 TCP or UDP Enabled
arduino4.ddns.net
xxx.xxx.100.2:6567 (router ip)
i tried with different ips (my laptop, arduino, router, modem EVERITHING@@@!!!!)
Thank you for your time