Answer the question
In order to leave comments, you need to log in
How to connect to a device on a local network from the Internet through a server purchased from a provider?
I want to make it so that I can connect to a device on the local network behind NAT (no white IP) from the Internet through a server / vps purchased from a provider.
There is a computer (let's call it K1) at the local address 192.168.1.10, for example. And I have my own VPS with a white IP (let it be 88.77.66.55). It is required to make sure that K1 has ports 80, 443, and all ports from 1000 to 65535 are visible at the VPS address with the corresponding port. The whole local matter is behind the keenetic ultra router, although I can add mikrotik hap or another necessary router up to 3-4k at a price (but if there is an opportunity without it, it will be great)
That is, I make a request to 88.77.66.55:8080 and I get a response from K1 from port 8080. And all other ports are the same.
Does anyone have a ready-made tutorial on how to set it up or can you advise where to start digging and in which direction (maybe some articles) or what functionality can help me solve this need?
Answer the question
In order to leave comments, you need to log in
You need to
- raise the VPN between 88.77.66.55 and 192.168.1.10
- let the addresses inside the VPN be 10.200.200.1 and 10.200.200.2
- set up forwarding from the address 88.77.66.55 to 10.200.200.2
As a VPN, I recommend Wireguard, the easiest to set up.
Below is an approximate minimum config, do not forget about security (close unnecessary ports). Don't forget to change $WAN$ to your interface. It is important that when forwarding ports, all traffic from 192.168.1.10 would go through the VPN or use nginx-proxy on 88.77.66.55.
This is done not by forwarding ports "from the VPS address", but by banal VPN settings - so that both devices between which data transfer is needed are on the same network. Take any guide from Habr, even OpenVPN, even Wireguard.
If NAT makes a device under your control, you can configure port forwarding inside the network. This can be done for the whole world (i.e. anyone can connect to a device on the local network ); or not for everyone, but for selected IP addresses.
You can configure not port forwarding, but an SSh tunnel. The manual is on Habré, search for the word "ssh". Both your VPS and a device on the local network can initiate an SSh tunnel .
You can set up a VPN from a device on the local network to your VPS. The VPN connection must be initiated by a device on the local network .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question