PDA

View Full Version : Can't connect to local IP addresses, or domain names, but can ping them.


mclii
09-07-2004, 10:56 AM
Hey,

I was wondering if anyone could shed some light on why I can't connect to local IP addresses or domain names through a web browser, but I can ping them.

It's kind of strange actually, let me describe it a bit for you. I can see the "main" domain, so if I type in 'http://www.maindomain.com', everything loads fine. However, if I type any other of the subdomains (that I actually need to get to), I can't see them, like 'http://info.maindomain.com'. I have to hop on over to a Windows box in order to see these, but neither of the OS X machines can see these addresses.

What's even stranger, is that while it's waiting to contact 'http://info.maindomain.com' the address in the Safari browser window changes to 'http://www.info.maindomain.com', and then back to 'http://info.maindomain.com', and then says it can't connect to that server.

Stranger still, to me, is that I can ping 'http://info.maindomain.com' and get an IP address.

I can see that address through the ping command, so I figure, why not just enter the IP address in the web browser? That should fix it...

Well, I enter the IP address that I got from the ping command, and it does the same funkiness described above, waits for a bit, adds 'www' before the IP address, then switches back, and then says it can't connect to the server.

Weird.

Does any of that make any sense? Let me know if anyone needs more info. It's as clear as mud to me!

Las_Vegas
09-07-2004, 11:13 AM
The 'feature' of adding the prefix 'www.' and sufix '.com' when the first try fails is part of Safari (Very handy IMO). As to your problem, it might help if you could give us a real example than we could test. Have you tried accessing that page with IE 5?

Las_Vegas

hayne
09-07-2004, 11:18 AM
The strangeness you see with Safari is it trying to find a URL that works when the first one doesn't. I.e. normal.

It is strange that you can resolve the IP address when doing 'ping', but not with Safari, given that your Windows machine can get to the web site.
Otherwise I would have said that the problem was that the Mac's DNS settings are not correct.

When you ping the hostname, does it resolve to an internal IP address or an external one?

waked1
09-07-2004, 11:28 AM
Have you got any proxies set up in Safari?

mclii
09-07-2004, 11:58 AM
The 'feature' of adding the prefix 'www.' and sufix '.com' when the first try fails is part of Safari (Very handy IMO). As to your problem, it might help if you could give us a real example than we could test. Have you tried accessing that page with IE 5?

Las_Vegas

Thanks for suggesting the testing of IE5, but that didn't work either. Just said there's been a connection error.

As far as a real world example of this, it's tough to do, as I only experience it when I'm at work on the network here, and only on the two OS X machines. For whatever reasons, all of the Windows boxes see it fine. *shrug*

The strangeness you see with Safari is it trying to find a URL that works when the first one doesn't. I.e. normal.

It is strange that you can resolve the IP address when doing 'ping', but not with Safari, given that your Windows machine can get to the web site.
Otherwise I would have said that the problem was that the Mac's DNS settings are not correct.

When you ping the hostname, does it resolve to an internal IP address or an external one?

In hindsight, I suppose that would be a useful tool...

When I ping the hostname, it resolves to an external IP address.

More fuel for the fire though, I tried to enter an internal IP address (192.168.XX.XXX) for our exchange server web interface, and got the same thing. I could ping the IP address, and it would work, but when I entered the address into the browser, it wouldn't connect to it.

Have you got any proxies set up in Safari?

Nope, no proxies.

hayne
09-07-2004, 12:15 PM
When I ping the hostname, it resolves to an external IP address.
That is odd. Isn't this an internal machine?
You need to tell us details about your network setup. E.g. are these Windows machines on the same subnet as the web server you are trying to reach. What about the OS X machines?

What do you get when you use /usr/bin/curl (in a Terminal window) to retrieve the top page of one of the web servers?
E.g.:
curl http://ip_address_of_server/

