-1

So I have a very simple express http server that returns simple html hosted on 127.0.0.1 and 6550 port that works perfectly in localhost. I will be sharing the code at the end of this post but I don't think it says much.

I want to reach this over my public ip adress but I can not (ERR_CONNECTION_TIMED_OUT). Port also shows closed when checked by online port checking tools.

I have a TP link TD-W9970 modem. This is port forwarding: enter image description here

And this is uPNP: enter image description here

I am absolutely sure I am forwarding to the right local ip and using the right port:

I have noticed that my public ip that I get from google and the one I get from my routers WAN info is different.

My public ip from google : 85.107.**.13

My ip from WAN info from router panel : 100.108.1**.1

I think this may explain the problem?

Can you help me resolve this issue? Thank you

Express code:

const http = require("http");

const hostname = "127.0.0.1";
const port = 6550;

// Create HTTP server
const server = http.createServer((req, res) => {

   // Set the response HTTP header with HTTP status and Content type
   res.writeHead(200, {'Content-Type': 'text/plain'});

   // Send the response body "Hello World"
   res.end('Hello World\n');
});

// Prints a log once the server starts listening
server.listen(port, hostname, () => {
   console.log(`Server running at http://${hostname}:${port}/`);
})
isa türk
  • 99
  • 1

2 Answers2

0

I see two possible things here:

  1. You have a dual-stack internet connection, which would make portforwarding via IPv4 difficult if not impossible.

  2. Also you should make sure your server does not listen on IP 127.0.0.1 but instead 0.0.0.0 (any IP) or your internal network IP of the Adapter, i assume 192.168.1.105 .

Stefan D
  • 36
  • 4
0

Your WAN address, 100.108.1**.1, is not a public address. That is a Shared address (IANA has set aside Shared Address Space in the 100.64.0.0/10 range) that ISPs often assign to residential/home users (off-topic here) in order to save their precious pool of public addresses for business customers. It is basically Private address space for ISPs.

1. Introduction

IPv4 address space is nearly exhausted. However, ISPs must continue to support IPv4 growth until IPv6 is fully deployed. To that end, many ISPs will deploy a Carrier-Grade NAT (CGN) device, such as that described in [RFC6264]. Because CGNs are used on networks where public address space is expected, and currently available private address space causes operational issues when used in this context, ISPs require a new IPv4 /10 address block. This address block will be called the "Shared Address Space" and will be used to number the interfaces that connect CGN devices to Customer Premises Equipment (CPE).

Shared Address Space is similar to [RFC1918] private address space in that it is not globally routable address space and can be used by multiple pieces of equipment. However, Shared Address Space has limitations in its use that the current [RFC1918] private address space does not have. In particular, Shared Address Space can only be used in Service Provider networks or on routing equipment that is able to do address translation across router interfaces when the addresses are identical on two different interfaces.

The ISP does not care that it breaks your service to the public Internet because your residential ISP contract prohibits running services from your network to the public Internet. Your ISP is not going to forward your port on its router with the public address. You need to get a business contract in order to do what you want to do.

Ron Maupin
  • 3,243
  • 1
  • 12
  • 20
  • Thank you so much for the explanation. So what would be the best alternative you can think of to achieve what I need to do. I have used tunneling software negrok which tunnels your port to a public ip it owns but it is slow naturally. Which software can I use to get the fastest possible connection. – isa türk Aug 03 '22 at 18:05
  • Unfortunately, "_product, service, or learning material recommendations_" are explicitly off-topic here. There is [softwarerecs.se] and [hardwarerecs.se]. – Ron Maupin Aug 03 '22 at 18:18