wget not resolving to subdomain on different server

I'm using wget to grab a file:

wget http://subdomain.mysite.com

I get an error:

    Resolving subdomain.mysite.com... failed: Name or service not known

wget works for reaching other sites though, so I suspect the problem is that I'm running wget  on a server that hosts my www.mysite.com, but I am trying to reach a subdomain with the same top level domain name, that's on a different server.

So it's probably looking for the subdomain on the same server...

Do you agree that is the likely problem, and is there a solution?
Who is Participating?
Kent WConnect With a Mentor Sr. Network / Systems AdminCommented:
So is this subdomain loaded on a private DNS server, like an AD server, or is it in the public?
If you know the actual IP, one workaround until you get the DNS issue solved is to add it to your hosts file

and place a line in -  subdomain.mydomain.com

Of course, change the IP and subdomain to your actual IP and FQDN.

Your resolv.conf file is looking at, in order-

nameserver - machine itself (loopback)
nameserver - google public dns server
nameserver - google public dns server
nameserver - Level3 public DNS server.

If you have an internal dns server that hosts your zones for domain.com. simply add a "nameserver" line to your resolve.conf with it's IP.  I'd add at the top.
ste5anSenior DeveloperCommented:
It's not wget, it's a DNS problem. What says nslookup subdomain.mysite.com  ?
Kent WSr. Network / Systems AdminCommented:
First try pining "subdomain.mysite.com".  If it's not found or the wrong IP, check your /etc/resolv.conf to see what names servers you are looking at.  
This is not a wget error, it's a straight DNS error.

Correct the DNS issues, and wget will work.
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

St_Aug_Beach_BumAuthor Commented:
Ok, with nslookup I get:

# nslookup mysubdomain.mysite.com                                                                                      

** server can't find mysubdomain.mysite.com: NXDOMAIN

ping says "unknown host"

That's odd, I can enter the subdomain.domain.com into my browser and reach it easily enough.
St_Aug_Beach_BumAuthor Commented:
In resolve.conf I have:

St_Aug_Beach_BumAuthor Commented:
Perfect - that does the trick :)

Now... adding that to my notes about backups so when it's time to replace this server I'll remember to do that again!

Thank you both!
All Courses

From novice to tech pro — start learning today.