How to add in vpn client file

I'm trying to add this in my vpn client config file, but it doesn't like it.
How to do it the right way?

option pull_filter ignore 'dhcp-option DNS'
option dhcp_option DNS '46.227.67.134'
option dhcp_option DNS '192.165.9.157'
option dhcp_option DOMAIN 'home.lan'

To stop getting the pushed DNS servers by the OpenVPN server add to conf file: **pull-filter ignore "dhcp-option DNS"**
To set your own DNS servers to use when the tunnel is up, add in the openvpn conf file: **dhcp-option DNS ip-address-DNS-server**
To set your own search domain to use when the tunnel is up, add in the openvpn conf file: **dhcp-option DOMAIN my-search-domain** 

But this working just fine.

option up /etc/openvpn/FILE TO MY UP FILE
option down /etc/openvpn/FILE TO MY DOWN FILE

Not sure if these options are supported, I never used LuCi but simply import the openvpn.conf and edit that directly with the Edit button so you can just use all the configuration options from the man page

1 Like

If I import openvpn.conf (openvpn.ovpn) and add files in OVPN config file it seems to working.
I can see i logfil pushed dns severs from vpnprovider is suppressed.
I have tested to them in client config file but get error, not sure it only Lucy not accept it or vpn-client not running.

This working in openvpn.conf file:

pull-filter ignore 'dhcp-option DNS'
dhcp-option DNS 46.227.67.134
dhcp-option DNS 192.165.9.157
dhcp-option DOMAIN home.lan
2024-12-02 21:22:53 Pushed option removed by filter: 'dhcp-option DNS 192.165.9.158'
2024-12-02 21:22:53 Pushed option removed by filter: 'dhcp-option DNS 46.227.67.134'

Is this the right way to configure luci and configfile?

Tested this in config openvpn. /etc/config/openvpn

option pull_filter ignore 'dhcp-option DNS'
option dhcp_option DNS 46.227.67.134
option dhcp_option DNS 192.165.9.157
option dhcp_option DOMAIN home.lan

How do I choose which selected client, eg change check mark?

wan/eth1/100.69.0.1
OpenVPN/tun0/10.128.0.27
OpenVPN2/tun1/10.129.0.61 ✓

It probably does work better to import the .ovpn file and make any configuration changes in native format, especially if the VPN service provides a .ovpn file for you.

If you go with UCI format all the option text needs to be in quote marks so it parses as one "word" like this:
option pull_filter "ignore 'dhcp-option DNS'"
The single quotes should be copied literally when nested inside double quotes. But again if you have a .ovpn file the only thing needed in /etc/config/openvpn is an option config pointing at that file. Note that any additional UCI options are ignored when there is a .ovpn file in use.

I'm not sure what the third part of your question is. If you're talking about choosing one server to use from multiple ones that are configured, this would be done with multiple config openvpn sections in /etc/config/openvpn, with only one of them having option enabled 1 and the others enabled 0. Selective enabling is supported with Luci as well.

Thank you for your answere.

I got this to working openvpn config file:

option pull_filter "ignore 'dhcp-option DNS'"
option dhcp_option 'DNS 46.227.67.134'
option dhcp_option 'DNS 192.165.9.157'
option dhcp_option 'DOMAIN home.lan'
What i mean is, how to choose betwean "✓" when both clients are runnig?
wan/eth1/100.69.0.1
OpenVPN/tun0/10.128.0.27 <<== ex move it here.
OpenVPN2/tun1/10.129.0.61 ✓ <<==

There's no reason to keep two clients open if you're only going to use one for all traffic. If you do want a more complex scenario than just "checking" one-- e.g. use one VPN for some traffic and the other for others, or VPN some and direct to wan with others, that is a good use case for the policy based routing (pbr) package.

1 Like

Okey,
I do use PBR packages and routing is working, can direct to differnt user/ipnumbers.
But it seems there is DNS leak. I using "ovpn-update-resolv-9" from " from Stangri repo and that packges seems to working fine.

1 Like

Yes that is a nice solution to stop a possible DNS leak :wink:

1 Like

Update:
I just need this to avoid DNS leaks:

option up /etc/openvpn/ovpn-update-resolv-9
option down /etc/openvpn/ovpn-update-resolv-9

This is not needed:

option pull_filter "ignore 'dhcp-option DNS'"
option dhcp_option 'DNS 46.227.67.134'
option dhcp_option 'DNS 192.165.9.157'
option dhcp_option 'DOMAIN home.lan'

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.