Routing of client and server

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
ankh75613
OpenVpn Newbie
Posts: 3
Joined: Tue Aug 23, 2022 11:06 am

Routing of client and server

Post by ankh75613 » Tue Aug 23, 2022 11:28 am

I want create openVPN tunnel between two VMs and connect from browser on client side to Apache server that starts up on server side.
I write my server.conf and client.conf. Problem is the connection doesn't pass from tunnel.
How should I do routing of server and client that all traffic of client pass through the tunnel?

#server config (ip : 10.0.6.5)
#Network Configuration
mode server
proto tcp-server
dev tun
topology subnet
ifconfig xxxx 255.255.255.0
port 1194
user nobody
group nogroup
persist-key
persist-tun
keepalive 10 120
dh none
tls-server
tls-version-min 1.3
tls-version-max 1.3
ca /home/ca.crt
cert /home/server.crt
key /home/server.key
tls-ciphersuites TLS_AES_256_GCM_SHA384
cipher AES-256-GCM
verb 5

# client config (ip : 10.0.6.4):
#Network Configuration
proto tcp-client
dev tun
pull
remote 10.0.6.5
port 1194
user nobody
group nogroup
persist-key
persist-tun
keepalive 10 120
# Control Configuration (Crypto)
tls-client
tls-version-min 1.3
tls-version-max 1.3
ca /home/ca.crt
cert /home/client.crt
key /home/client.key
tls-ciphersuites TLS_AES_256_GCM_SHA384
cipher AES-256-GCM
verb 5
redirect-gateway local

Thanks in advance, hope somebody help me.

TinCanTech
OpenVPN Protagonist
Posts: 11139
Joined: Fri Jun 03, 2016 1:17 pm

Re: Routing of client and server

Post by TinCanTech » Tue Aug 23, 2022 12:34 pm

ankh75613 wrote:
Tue Aug 23, 2022 11:28 am
How should I do routing of server and client that all traffic of client pass through the tunnel?
--redirect-gateway def1 is the most common solution.

Post Reply