3

I have two related questions:

1- When I see my global IP address in a website like https://whatismyipaddress.com/, which is for example X.X.X.X, I think this is not only mine, and a lot of people who are connected to my ISP may see this IP as their global IP address too. Is this correct? Or this IP is uniquely for me and it only may change in future (for example in my next connection)?

2- Based on the first question (the global IP is not only for me), I want to run a web server on my PC and access it over the internet without a static IP through a server which has a static IP. I think I should be able to do something like that but I don't know how?

Here is what I'm thinking about: https://i.stack.imgur.com/rDovQ.jpg

1- My PC is connected to the server using a socket (something like VPN). PC_SOCKET is connected to SERVER_SOCKET.

2- A client asks a url and the server redirects it to my PC (PC_SOCKET) using SERVER_SOCKET (nginx proxy_pass)

3- PC_SOCKET gives the requested url to my web server (nginx) and gets the response

4- PC_SOCKET sends the response to SERVER_SOCKET

5- SERVER_SOCKET gives the response to nginx

6- The client receives the response

Sorry if I asked this simple question in a complicated way. The only thing that I need is how should I redirect requests between server and my PC.

3
  • You're behind CG-NAT. See this and this.
    – gronostaj
    Mar 31, 2021 at 8:31
  • Thank you, so I should use somethinkg like github.com/fatedier/frp. Mar 31, 2021 at 8:40
  • Many routers support "Dynamic DNS" services which provide a fixed name and they resolve that to your current IP and do all the work for you. Why not use one of those? For example: noip.com/free
    – Mokubai
    Mar 31, 2021 at 8:48

3 Answers 3

3

If your public IP address is shared for you with others, then the ISP is using Carrier-grade NAT. The best way to avoid it is to ask the ISP for a static IP address (this might be a paid option).

If your public IP address is not shared, you could use Dynamic DNS instead of using a static IP address for your site, coupled with Port forwarding from the router to the computer of the server's port. This will let others access your computer by name, rather than by an IP address that might change daily.

Some routers have support for some specific Dynamic DNS suppliers, and you could check which one is supported by your router, then check if a free account will suffice for your needs.

If your router does not support Dynamic DNS or you don't like the ones that it does support, you could use a Dynamic DNS provider such as Dynu. Its free account also provides a free program that runs as a system service on your computer and takes care of keeping your IP address updated on the Dynu DNS servers.

1

The IP you see on whatsmyipaddress is usually your IP, not a shared one for multiple clients. Then you can use a dynamic-DNS service like no-ip.com to setup a static name for your address.

Once done, you have to configure your router to redirect http/https requests to your home server.

3
  • 1
    This is not true, if the ISP is using CG-NAT to share one public address among multiple clients, right?
    – jvda
    Mar 31, 2021 at 10:28
  • 1
    never seen that and anyway, if you can access your webserver using your public address, it means no.
    – darxmurf
    Mar 31, 2021 at 10:31
  • 1
    As you can see from the resolution of this thread, the original poster was actually behind CG-NAT.
    – jvda
    Apr 2, 2021 at 0:04
1

Actually with gronostag comment I found what I was looking for and that is https://github.com/fatedier/frp. I solved my problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .