networking - How to know the IP address of a website

09
2014-02
  • JqueryLearner

    I wanted to know the IP address of a website.One way is to ping the website.For example if I want to know the ip address of google.com then I can ping in command prompt.

    Pinging google.com [74.125.236.195] with 32 bytes of data:
    
    Reply from 74.125.236.195: bytes=32 time=36ms TTL=49
    Reply from 74.125.236.195: bytes=32 time=35ms TTL=49
    Reply from 74.125.236.195: bytes=32 time=64ms TTL=49
    Reply from 74.125.236.195: bytes=32 time=47ms TTL=49
    

    So here 74.125.236.195 is the IP address of google.But for suppose I want to know the IP address of superuser.com and if I try using the same way then I get 198.252.206.16 IP address.But If I put this IP addess in browser url then my browser does not take me to superuser.com.

    Can anyone tell me how to get the IP address?

  • Answers
  • Paul

    Your starting assumption is that all websites can be accessed via their IP address directly. This is not the case.

    In many cases (I'd venture most cases) the website that is presented at an IP address is dependent on the website name you are requesting. Ie, if you request superuser.com you will first resolve this to an IP address, then make a request to the IP address for a specific webpage. It looks like this:

    GET / HTTP/1.1
    Host: superuser.com:80
    

    The first part says "get the first page of the site", and the second says "for the website superuser.com"

    This is why a single webserver can host multiple websites using a single IP address. In the case of the Stack Exchange sites, any or all of them can be on each of their servers, and you'll get the one you ask for. If you just put in an IP address, you won't get any of them, because you are not telling the webserver which of the many websites you are after. In these cases, it may have a "default" website defined, or just return an error.

    If you are trying to work around an issue with your DNS provider, then one option you have is to modify your hosts file so that you are resolving addresses yourself, rather than have an external party do it for you.

    So for example, if you edit

    /etc/hosts   (linux)
    c:\windows\system32\drivers\etc\hosts   (windows)
    

    You can enter

    74.125.236.195 superuser.com
    

    This way, if you type superuser.com into your browser, it will look in the hosts file, and resolve the IP address, but then still pass through the name of the website to the server it connects to.

  • lesca

    To get the IP address of a website. The best way is to use nslookup command. For example:

    nslookup superuser.com 8.8.8.8
    Server:  google-public-dns-a.google.com
    Address:  8.8.8.8
    
    Non-authoritative answer:
    Name:    superuser.com
    Address:  198.252.206.16
    

    If you wonder why you cannot visit superuser directly from IP address (198.252.206.16), it is because of the settings of web server.

    Here, superuser's site disallows user visit via IP address. Probably it is because the IP address is binding to other web sites (say stackoverflow.com).

    If you use "IP reverse lookup" tool, you can find its binding sites.

    One more lookup proves I am right:

    nslookup stackoverflow.com  8.8.8.8
    Server:  google-public-dns-a.google.com
    Address:  8.8.8.8
    
    Non-authoritative answer:
    Name:    stackoverflow.com
    Address:  198.252.206.16
    
  • Matthew Williams

    Firefox have a nice addon which shows the OP address of any website you visit which you can get from here


  • Related Question

    windows 7 - Can ping IP address and nslookup hostname but cannot ping hostname
  • Puddingfox

    I have a DNS server set up on one of my machines using BIND 9.7 Everything works fine with it. On my Windows 7 desktop, I have statically-assigned all network values. I have one DNS server set -- my DNS server. On my desktop,

     I can ping a third machine by IP fine.
     I can nslookup the hostname of the third machine fine.
     When I ping the hostname, it says it cannot find the host.
    

    /

    C:\Users\James>nslookup icecream
    Server:  cake.my.domain
    Address:  xxx.xxx.6.3
    
    Name:    icecream.my.domain
    Address:  xxx.xxx.6.9
    
    
    C:\Users\James>ping xxx.xxx.6.9
    
    Pinging xxx.xxx.6.9 with 32 bytes of data:
    Reply from xxx.xxx.6.9: bytes=32 time<1ms TTL=255
    Reply from xxx.xxx.6.9: bytes=32 time<1ms TTL=255
    Reply from xxx.xxx.6.9: bytes=32 time<1ms TTL=255
    Reply from xxx.xxx.6.9: bytes=32 time<1ms TTL=255
    
    Ping statistics for xxx.xxx.6.9:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms
    
    C:\Users\James>ping icecream
    Ping request could not find host icecream. Please check the name and try again.
    

    I have also specified the search domain as my.domain

    • xxx.xxx and my.domain substituted for security

    Why can I not ping by hostname? I also can not ping using the FQDN. The problem is that this problem is shared by all applications that resolve hostnames. I cannot use PuTTY to SSH to my machines by hostname; only by IP


  • Related Answers
  • Diskilla

    You could try editing your hosts file. Put there the hostnames and ip-adresses of your other machines. If thats not working try this: Your Router should be able to handle dns-tables for itself. Try to temporarly shut down your dns-server and clear all dns caches on all machines. Then restart your router and try it again.

  • 8088

    I faced the same problem in my network. When you use this command:

    ping icecream
    

    It uses WINS server since you have used icecream not icecream.my.domain.

    When looking for such words, Windows looks for NETBIOS names, but when you look for complete domain records, it will look in the DNS server. You can use one of the solutions below:

    1. Make sure you have correct records for that station in your WINS server.
    2. Use the complete domain name instead of using the host file. E.g. icecream.my.domain
  • 8088

    You don't have DNS suffixes configured. Either configure them, or use FQDN like this and it should work:

    ping icecream.my.domain
    
  • bendiy

    I'm looking for a permanent solution to this problem. I don't just have a problem with ping icecream, but also ping icecream.my.domain. It doesn't happen all the time, just randomly on one computer. ipconfig /flushdns fixes it sometimes and rebooting work as well, but it's not a permanent solution.

    I just tried this:

    Based on this:

  • user165568

    To disable this behaviour, disable Negative Caching by setting the value of NegativeCacheTime to 0 at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ Dnscache\Parameter