1

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

server 10.8.0.0 255.255.255.0

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

;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100

;server-bridge

;push "route 192.168.10.0 255.255.255.0"
;push "route 192.168.20.0 255.255.255.0"

;client-config-dir ccd
;route 192.168.40.128 255.255.255.248

;client-config-dir ccd
;route 10.9.0.0 255.255.255.252

;learn-address ./script

push "redirect-gateway def1 bypass-dhcp"

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

client-to-client

;duplicate-cn

keepalive 10 120

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

cipher AES-256-CBC

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

;comp-lzo

;max-clients 100

;user nobody
;group nogroup

persist-key
persist-tun

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

2

Get rid of

push "redirect-gateway def1 bypass-dhcp"

BTW, man openvpn and read documentation.

1
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.