How to get a WebSite IP address that is not responding to messages?

I am trying to get the IP address of a website that does not respond to pings - they time out.

I am trying to do this from a C # application, and not from the command input window in windows. I use the ping command, which has time on some sites, so it is not needed.

Is there any other way to get this information that does not require a site response?

+4
source share
9 answers

Even if the site does not respond to PING (ICMP is not enabled on the server or is not filtered by the firewall), the PING command should still resolve the site name to an IP address and display that IP address for you.

Check the output of the ping command on Windows (the ip address is in bold):

ping wikipedia.org 

Pinging wikipedia.org [208.80.152.2] with 32 bytes o
Reply from 208.80.152.2: bytes = 32 times = 245 ms TTL = 50
Reply from 208.80.152.2: bytes = 32 times = 235 ms TTL = 50

Refresh (due to updated question)

If you are trying to get the IP address for the DNS name from a C # application, you should use the GetHostEntry method from the Dns class: http://msdn.microsoft.com/en-us/library/ms143998.aspx .

+6
source

You get the IP address from DNS and need it to ping, so you already have it.

 $ ping google.com PING google.com (74.125.227.51) 56(84) bytes of data. 64 bytes from 74.125.227.51: icmp_seq=0 ttl=56 time=5.80 ms 64 bytes from 74.125.227.51: icmp_seq=1 ttl=56 time=6.23 ms 

IP is displayed. If you do not get an IP address, your DNS may not be available.

You can also try nslookup google.com

+3
source

To get the IP address on behalf of the host in Dns.GetHostEntry () . Pass the host name and it will return you the IP address.

There is no reason why you need to ping (contact anyway) with the site in order to get its IP address. A DNS lookup will give you what you need.

+2
source

You can use nslookup to resolve domain names.

nslookup google.com

+1
source

The following code can be used to perform a DNS lookup for the specified host name.

Using DNS will bypass access to the target server. It is an independent distributed directory service that supports a host name to look up IP addresses.

The following code will provide the first returned IP address for the host if a DNS record can be resolved for the provided host name.

  public void test() { string hostname = "google.com"; IPAddress ipAdress; if (TryGetIpAddress(hostname, out ipAdress)) { Console.WriteLine("Host:'{0}', IP:{1}.", hostname, ipAdress); } else { Console.WriteLine("Host '{0}' not found.", hostname); } } public bool TryGetIpAddress(string hostname, out IPAddress ipAddress) { const int HostNotFound = 11001; ipAddress = null; try { IPHostEntry hostEntry = Dns.GetHostEntry(hostname); ipAddress = hostEntry.AddressList[0]; } catch (SocketException ex) { if (ex.ErrorCode != HostNotFound) throw; } return (ipAddress != null); } 
+1
source

You can use tracert and it will resolve the IP address and tell you if it can be reached or where it will stop.

0
source

If the site (http) is up and running, it is very clear that sys / network admin has disabled ping and, most likely, the route utility trace too. Now it is becoming very common. See here . Your alternative is to use the ns search or the WHOIS service as described here

0
source

When doing this in code, you should have some function like gethostbyname ().

It should be on stackoverflow.com

0
source

untested

You can host this site.

http://centralops.net/co/DomainDossier.aspx

you can use import.io to make functinality with the site.

https://www.import.io/

these links can give you insight

0
source

Source: https://habr.com/ru/post/1333698/


All Articles