I'm using OpenVPN through Tunnelblick on MacOS X Lion.

I need to set specific DNS (with local IP, which works only when VPN is up) for the duration of this VPN session only.

I do not have access to the OpenVPN server configuration. Only client config. Also, DNS from the server doesn't work.

So it works like this: I connect to VPN, go the Network preferences and manually set DNS. After VPN is disconnected, I switch back to default. It works, but it needs to be automatic.

After some exploration I found that OpenVPN up- and down- scripts might help me with that. Unfortunately, I haven't found any specific documentation about how exactly it can be done.

How it can or can't be done? Any advice would be appreciated!

  • I've also considered ControlPlane app - no luck figuring it out :-) Aug 12, 2012 at 13:11
  • @quanta Nice, but I'll have to list all domains - that's too much :-( (We have a few dozens of domains in our developer infrastructure.) Aug 12, 2012 at 14:38

3 Answers 3


try adding:

# put actual dns name here
dhcp-option DNS

to your client's config

  • 2
    Thank you! It worked. I've stumbled upon push "dhcp-option DNS" regarding server configs, didn't know how to convert it to client configs. Thanks again :-) Aug 12, 2012 at 15:09
  • this works, but still in openvpn I can see my local DNS still gets pushed: DNS servers '' will be used for DNS queries when the VPN is active NOTE: The DNS servers do not include any free public DNS servers known to Tunnelblick. This may cause DNS queries to fail or be intercepted or falsified even if they are directed through the VPN. Specify only known public DNS servers or DNS servers located on the VPN network to avoid such problems.
    – meso_2600
    Jun 21, 2017 at 12:00
  • And how, exactly, does one change the Tunnelblick configuration in Mac OS? Is this command line or GUI? Apr 24, 2023 at 23:30

If you (unlike the OP) have access to the OpenVPN server configuration, you can add this option in your OpenVPN server.conf if you want to push for all the clients:

push "dhcp-option DNS"

You can change the to your desired DNS.

  • 4
    OP is clearly saying that he doesn't have access to the server configuration. Oct 14, 2018 at 18:37
  • 2
    why is this still getting upvotes? clearly the a wrong answer, push inside a client conf doesn't work
    – xiamx
    Jun 4, 2019 at 21:02
  • 1
    BCS "if you have access to the OpenVPN server configuration"
    – Petr
    May 13, 2020 at 9:36

add this to client config file:

pull-filter ignore "dhcp-option DNS"
pull-filter ignore "dhcp-option DNS6"
  • This fixed the 'no internet connectivity detected' issue with many Windows 10 apps (like Word, Excel, Outlook, Store Apps) for me. Was using OpenVPN, traffic routed over VPN with a custom DNS over VPN.
    – lvmeijer
    Jan 6, 2020 at 9:48
  • Just from looking at it it looks like it is ignoring the DNS server that is applied from the server. This means that the client will leak DNS requests outside the tunnel.
    – bomben
    Oct 8, 2022 at 12:02

You must log in to answer this question.

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