Answer the question
In order to leave comments, you need to log in
How to unite all small local networks into one big one and live happily ever after?
Welcome all! Faced with my own stupid - not the first time, but this time he is stronger than usual, so I ask for help!
So, there are:
1) VPS with a raised OpenVPN server and, of course, with a white IP address, accessible from anywhere on the Internet. The OpenVPN server is configured for the TAP interface, the subnet is left default, that is, 10.8.0.0
2) Router 1 (R1) with a gray IP address outside and 192.168.1.1 inside the local area, which still has PC1 and PC2 - 192.168.1.2 and 192.168 .1.3, respectively
3) Similarly, router 2 (R2) with a gray IP address outside and 192.168.1.100 inside the local area, in which there are still PC3 and CAM1 IP camera - 192.168.1.4 and 192.168.1.5, respectively
4) Smartphone S1, surfing Network via MTS, with a black IP address, respectively.
---
What has already happened:
1) Router R1 is connected via OpenVPN to VPS, and redirects all traffic-to-Internet (including client traffic from PC1 and PC2) through it.
2) The R2 router is connected via OpenVPN to the VPS, and does not redirect traffic-to-the-Internet through it.
3) The S1 smartphone is connected via OpenVPN to the VPS, and wraps all traffic-to-the-Internet through it.
---
What does not work (or rather, does not seem to):
1) Combining all devices into one large virtual local area network. So that, therefore, all devices are visible to each other under their local addresses, and feel "at home", that is, in the sense of being in a local area. Smartphone S1, it turns out, needs to somehow give out such an address, for example 192.168.1.111.
Here's how to correctly implement what you want?
2) At the same time, there is such a moment: sometimes on PC3 it will be necessary to enable an OpenVPN connection to the VPS with a traffic-to-Internet redirect: without disconnecting the R1 router from the VPN, and, accordingly, CAM1 from the VPN.
Here I am confused by a possible conflict of IP addresses.
Answer the question
In order to leave comments, you need to log in
A VPN connects multiple local networks and/or devices over a global network.
The subnets must have different IP addresses so that hosts can distinguish the ip addresses of the local network from the ip addresses of remote networks.
Let's say a computer with the address 192.168.1.5 is connected to R2, and wants to send a packet to a host that is in R1's network and has the address 192.168.1.10. The computer compares the destination ip with its own, sees that the first 3 octets match, thinks that the target host is on the local network, and sends the packet to the router instead of the VPN.
Read about the netmask on the Internet, why it is needed, and how it works
Give out not 10.8.0.0, but 192.168.2.2-192.168.2.254 - something from this range and with such a mask 255.255.255.255
Here is an interesting example.
https://help.keenetic.net/hc/ru/articles/213967789...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question