I set up an OpenVPN server on Ubuntu 20.4. I created a client config. By connecting using this config, for example on my laptop and going to google.com, the route will be through the VPN network, which I can verify by going to whoer.net and seeing the VPN address, not the address of my provider. How do I get rid of this?

I need to allow only traffic inside the VPN network, all the rest of the client's traffic should go along the normal route.

My server config:

;local a.b.c.d

port 1194

;proto tcp
proto udp

;dev tap
dev tun

;dev-node MyTap

ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
dh dh.pem
tls-auth ta.key 0

;dh dh2048.pem

;topology subnet


ifconfig-pool-persist /var/log/openvpn/ipp.txt



;push "route"
;push "route"

;client-config-dir ccd

;client-config-dir ccd

;learn-address ./script

push "redirect-gateway def1 bypass-dhcp"

push "dhcp-option DNS"
push "dhcp-option DNS"



keepalive 10 120

tls-auth ta.key 0 # This file is secret

cipher AES-256-CBC

;compress lz4-v2
;push "compress lz4-v2"


;max-clients 100

;user nobody
;group nogroup


status /var/log/openvpn/openvpn-status.log

;log         /var/log/openvpn/openvpn.log
;log-append  /var/log/openvpn/openvpn.log

verb 3

;mute 20

explicit-exit-notify 1

1 Answer 1


Get rid of

push "redirect-gateway def1 bypass-dhcp"

BTW, man openvpn and read documentation.

  • 1
    @igoreliseev if this worked for you, please accept this answer. Accepted answers make Stack Exchange more helpful for everyone. On your screen you will see a grey check mark by this answer. Click it to accept. Mar 30, 2021 at 1:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .