Ubuntu 20.04 Networkmanager OpenVPN: accept pushed DNS but don't route all traffic to tun interface

Solution 1:

After some additional "research" (mainly trial and error) I was able to successfully connect to the remote site via network manager while only routing traffic of the pushed routes and using the pushed dns server.

  1. Setting the vpn connection in network manager to neverdefault (as already discussed in OP):

    nmcli c modify <connectionname> ipv4.never-default yes

  2. Setting the connection dns-search to the internal domains of the remote site:

    nmcli c modify <connectionname> ipv4.dns-search <domainname>

This option makes networkmanager somehow add the DNS server in run/systemd/resolve/resolv.conf again (adds, not overwrites), despite of ipv4.never-default being active.

Alternatively, <domainname> can be replaced with ~. which will lead to an overwrite of run/systemd/resolve/resolv.conf and thus makes the pushed DNS server the only one answering all dns requests.