What is the URL
Uniform Resource Locator URL Full name Uniform Resource Locator, which has two common forms:
- Uniform resource locator —
URL
- Unified Resource Name —
URN
There are two main differences between the two:
URL
Commonly referred to as a web address, for examplebaidu.com
. throughURL
Open the url, the content is uncertainURN
Can determine the unique content, similar to our ID card. The most common one is used in books, one must be available before each book is publishedURN
Through theURN
You can find the book.
The composition of the URL
The URL is mainly composed of the following six parts:
- Agreements, for example
HTTP
- It is used to transfer information between the Web browser and the Web server. Generally, the protocol can be HTTP or HTTPS
- Domain name or IP, for example
baicu.com
- IP is used to locate a device and encapsulate data packets to communicate with other devices (such as the computer at home, router, network, etc.). They all have their own independent IP addresses. IP is also divided into internal IP and external IP
- Ports, for example
8080
- Ports in an IP address refer to logical ports, which are logically used to distinguish services
- Paths, for example
/s
- Used to access the same website of different pages, you can request static resources, query background data
- Query parameters, such as
? name=zhangsan&age=18
- Used to access different data on the same page
- Anchor points, for example
# 1
- Used to locate the location in the page, and does not support Chinese, the browser will convert it to a string, the anchor is only browser related, not uploaded to the server
DNS function and nslookup command
The role of DNS
DNS can match a domain name to an IP address, so that users can access a website by entering a domain name instead of entering a long and difficult IP address, because the DNS service will automatically convert the domain name to the correct IP address.
Noslookup command
The nslookup command is used to query DNS records to check whether domain name resolution is normal and diagnose network faults.
The process of entering a URL in the browser address bar
- The browser requests the DNS server (domain name system/service) to resolve the IP address corresponding to the domain name in the URL
- The TCP connection is established with the server based on the obtained IP address and port number
- The browser sends an HTTP request to read the file. The request packet is sent to the server as the third packet of the TCP three-way handshake
- The server responds to the browser request and sends the corresponding HTML text to the browser, releasing TCP
- Display the captured page to the user
The function of IP and the ping command
The role of IP
IP is used to locate a device and encapsulate data packets to communicate with other devices (such as home computers, routers, networks, etc.). They all have their own IP.
IP addresses are classified into Intranet IP addresses and extranet IP addresses. The Intranet and extranet do not interfere with each other and can only communicate with each other through a router (gateway).
The ping command
You can use ping on the command line to test whether the network is connected. As shown in the picture below, under the condition of normal network, the website baidu.com will be requested.
The domain name
A domain name is just another name for IP. (for example: QQ.com baidu.com) It is divided into top-level domain name, level-1 domain name, level-2 domain name and level-3 domain name.
Usually we call the.com end a top-level domain; Xxx.com is a level 2 domain name (commonly known as level 1 domain name; www.xxx.com is a level 3 domain name (commonly known as level 2 domain name)
Compared to IP, domain names are easier to remember
com
A commercial organization or companycn
Chinese domain nameorg
A non-profit organization or groupgov
The government departmentmil
The militarynet
An organization or company that works on the Internetcc
unlimitedtv
unlimitedac
Scientific research institutions