How to Get Hostnames to Resolve over a Mac OS X VPN Connection

Yesterday I ran into a little issue. I tried to use my Cisco VPN client on my Mac after having upgraded to Lion. For some reason, it was not working. I did find some ways to correct that (the Error 51 issue) and how to migrate your Cisco setting over…

Written By
Michael Sheehan
Published On
August 4, 2011

Yesterday I ran into a little issue. I tried to use my Cisco VPN client on my Mac after having upgraded to Lion. For some reason, it was not working. I did find some ways to correct that (the Error 51 issue) and how to migrate your Cisco setting over to the native Mac OS VPN client, but that will be the subject of another post. This post is about another issue that I seemed to have resolved where when using my VPN, none of my hostnames were resolving, fully qualified or shortened ones weren’t working, only using an IP address.

You might not think that this is a big deal, but for me it is because it is hard to remember IP addresses and if you have a DHCP environment, sometimes those IP addresses change. If all of this sounds like greek or geek-speak to you, let me try to explain it quickly. You can access a computer if you are on the same network in several ways:

  1. By name – mycomputer
  2. By fully qualified name – my computer.mycompany
  3. By IP address – 192.xxx.xxx.xxx

When you are on the same network, you have routers and DNS servers that translate the name that you put in and convert it into an IP address. This is much the way that the internet works; domains translate into public IP address. If your network is set up properly, and you are on that network, you can just type in the name of your computer (e.g., in a Remote Desktop Application) and you “should” be able to connect. If you can’t, your internal networking might not be working right. But, if you have the IP address of your machine, you can always use that to connect.

- Advertisements -

Side note: To get a machine’s IP address, all that you have to do is “ping” that computer by simply issuing the command ping mycomputer and it would (hopefully) respond back. In the ping process, I could get the IP address of that machine, for this example, let’s say that it’s 192.168.1.10.

The issue for me was that when I used Remote Desktop to connect to my computer, when I was at work, I could just user mycomputer in the name field. But when I was doing it remotely (via the VPN), my connection would simply timeout. However, if I put in the IP address of my machine (e.g., the 192.168.1.10) and had the VPN on, I could successfully connect. The problem was, I didn’t always know the IP address of the machine that I wanted to connect to. I really wanted to use a hostname.

How to Get Hostnames to Resolve using a Mac VPN Connection

Anyway, I thought that I would cut to the chase. With a couple of configurations, I was able to get my VPN connection to work with just the computer name, and no need to type in mycomputer.mycompany.com  or the IP address.

A quick note: while this configuration worked for me, it might not be 100% successful for you as it really depends on how your network administrators have set up the routing within your organization.

First, set up your VPN connection. The one shown below is a PPTP VPN network connection using the built-in Mac OS X Lion VPN.

vpn_config

Each company may have a different type of setting. In the example above, I put in our VPN server address (e.g., vpn.YOURCOMPANY.com). Then you enter your Account Name and then the Encryption level (I chose Automatic). After that, click on the Authentication button and enter in your Password or whatever is proper based on what your network admins have told you.

With this configuration, you should test the connection and make sure that it connects. If it doesn’t, you need to double-check your settings. If it does, and you know that fully qualified name of a server in your network (e.g., you are at home and want to connect to a server at work), type in the name (only) of that server. You can also ping that server to test. In the image below, you can see that I tried to ping just the server name (“skynet”) and that server couldn’t be found or it timed out. Then I tried a fully qualified name (“skynet.MYCOMPANY.com”) and it too timed out. If yours works, then you are lucky and you can probably skip the rest of the steps below.

vpn_ping_no_routetraffic

The next thing that you should try is to enter a SEARCH DOMAIN into the Advanced configuration area. What this does is it appends whatever domain you put in to the machine name. So, if you ping mycomputer and you have a Search Domain of my company.com in the Search Domain, it will make the server name full: mycomputer.mycompany.com. Try adding that config and doing the ping process again.

vpn_search_domain

See if and where you get timeouts. If you still get them, you will want to try the step below. If everything responds back, you probably can stop here.

The next setting you would want to try is also in the Advanced section. Go there and under Options,  select SEND ALL TRAFFIC OVER VPN CONNECTION. This is important, especially if your subnet or IP block that you are using is the same on both networks (e.g., your remote network and work network). Also, by sending all of your traffic through the VPN connection, all your transmissions are more secure. There are plenty of cases though where when you create this secure VPN tunnel, traffic to the Internet in general may time out (I didn’t run into this issue with my particular setting – it could be something that your network administrator needs to enable on the VPN router itself).

vpn_send_all_traffic

Note: Remember, that each time you make a change to the configurations, you will need to APPLY them and then Disconnect and (re)Connect your VPN connection.

Try the ping process again with the “Send all traffic over VPN connect”. This is what I got when I tried it:

ping_server_success

So with just a few additional configurations, I was able to get my Mac OS X Lion VPN connection working and resolving hostnames fully. To recap:

  • Configure your basic VPN settings
  • Add a “Search Domain”
  • Check the “Send all traffic over VPN connection”

I’m planning on writing a post soon on how to convert your Cisco .pcf file into just using a Cisco IPsec connection within the Lion VPN client. In my case, I didn’t need to do this, but I will test this out regardless.

I’m curious, did these VPN connection tips work for you? If so, please leave a comment. If they didn’t, feel free to ask some questions (although I’m not really a VPN expert and it took me a while to figure this “simple” fix out), but I will try my best to answer.

HTD says: VPN connections are great and extremely helpful…but only when they work!

- Advertisements -