A
A
Asparagales2019-02-14 17:55:34
linux
Asparagales, 2019-02-14 17:55:34

How can I access the Internet from one local computer through another local computer?

There are two regular computers. There is a regular router to which they are connected. Each of the computers can independently access the Internet through a router.
I want to set up a VPN client on computer No. 1, and a VPN server on computer No. 2 (there is CentOS 7). Next, I need to connect via VPN from PC #1 to PC #2 and access the Internet from it. Thus, the scheme will look like this: PC #1 -> router -> PC #2 -> router -> Internet.
If you ask what is the practical meaning of this, then I will say frankly - none. I'm just crazy.
There will not necessarily be openVPN between two PCs, this is just an example. There can be any other type of tunnel between them, SSH for example.
The question is, what and where should I tweak in CentOS on my makeshift "remote server" to make this scheme work? It is also desirable that computers retain the ability to connect to the Internet on their own and independently, since the above scheme will only be applied from time to time.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pfg21, 2019-02-14
@pfg21

If you set the vpn connection metric to a lower value, you will get priority in routing.
those. two connections will offer a route for all addresses. the choice where to send will be at a minimum of the metric.
something like this. If 10.2.2.2 has a smaller metric, then its offer to send packets for 0.0.0.0 with a mask of 0.0.0.0 has more priority.

$ route -n
Таблица маршутизации ядра протокола IP
Destination	Gateway		Genmask		Flags	Metric Ref 	Use Iface
0.0.0.0         10.0.0.3        0.0.0.0         UG   	100    0        0   eth0
0.0.0.0         10.2.2.2        0.0.0.0         UG   	10     0        0   eth2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question