- Question: Q: Can’t resolve host name
- All replies
- How to Get Hostnames to Resolve over a Mac OS X VPN Connection
- How to Get Hostnames to Resolve using a Mac VPN Connection
- Change your Mac Hostname via Terminal
- How to Change Host Name on Mac from the Command Line
- Another Method for Setting the Mac Hostname
- Checking the Current Mac Hostname from the Command Line
- Setting a Temporary Hostname Change
Question: Q: Can’t resolve host name
This is similar to another thread under OS X 10.4, but I followed it to its conclusion to adding my DNS domain in the search, and it was already there (supplied by my server). I still can’t resolve from my Mac.
I have a Windows network (the Macbook is my first of many Macs). When I ping either host name, or host name with fully-qualified domain name (FQDN), I get:
jimerman$ ping Wkstn8
ping: cannot resolve Wkstn8: Unknown host
Jay-Imermans-MacBook-Pro:
If I go to System Prefs > Network > Advanced > DNS, my Windows server appears by IP address, and the search domain is correct.
All of my PCs can resolve host names no problem. The Windows server is the only DHCP server on the network (the wi fi router has DHCP disabled).
Hopefully someone will have an idea?
Macbook Pro, Mac OS X (10.6.2)
Posted on Dec 8, 2009 7:25 PM
All replies
Loading page content
Page content loaded
Dec 8, 2009 7:27 PM
Dec 9, 2009 6:31 AM
Dec 9, 2009 10:26 AM
I frequently have this problem but have a solution, at least to how it manifests on my MBP. The problem occurs for me when I work on a client site who uses DHCP for client laptops. When I go home and plug into my home LAN, the DNS servers and domain list from home router cannot override the settings from the work site which remain. The way to check this is to open network preferences, click on your network connection type (LAN or Airport) then use the advanced button. Now select the DNS tab. If the entries for dns servers and domain name appear in bold font they are probably wrongly persisted ones.
Either use a DHCP renew to clear (and/or) if that doesnt work, manually select the entries and press the minus key to remove them. Once the entries are gone try a dhcp renew and the correct values should appear in read only colour.
Also be aware that there is another issue where you may have set DNS entries in another network location, which then override your current location. Only solution there is to cycle through the Advanced / DNS tab for each location and delete incorrect entries manually before recycling DNS.
Hope that helps,
Dec 9, 2009 11:02 AM
Thanks Paul. I actually resolve it by renewing DHCP too, but the problem never occurred before Snow Leopard, which makes me think that the system calls got screwed up somewhere along the way. I don’t have multiple network locations, so it doesn’t apply, although it’s helpful to know about that being a potential problem.
Thanks for the response!
Dec 9, 2009 12:59 PM
Have the same problem. 10.6.2
nslookup is able to resolve host names
ping is NOT able to resolve host names
non of the browsers are able to resolve host names
Skype will work just fine, including voice calls
Tried DHCP renew, tried putting in public DNS servers (Google), deleting them — nothing helps.
The only solution is to restart my computer, than everything works just fine.
May happen even when I close my computer for a while, open it up again, and need to restart it to connect to Internet correctly. Happens both at home (D-Link Wifi router), and at work (variety of LinkSys routers).
Never happened to me before, even on Snow Leopard, but started showing up regularly now.
Dec 9, 2009 11:41 PM
Dec 10, 2009 1:51 AM
Dec 10, 2009 3:36 AM
Argh — sorry about that.
If nslookup can resolve addresses but Mac OS X routines cannot, the problem most likely lies in the list of DNS servers being provided either manually or via DHCP.
Whether due to a bug or design, Snow Leopard occasionally alters the order in which it will consult DNS servers if more than one is listed. This is non-intuitive and different from how BIND-based programs like nslookup work.
For example, say you specified DNS servers in this order:
BIND-based utilities like nslookup would always use 1.2.3.4 for lookups, using 5.6.7.8 only if queries to 1.2.3.4 failed.
However for whatever reason, Snow Leopard’s mDNS resolver, which is responsible for all non-BIND DNS lookups, will occasionally direct all queries to 5.6.7.8. If 5.6.7.8 is configured such that it gives a NXDOMAIN response to a query 1.2.3.4 could resolve, DNS resolution will fail in the manner you’ve described.
Dec 10, 2009 6:37 AM
Dec 10, 2009 6:49 AM
Jan 7, 2010 6:39 PM
Your analysis is interesting, thank you. I am not sure this solves the problem though. I wonder if anyone at Apple is tracking these posts to track down the problem.
Thanks again for your help
Alex
Jan 17, 2010 6:56 AM
Depends on the problem, Alex.
Many with this problem have tracked it down to having multiple DNS servers specified, one of which could resolve the address and one that could not.
Jan 17, 2010 7:29 AM
Jan 21, 2010 7:40 PM
Thank you, thank you, thank you!
I’ve been living with this for a while now (at least since 10.5.5), and didn’t take the time to research it. I would either just live with it, or reboot to fix it for a while.
What happens to me is that I run my own DNS server and DHCP server on an OpenBSD box that also acts as router/gateway/firewall. Well, I’ve been serving up 3 DNS servers via DHCP for a while; mine, and two that my ISP runs just in case. Mine was always primary, so should always handle requests. Usually it worked. Before having my MBP Unibody, I had an XP box which never had any DNS issues with the same OpenBSD box.
So, to resolve it, I removed the external DNS servers from the DHCP configuration. Now, it works!
What saddens me is that it seems that as time goes on, Apple breaks more and more standard *NIX functionality. DNS resolution has standards which state that you should only use backup DNS servers if the primary is unavailable. I don’t believe earlier versions of OS X had these problems. I used to have a PB Ti and never had these issues, with the same DNS/DHCP configuration. They also broke their mail client when it comes to relaying email through an SSH tunnel. It worked fine in 10.1, but broke in 10.2 and onward. I haven’t checked in a while, but I wouldn’t be at all surprised if it were still broken.
One of the reasons I like OS X is that it’s based on UNIX, not something proprietary. I just wish they’d quit making their version proprietary, thus ignoring standards. Stop being like Micro$oft, already! 🙂
Источник
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 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:
- By name – mycomputer
- By fully qualified name – my computer.mycompany
- 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.
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.
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.
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.
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).
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:
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!
Источник
Change your Mac Hostname via Terminal
Need to change the hostname of a Mac? For most people if you want to change your Mac computer name you just do it through the Sharing system preference, it’s quick and very easy. For those of us that are more geekishly inclined, we like to do things through the Terminal.
This tutorial will show how to change your Mac hostname with the command line and make the setting change permanent (well, permanent until you change it again):
How to Change Host Name on Mac from the Command Line
To get started, launch the Terminal application in Mac OS and then use the following command syntax:
sudo scutil –-set HostName new_hostname
Simply replace new_hostname with whatever you want your hostname to be changed to, for example I want to change a Mac’s hostname to MacBookPro, I will use this command:
sudo scutil –-set HostName MacBookPro
(Note the “–” before set is two dashes next to each other, –set)
You will be asked for your admin password since you’re using the sudo command.
Another Method for Setting the Mac Hostname
With modern MacOS releases from Mac OS X Mavericks and newer, you can also use the hostname command with a flag to set the hostname to be permanently changed:
sudo hostname -s YourHostName
Again, sudo requires admin privileges to complete the job.
Checking the Current Mac Hostname from the Command Line
After the above command is executed you can verify that the changes took place by typing:
If you want to watch this done, the short video below walks through the steps by using scutil:
Setting a Temporary Hostname Change
You can also set a temporary hostname change by using the following command:
sudo hostname new_hostname
This particular approach is temporary and will reset itself after your Mac reboots though, so if you want a permanent hostname change, use the above command instead. You can still use the hostname command but it will require the -s flag as discussed in the aforementioned instructions. Thank you to commenter Jim for pointing this out!
That’s all there is to it. By default Mac OS X will usually assign the hostname as whatever the admin account username is. Changing your Mac’s hostname can make it easier to find your Mac on a network and to connect to.
Источник