A
A
Andrey Fedorov2014-08-08 13:51:17
linux
Andrey Fedorov, 2014-08-08 13:51:17

How to open some site only through VPN (linux)?

I have vpn configured and I want some of the traffic to be configured vpn (when connected).
as I understand it, there are two options, configure it on the client machine or on the vpn itself.
But it doesn't move any further. Tried iptables, didn't work.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Podporin, 2014-08-08
@4b65696e

You can make a static route on the client after connecting to the VPN:
route add -host ip_ресурса gw ip_gatewayor
route add -host ip_ресурса gw dev ppp0

W
white_panda, 2014-08-14
@white_panda

If you need it specifically for sites, then I did it very simply with OpenVPN: on the client in the .ovpn file, I added the lines

route example.ru
route example.com

And now, no matter what IPs these domains resolve to, traffic to them will always go through the VPN, if it is connected.

V
Valentine, 2014-08-08
@vvpoloskin

Option one: where the VPN is configured, we raise the proxy and configure routing to the necessary resources through the necessary interfaces
Option two: we raise the VPN client on the local machine to the desired server, and on it we configure routes to the necessary resources.

I
Ivan Kiselev, 2014-08-08
@homelessness

The simplest option, which does not require any quirks, but is completely inflexible, is to
register in the /etc/hosts file the correspondence of the domain name - the address in the VPN network:
This option is suitable only for sites, and no more services.
The option is being considered when the web server with the site is also in the VPN network. If the traffic through the VPN must go outside the private network, you need to think about routing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question