I use Tunnelblick 3.3beta21b on Mac OS X 10.8.2 (Mountain Lion) to connect to a pfSense/OpenVPN virtual private network. When connected to the VPN, I can access machines in our datacenter. This is pfSense 2.0.1.
Machines in the datacenter are running Ubuntu 12.04 Precise. When I'm on a machine in the datacenter, I can ping other machines with short (not fully qualified) hostnames:
web1:~ $ ping web2 PING web2 (10.10.160.6) 56(84) bytes of data. 64 bytes from web2 (10.10.160.6): icmp_req=1 ttl=64 time=0.380 ms
The resolv.conf file on any given Ubuntu machine in the datacenter looks like this:
web1:~ $ cat /etc/resolv.conf nameserver 10.10.160.2 nameserver 10.10.160.45
Unfortunately, when I'm at home connected via TunnelBlick/OpenVPN, shortnames do not work from my Mac:
mac:~ $ ping web2 ping: cannot resolve web2: Unknown host
However, nslookup returns the correct IP address for "web2" and if I ping with a trailing dot, it works:
mac:~ $ ping web2. PING web2 (10.10.160.6) 56(84) bytes of data. 64 bytes from web2 (10.10.160.6): icmp_req=1 ttl=64 time=0.380 ms
When connected via Tunnelblick, my Mac's resolv.conf looks like this. Note that Tunnelblick added the "search" line; it is not present when I'm disconnected from the VPN:
# # Mac OS X Notice # # This file is not used by the host name and address resolution # or the DNS query routing mechanisms used by most processes on # this Mac OS X system. # # This file is automatically generated. # search company.com nameserver 10.10.160.45 nameserver 188.8.131.52
How can I configure Mac OS X or Pfsense/OpenVPN or Tunnelblick so I can use short hostnames from my Mac?