D
D
DigitalGod2019-07-11 16:07:51
openvpn
DigitalGod, 2019-07-11 16:07:51

How to send traffic through OpenVPN to a specific IP?

Good day.
Asus router available. You need to set up an OpenVPN server on it in order to gain access to the local network, as well as to send traffic through it to specific IPs on the Internet.
The config looks like this:

daemon ovpn-server1
topology subnet
server 10.8.0.0 255.255.255.0
proto udp
port 1194
dev tun21
txqueuelen 1000
ncp-ciphers AES-128-GCM:AES-256-GCM:AES-128-CBC:AES-256-CBC
cipher AES-128-CBC
keepalive 15 60
verb 3
push "route 192.168.10.0 255.255.255.0 vpn_gateway 500"
client-config-dir ccd
duplicate-cn
tls-crypt static.key
plugin /usr/lib/openvpn-plugin-auth-pam.so openvpn
ca ca.crt
dh dh.pem
cert server.crt
key server.key
script-security 2
up updown.sh
down updown.sh
status-version 2
status status 5

I see the local network, everything is fine. If I add push "redirect-gateway def1"- the whole traffic goes through vpn. I try to set a specific IP - push "route IP 255.255.255.255 vpn_gateway"- the server immediately becomes unavailable.
I do not understand in which direction to dig? It seems that you just need to register a route to IP through a vpn gateway?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Radjah, 2019-07-11
@Radjah

And on the receiving side, forwarding is configured so that packets from tun are transmitted further?

E
Evgen, 2019-07-11
@etaliorum

this seems to need to be done on the router itself, and not in the openVPN configs, by routing, marking packets, nats, etc.

K
ky0, 2019-07-11
@ky0

push "route 1.2.3.4 255.255.255.255"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question