What are URLs, DNS and IPs?

What are the parts of a URL and what does each part do?

URL full name: Uniform Resource Location translated as: Uniform Resource Locator;

This URL includes: protocol part, domain name, port, path (virtual path), carried parameters, hash value;

    http://www.jianshu.com/index.html?name=oldUath&age=25#dowell
    协议         域名        路径       ?查询参数          #锚点
  • Protocol part:
    The protocol part of the URL is "http:", which means that the web page uses the HTTP protocol. Various protocols can be used in the Internet, such as HTTP, FTP, etc. In this example, the HTTP protocol is used. "//" after "HTTP" is a delimiter

  • Domain name part:
    The domain name part of the URL is "www.jianshu.com". In a URL, an IP address can also be used as a domain name

  • Port part:
    following the domain name is the port, use ":" as the separator between the domain name and the port. The port is not a necessary part of a URL. If the port part is omitted, the default port will be used
    http: default port number 80; https: default port number 443; ftp: default port number 21

  • Path:
    index.html virtual directory;
    (http://www.jianshu.com/path1/path2; "/" means the root directory)

  • Parameter part:
    The part from "?" to "#" is the parameter part, also known as the search part and the query part. Parameters can allow multiple parameters, and "&" is used as a separator between parameters.

  • Anchor part:
    From "#" to the end, it is an anchor part. The anchor part is also not a required part of a URL

What is DNS?

DNS (Domain Name Server) translated as: domain name resolution service

Its main function is to "translate" familiar URLs (domain names) such as "www.baidu.com" into IP addresses that computers can understand

nslookup command

nslookup is a command-line tool to monitor whether the DNS server in the network can correctly implement domain name resolution.
nslookup www.baidu.com

What is an IP?

IP (Internet Protocol) protocol for interconnection between networks

IP mainly agrees on two things

  1. How to locate a device
  2. How to encapsulate data packets to communicate with other devices

IP is divided into intranet and extranet
several special ip

  • 127.0.0.1 represents itself
  • localhost specifies itself through hosts. You can replace localhost by modifying host; C:\Windows\System32\drivers\etcfind the hosts file

The ping command is usually used to test the connectivity with the target host

    ping 主机地址

What is a domain name?

A domain name is an alias for an IP, making it easier for people to remember

www.baidu.com is the domain name of Baidu

If you want to know the ip corresponding to a domain name, just ping him

  • A domain name can correspond to different IPs, which is called load balancing to prevent a machine from being unable to handle it.
  • An IP can correspond to different domain names, which is called shared hosting

The domain name and ip are linked through DNS

Domain names are also graded

  • com is the top level domain
  • baidu.com is a second-level domain name (commonly known as a first-level domain name)
  • www.baidu.com is a third-level domain name (commonly known as a second-level domain name)
 					   学习的时光总是短暂,又到了时候说拜拜
							欢迎关注公众号  oldCode
								获取新鲜教程资料

Official account: oldCode

Guess you like

Origin blog.csdn.net/buruyang/article/details/108934003
Recommended