Skip to main content

Hva er forskjellen mellom pinging med og uten http: //?

Hva er forskjellen mellom pinging med og uten http: //?

Geoffrey Carr

Hvis du eksperimenterer med og lærer å pinge på et nettsted, kan du bli overrasket over resultatene basert på "hva" du ping. Dagens SuperUser Q & A-innlegg hjelper til med å fjerne ting for en forvirret og frustrert leser.

Dagens Spørsmål & Svar-sesjon kommer til oss med høflighet av SuperUser-en underavdeling av Stack Exchange, en fellesskapsdrevet gruppering av Q & A-nettsteder.

Skjermbilde høflighet av Cristianzambrano (Wikimedia Commons).

Spørsmålet

SuperUser leser Saransh Singh vil vite hva forskjellen mellom pinging med og uten http: // er:

I am trying to ping my website http://www.example.com/ and it resolves to an unknown IP address, then it times out.

But when I ping example.com, it works. What am I missing or not understanding here?

Note: example.com was substituted for the actual website at SuperUser.

Hva er forskjellen mellom pinging med og uten http: //?

Svaret

SuperUser-bidragsyter DavidPostill har svaret for oss:

The argument to ping is a host name (or an IP address). So the following will all work:

On the other hand, this will not work as http://www.example.com/ is an HTTP Uniform Resource Locator (URL), not a valid host name (although part of it is a host name).

A HTTP URL is made up of 4 parts:

  • Scheme — Always present
  • Host Name — Always present
  • Path or Stem — Always present but sometimes is null
  • Parameters — Optional

A ping will not normally recognize URLs as a valid destination host name.

Note

Not all URLs have the format mentioned above. A complete URL consists of a naming scheme specifier followed by a string whose format is a function of the naming scheme. The format of URLs is defined in the IETF specification Uniform Resource Locators (URLs). *This is a different website address from the one shown for URL above.

DNS Hijacking

An exception to the above can happen if the DNS server (which resolves host names to IP addresses) is configured to return a valid IP address even if an invalid host name is supplied. This can happen if an ISP is hijacking your DNS queries.

From the answer Why is ping resolving to an IP 198.105.254.228 for any random host name that i type? by Michael Hampton:

  • They are trying to be “helpful” by redirecting requests for nonexistent domains to a white label service that provides search results and advertising, from which everyone but you gets a cut of the revenue. Fortunately, they do have a preferences page where you can supposedly turn it off.

Pass på å lese gjennom de andre nyttige svarene via tråkkelen som er delt nedenfor!


Har du noe å legge til forklaringen? Lyder av i kommentarene. Vil du lese flere svar fra andre tech-savvy Stack Exchange-brukere? Sjekk ut hele diskusjonstråden her.

Link
Plus
Send
Send
Pin