What is a URL?

URL is a Uniform Resource Locator. A URL is nothing more than the address of a given unique resource on the Web. In theory, every valid URL points to a unique resource. This resource can be an HTML page, a CSS document, an image, and so on. In practice, there are a few exceptions, the most common being a URL that points to a resource that doesn’t exist or has been moved.

  • What it does: It is the mechanism that the browser uses to retrieve any resource published on the Web.

  • Components:

    URL = Protocol + Domain name or IP address + port number + path + query string + anchor

  • Analyze the URL

http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument
Copy the code

Protocol: HTTP is a protocol. It indicates which protocol the browser must use. It is usually HTTP or a secure version of HTTP, called HTTPS. The Web needs one of them, but browsers also know how to handle other protocols, like Mailto (opening mail clients) or FTP (handling file transfers), so don’t be surprised when you see them.

Domain name or IP: www.example.comIs the domain name. It indicates which Web server is being requested. Alternatively, you can use IP address directly, but because it’s not very convenient, it’s not often used on the network.

port: :80 is a port. It represents a technical “gate” for accessing resources on a Web server. If a Web server grants access to its resources using the standard port of the HTTP protocol (80 for HTTP and 443 for HTTPS), it is generally ignored. Otherwise it is mandatory.

The path: /path/to/myfile.html is the path of the resource on the web server.

Query string😕 Key1 = valuE1&key2 =value2 are additional arguments provided to the network server. These parameters are usedA symbol-delimited list of key/value pairs.

The anchor: #SomewhereInTheDocument is an anchor point for another part of the resource itself. An anchor represents a “bookmark” in a resource that gives the browser the direction of the content at that “bookmarked” location. For example, on an HTML document, the browser will scroll to the point where the anchor point is defined; On a video or audio document, the browser will try to go to the time represented by the anchor.Note that the anchor points cannot be seen on the Network panel because the portion following # (also known as the fragment identifier) is never sent to the requesting server.

  • Here’s another chestnut
/* Protocol - HTTPS domain name - developer.mozilla.org path - / en-us /search query string -? Q =URL port - omitted anchor point - 🈚️ */ https://developer.mozilla.org/en-US/search?q=URLCopy the code
  • What is a URL? – MDN

What is DNS?

Think of it as a giant phone book. For example, if you want to access the domain name math.stackExchange.com, use DNS first to find its IP address is 151.101.129.69.

  • Full Name: Domain Name System

  • Function: Check IP addresses based on domain names. Convert a human-readable domain name (for example, www.amazon.com) to a machine-readable IP address (for example, 192.0.2.44).

  • A very useful command for querying domain name information is nslookup

  • What is DNS – AWS INTRODUCTION to DNS Principles

The role of IP

  • IP and IP address

IP (Internet Protocol) is actually the abbreviation of the Internet Interconnection Protocol, but we usually omit the address after the IP address, directly use IP to represent a computer on the network, in fact, this is not strict. IP is at the heart of what the Internet does, and what we call an IP address is actually just one of its functions: IP addressing, which is a unique address.

  • Functions of the IP address: The IP address is used to locate the device, encapsulate data packets, and communicate with other devices.

  • To query the IP address of a domain name, run the ping command

  • Main functions of the ping command

    • It is used to detect network connectivity and analyze network speed
    • Obtain the server IP address based on the domain name
    • Determine the operating system used by the peer and the number of packets that pass through routers based on the TTL value returned by the ping

    💡 we usually use it to ping IP addresses directly to test network connectivity.

  • You are advised to read the seven uses of the ping command

What is a domain name?

❓ question www.baidu.com and baidu.com is the same domain name answer: no

  • Domain Name (Domain Name for short) is the Name of a computer or computer group on the Internet consisting of a series of characters separated by dots. It is used to identify the electronic location of the computer during data transmission.

  • A domain name is an alternate name for an IP address for easy memorization.

  • For example, wikipedia.org is a domain name. People can access Wikipedia.org directly in place of an IP address, and the Domain Name System (DNS) will convert it into an IP address that is easy for machines to recognize. In this way, people only need to remember a string of characters called wikipedia.org with a particular meaning, rather than a number with no meaning.

  • Domain name structure: a domain name is composed of several parts (maybe only one part, maybe two, three parts…). Composed of simple structures separated by dots, unlike the Chinese writing order, which requires reading from right to left.

    • Top-level Domain (TLD) : a TLD can tell users the service types provided by the Domain name. The most common top-level domains (.com,.org,.net,.edu,.gov)
    • SLD (Secondary Level Domain): the label just before the TLD, such as Baidu.com
    • www.baidu.com is a level 3 domain name (commonly known as level 2 domain name)
    • They are father and son
    • Github. IO, for example, gives away the subdomain xxx.github
  • ⚠ ️ note

    A domain name can correspond to different IP addresses (load balancing). An IP address can correspond to different domain names (shared hosts).

  • What is a domain name? – MDN domain name – wiki