R
R
RZYR2020-04-06 16:34:58
openvpn
RZYR, 2020-04-06 16:34:58

How to disable connection via OpenVPN only for certain sites?

There is an OpenVPN server.
The config is configured so that all connections go through it:
push "redirect-gateway def1 bypass-dhcp"

How to configure the server or client config to exclude some sites, i.e., so that the connection to them goes bypassing the VPN

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Markus Saar, 2020-04-06
@RZYR

Remove redirect-gateway def1, after which you can add your own rules.
The redirect-gateway def1 parameter is an abbreviation for several rules, by default it matches:

route remote_host 255.255.255.255 net_gateway
route 0.0.0.0 128.0.0.0 vpn_gateway
route 128.0.0.0 128.0.0.0 vpn_gateway

You can add any routes in the same way:
route {ip} {маска} {шлюз}
You can also change the routing of the system itself.
For example, if you need to connect directly to IP XXXX, run the command:
route add X.X.X.X mask 255.255.255.255 Y.Y.Y.Y, где Y.Y.Y.Y — IP-адрес шлюза.

If you are using a router, then the gateway address will be the IP of the router.
With the ability to use the route command, you can set any routing scheme and even change the default gateway. If you want to delve into the route command, start with this article .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question