Las_Vegas
09-07-2004, 03:26 PM
Do you perchance have Mac OS X's firewall turned on, or a router between your Macs and the host machine? If the host machine is changing ports for the info page, and one of the above situations exist, the port may be blocked from your Macs. This would not effect pinging.

mclii
09-07-2004, 03:30 PM
That is odd. Isn't this an internal machine?
You need to tell us details about your network setup. E.g. are these Windows machines on the same subnet as the web server you are trying to reach. What about the OS X machines?

What do you get when you use /usr/bin/curl (in a Terminal window) to retrieve the top page of one of the web servers?
E.g.:
curl http://ip_address_of_server/

Wow, that curl command is pretty useful, and cool. You learn something new everyday I guess, thank you!

This is an internal machine. I'm not sure what sort of network setup we have, but I believe all of these machines, including Windows and OS X, are all on the same network.

We are all bound to the same domain at least, all getting our IP addresses dynamically. The only thing I see different on the Windows machines is that they have a WINS tab marked as "dchp - obtain automatically," and that they have the DNS tab marked as "Disable DNS"; whereas the OS X machines obviously don't have WINS (besides in the SMB configuration), and we have to actually specify DNS nameservers (can't leave it blank), otherwise we can't see anything outside of the network.

I know this makes all of this kind of vague, and I apologize for that.

I used curl on the address I'm having difficulty with, and got
curl: (7) Connect failed

Since when I ping the address, info.maindomain.com and get an external address, do you think it has something to do with the DNS servers I'm specifying not knowing how to resolve that address? When I run a traceroute on that same address, I only have one hop, so I guess I'm confused as to whether it's inside or outside of our network. It looks like an outside network address because of the address itself is different than all the 192.168.XX.XXX.

I guess what I'm picturing in my head is me (OS X) on the internal network, connecting to a DNS outside our network, which then goes to the address I'm specifying, and then back to me. Only instead of going to the address I specify, it's going nowhere.

I ran an ipconfig/all on the Windows machine, and it looks very similar to the setup I have on OS X except for the DNS entry.

Thanks for all your help, BTW!

mclii
09-07-2004, 03:33 PM
I do not have the OS X Firewall turned on, though I do believe that there is a router/firewall between me and the host.

mclii
09-07-2004, 04:09 PM
Alright, looks as though I fixed it.

When I ran ipconfig/all on the Windows box, it came up with a DNS entry that was different than the DNS entries I had on the OS X machines. It was an internal DNS. I entered that in before the other entries in the System Preferences, as well as in the resolv.conf file, and voila. I could see the pages I couldn't see before.

Now to figure out why I now can't sync Entourage with our Exchange server. I think that'll have to wait until our IT guy gets back from vacation. Luckily I can get the Classic version of MS Outlook 2001 to sync properly, so I'm good for the time being.

Thanks for everyone's help!

Las_Vegas
09-07-2004, 04:59 PM
If you leave the DNS field blank on the Mac, the addresses are fetched from the gateway. You aren't required to have this field filled.

Las_Vegas

mclii
09-07-2004, 05:11 PM
Yep, you're right, thanks!

Also, in my messing around with the Terminal, I realized something... I had accidentally written over a symbolic link of resolv.conf to the /private/etc/ folder, with a file containing nameserver and domain information. I just realized that's why whenever I changed things in the System Preferences, it wouldn't change the resolv.conf file. I was looking at the wrong one... and had messed the link up in the process.

The System Preferences app wasn't changing the /etc/resolv.conf file, it was changing the /var/run/resolv.conf file. The one in /etc/ was just a symbolic link. I recreated the symbollic link, and much, much better.

hayne
09-07-2004, 09:38 PM
in my messing around with the Terminal, I realized something... I had accidentally written over a symbolic link of resolv.conf to the /private/etc/ folder

Note to self (for future troubleshooting):
I should always ask "Have you used 'sudo' (or other 'root' access) to modify something in the /etc folder?".