W
W
wilwill2019-12-31 18:17:49
openvpn
wilwill, 2019-12-31 18:17:49

How to set up an openvpn server so that clients go to one site on the Internet through the ip of the openvpn server?

I have a working openvpn network to access local network resources via the Internet.
What settings need to be added so that openvpn clients go to one Internet server (for example, to myip.ru/) through the ip address of the vpn server.
It is desirable that these settings be in the vpn server config, but in the client config it will also work.
Tell me please.
Client config:

remote 176.37.xx.xx 1194
client
proto tcp-client
dev tun
ca vpnca.crt
cert client-pqr.crt
key client-pqr.key

comp-lzo
user nobody
group nobody
persist-key
persist-tun
verb 3

openvpn server config:
port 1194
proto tcp-server
dev tun
client-to-client
tls-server

ca pki/vpnca.crt
cert pki/vpn-node.crt
key pki/vpn-node.key
dh pki/dh2048.pem

server 192.168.2.0 255.255.255.0
push "dhcp-option DNS 192.168.2.1"

keepalive 10 120
comp-lzo
max-clients 10
persist-key
persist-tun
user nobody
group nobody
status /var/log/openvpn-status.log
log-append /var/log/openvpn.log
verb 3
sndbuf 0
rcvbuf 0
client-config-dir clients

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2019-12-31
@Tabletko

You need to give clients a route to the required site through your vpn server. Openvpn can do that.

R
res2001, 2019-12-31
@res2001

push "route IP MASK"
where the IP and MASK is the subnet address and mask where your server is located. The route to the specified network is written on the client side, the VPN server will be the gateway.
By the way, I recommend using UDP for VPN, not TCP. It works much faster, this is especially true on bad communication channels.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question