Web Server using IP public (set as port forwarding at WIFI modem) can not work

I have IoT Arduino Project with below explanation:
WEB server -based arduino devices with private IP 192.168.1.17 can be accessed via WAN/internet that integrated with public IP 125.162.xxx.yyy. This IP is obtained from TELKOM Internet Service Provider.

with below wiring diagram: pleaase see wiring diagram Arduino.png

MEGA Arduino to ENC28J60

ENC28J60 ------ Arduino MEGA
SO ------------------------------50
S1-------------------------------51
SCK-----------------------------52
CS-------------------------------53
VCC---------------- +5 vdc VCC
GND-------------------------GND

From Arduino integrated with network as below: see Network diagram.jpg

IP public 125.162.xxx.yyy got from IP DDNS TELKOM ISP.

Check at https://who.is/ already registered: please see check whois-ip.png

Setting at MODEM WIFI TELKOM Internet Service Provider,I used Port Forwarding in this case. please see Setting at MODEM WIFI TELKOM Internet Service Provider.png

Problem :

IF I used TELKOM Internet Service Provider (which is used the block IP 192.168.1.xx) IP Public able to ping normally:

Ping to Arduino IP (192.168.1.17) also normal:

Domain xxxxxxxxxxxx.ip-dynamic.com able to open

But if I used different Internet Service provider let say TELKOMSEL, I failed when open domain xxxxxxxxxxxx.ip-dynamic.com

To make sure internet it’s OK at TELKOMSEL ISP:

Ping to IP public 125.162.xxx.yyy. result is OK:

BUT when open domain xxxxxxxxxxxx.ip-dynamic.com FAILED:

I’m Using another Laptop/PC also failed(using TELKOMSEL ISP):

Using browser at smart phone also Failed (Using XL Axiata ISP):

Action has been done

Change port 8080 failed

Change port 8000 failed

Change port 1000 failed

Please help me to solve this problem, is there any wrong/missed config at WIFI modem or at Arduino ?

Listing Program:

#include <EthernetENC.h>
#include <SPI.h>

 
int ledPin1 = 8;  //relay on port 8
int value = LOW; 
int value1 = LOW; 
int value2 = LOW; 



byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 17);

EthernetServer server(80);
String readString;

void setup() {
  Ethernet.init(53);
Serial.begin(9600);
while (!Serial) {
; 
}

 pinMode(ledPin1, OUTPUT); 
 digitalWrite(ledPin1, LOW); 

Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}



void loop(){

// Check if a client has connected 
 EthernetClient client = server.available(); 
 if (!client) { 
 return; 
 } 
 
 // Read the first line of the request 
 String request = client.readStringUntil('\r'); 
 Serial.println(request); 
 client.flush(); 
 // Return the response 
 client.println("HTTP/1.1 200 OK"); 
 client.println("Content-Type: text/html"); 
 client.println(""); // do not forget this one 
 client.println("<!DOCTYPE HTML>"); 
 client.println("<html>"); 
 client.println("<html>");
client.println("<head>");
client.println("<title>WebServer</title>");
client.println("</head>");
client.println("<body>");
client.println("<br><br>");
client.println("<h1 style=color:white><center>PANDU GREEN HOUSE</center></h1>");
client.println("<br><br>");
 
 // Match the request 
//Pumps

  client.println("<h3 style=color:white><a>Sensor Measurements</a></h3>");

 int dataadc1 = analogRead(A0);
 int dataadc2 = analogRead(A1);

client.println("Moisture Sensor=");
client.println(dataadc1);
client.println("<br><br>");

client.println("Temperature Sensor=");
client.println(dataadc2);
client.print("Celcius");
client.println("<h3><a href=\"/?refresh\"\"><button>Refresh All Sensor</button></a></h3>");

client.println("<br><br>");

 client.println("<h3 style=color:white><a>WATER PUMP</a></h3>");

if (request.indexOf("/LED1=ON") != -1) { 
 digitalWrite(ledPin1, HIGH); 
 value = HIGH; } 
 if (request.indexOf("/LED1=OFF") != -1){ 
 digitalWrite(ledPin1, LOW); 
 value = LOW; } 
client.print("Pump is now: "); 
 if(value == HIGH) { 
 client.print("On"); } 
else { 
 client.print("Off"); } 
 client.println("<br><br>"); 

 
 client.println("Click <a href=\"/LED1=ON\"><button>here</button></a> turn the PUMP ON<br>"); 
 client.println("Click <a href=\"/LED1=OFF\"><button>here</button></a> turn the PUMP OFF<br>"); 
 client.println("<br>"); 



 client.println("<body style=background-color:dodgerblue>");
 client.println("</html>"); 

 
 delay(1); 
 client.stop();
 Serial.println("Client disconnected"); 
 Serial.println(""); 
    
}

AFAIK, domain names need to be registered. IPs if public should be accessible without any problem from anywhere unless there is IP restriction.

@devilution,

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

Please edit your post, select all code and click the </> button to apply so-called code tags and next save your post. It makes it easier to read, easier to copy and prevents the forum software from incorrect interpretation of the code (e.g. [] vs []).

Hi Rohit,
Thanks for your reply, so based on you reply, domain name need to be registered, it mean registered at arduino such as below ?

`char server[] = "http://xxxxxxxxxxxx.ip-dynamic.com ";`

thanks in advance.

I meant that domain names are mapped to a public IP by a DNS provider (such as godaddy or hostgator, etc). And for browsers or other http clients to be able to get to that IP the domain names are looked up against the DNS provider.

Domain name - Wikipedia.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.