How can I configure openvpn server without push default gateway?

Solution 1:

This is a client setting.

For Linux clients, in NetworkManager: Edit Connections -> VPN -> (select the vpn configuration you would like to edit) -> Edit -> IPv4/IPv6 -> Routes -> Check the box that says "Use this connection only for resources on its network"

Solution 2:

Simply do not add the redirect-gateway in the client or server configuration and the default gateway will not be changed.

Solution 3:

route-nopull in the .ovpn file, or --route-nopull on the command line.

You'll then have to set up the routes yourself, of course.

Solution 4:

I found that removing

resolv-retry infinite

from my client.conf stops pushing default route from server.