computer network crash

Better reading experience\color{red}{\huge{better reading experience}}better reading experience

internet overview


Network, Internet and Internet


  • Network: A system that connects multiple computers or computer networks through communication lines so that they can communicate and exchange information with each other. It consists of several nodes (Node) and links (Link) connecting these nodes. Nodes can be computers, hubs, switches, routers, etc.
  • Internet: Multiple networks are interconnected through routers to form a network with a larger coverage, that is, the Internet, so the Internet is a network of networks .
  • The Internet**:** is the largest Internet network in the world.


The composition of the Internet



three exchange methods


  • Circuit switching:
    • A dedicated physical path is established between the sender and receiver, which remains connected throughout the communication .
    • The sender sends data on the channel, and the receiver receives data on the channel.
    • In circuit switching, both communication parties have exclusive bandwidth, and data transmission during communication is continuous and not affected by other users. The traditional telephone network is a circuit switching method.
  • Message exchange:
    • In message exchange, the sender packs the complete data to be transmitted into a message, and then sends it to the receiver in one go.
    • After receiving the message, the receiver extracts the complete data and performs corresponding processing.
    • In message exchange, the data transmission process is discrete , and each transmission is a complete message.
  • Packet switching:
    • In packet switching, the sender divides the data into smaller data packets (packets) and sends them to the network after adding control information such as the destination address.
    • The network is routed according to the destination address, and the data packets are distributed to the destination node, and finally the destination node is reassembled into complete data.
    • In packet switching, data packets are transmitted independently and can be transmitted through different paths, which improves the utilization rate and flexibility of the network. The Internet is a network based on packet switching.


Definition and Classification of Computer Networks


Definition of Computer Network


  • There is no very precise definition.
  • Simplest definition: A collection of interconnected, autonomous computers.
    • Interconnection: Data communication between computers can be carried out through wired or wireless means.
    • Autonomy: Refers to an independent computer that has its own hardware and software and can be used independently.
    • Collection: At least two computers are required.
  • A more precise definition:
    • A computer network is primarily the interconnection of general-purpose, programmable hardware that is not dedicated to a specific purpose (for example, to transmit data or video signals). These programmable hardware can be used to transfer many different types of data , and can support a wide range and growing applications .
    • A computer network can be a local area network (Local Area Network, LAN), a wide area network (Wide Area Network, WAN), the Internet and other networks of different scopes and topologies.
  • Core purpose:
    • Realize data transmission and resource sharing between computers.
    • Through the network, people can share files between different computers, print documents, log in to other computers remotely, and perform remote communication activities such as e-mail, instant messaging, and video conferencing. Computer networks also host important applications in everyday life such as the Internet, online entertainment, e-commerce, and electronic payments.

Classification of Computer Networks


  1. By scale:

    • Personal Area Network (PAN): Used for communication between personal devices, such as computers, mobile phones, etc.
    • Local Area Network (LAN): A network used to connect devices located within a relatively small geographic area, such as an office, school, or home.
    • Metropolitan Area Network (MAN): Connects devices located within the same city limits, usually consisting of multiple LANs.
    • Wide Area Network (WAN): A network that covers a larger geographic area and can span cities, countries, and even international boundaries.
  2. According to the connection method:

    • Peer-to-peer network: A direct connection is established between two computers.
    • Broadcast network: Broadcast information to all devices on the network through a shared medium.
    • Mesh Network: Each node is directly connected to other nodes.
    • Bus network: All devices are connected by a shared bus.
  3. According to usage scenarios:

    • Internet: Consisting of multiple interconnected networks covering the globe, providing connectivity and communication at the WAN level.
    • Enterprise network: used for communication and shared resources within enterprise organizations, such as local area network and private wide area network.
    • Wireless Networking: Communication between devices using wireless technologies such as Wi-Fi, Bluetooth, etc.
  4. According to topology:

    • Star network: All devices are connected through a central node (usually a switch or router).
    • Ring network: Devices are arranged in a ring, and each device is connected by two adjacent devices.
    • Mesh Network: Each node is directly connected to other nodes.
  5. According to the network protocol:

    • Wired Network: Communicate using a wired connection such as Ethernet.
    • Wireless Networking: Communicates using wireless technologies such as Wi-Fi, Bluetooth, LTE, etc.

Performance Indicators for Computer Networks


Conversion relationship between data volume and rate



Common performance indicators


  1. Bandwidth (Bandwidth):
    • Bandwidth refers to the ability of the network transmission medium to transmit data, usually expressed in the amount of data transmitted per second (bit rate).
    • That is, the highest data rate that can pass from one point in the network to another point per unit time .
  2. Latency:
    • Latency is the time delay between when data travels from sender to receiver.
    • These include: Send Latency (time to prepare and encapsulate data before sending it), Transit Latency (time it takes data to transfer) and Receive Latency (time for data to be reassembled and processed at the receiver).
  3. Throughput:
    • Throughput refers to the amount of data transmitted by the network per unit time .
    • It reflects the data processing capability and transmission efficiency of the network.
  4. Packet Loss Rate:
    • The packet loss rate refers to the proportion of data packets lost during data transmission.
    • A lower packet loss rate indicates higher reliability of the network and more stable data transmission.
  5. Network scalability (Scalability):
    • Network scalability refers to the scale and capacity expansion capabilities of the network .
    • A network with better network scalability can support more users and devices and maintain good performance.
  6. Reliability:
    • Reliability refers to the stability and continuity of network operation.
    • A reliable network can guarantee the safe transmission of data and the correctness of transmission.

In addition to the above indicators, there are other indicators such as network frame rate, network response time, noise and jitter, etc., which can also be used to evaluate the performance of computer networks. These performance indicators are very important for evaluating and optimizing network performance, ensuring that the network is running properly and meeting user needs.


computer network architecture


Common Computer Network Architectures


Architecture of a computer network:

  • Refers to the structure and organization of computer networks, and describes the protocols and functions of each level in the network, as well as the relationship between them.

There are two common computer network architectures:

  • OSI (Open System Interconnection) reference model:
    • Proposed by the International Organization for Standardization (ISO) in the 1970s.
    • It is divided into seven layers (from bottom to top, physical layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer), each layer has corresponding protocols and functions, and each The protocol of the first layer only communicates with the adjacent upper and lower layers.
  • TCP/IP (Transmission Control Protocol/Internet Protocol) architecture:
    • The architecture originally used for the Internet.
    • It is divided into four layers (from bottom to top are network interface layer, Internet layer, transport layer, application layer), each layer has corresponding protocols and functions, and the interaction between each layer is strong, the upper layer You can directly call the underlying services.


Example of layered thinking of computer network architecture



The process of computer network transmission


To sum up the thoughts, the content is referenced from:


application layer


  • Application Layer ( Application Layer ): The application layer is at the top and is also directly accessible to us.
  • When applications of two different devices need to communicate, the application layer passes the application data to the next layer (transport layer).
  • The application layer is the user state that works in the operating system, and the transport layer and below work in the kernel state.

transport layer


  • Transport Layer ( Transport Layer ): That is, the above transport layer, the data packets of the application layer will be passed to the transport layer to provide network support for the application layer .
  • Common protocols:
    • TCP: The full name is Transmission Control Protocol ( Transmission Control Protocol ). Most applications use the TCP transport layer protocol, such as the HTTP application layer protocol. It has the characteristics of flow control, timeout retransmission, and congestion control to ensure that data packets can be reliably transmitted to the other party.
    • UDP: The full name is User Datagram Protocol ( User Datagram Protocol ). It is only responsible for sending data packets, and does not guarantee whether the data packets can reach the other party, but it has relatively better real-time performance and high transmission efficiency.
  • In the TCP protocol, we call each block a TCP segment ( TCP Segment ). When the device acts as the receiver, the transport layer is responsible for passing the data packet to the application, but there may be many applications on one device. When receiving or transmitting data, it is necessary to use a number to distinguish the application, and this number is the port ( Port ).
  • The port number is carried in the message of the transport layer, so the receiver can identify which application the message is sent to.

Note :

  • The transport layer is concerned with the reliable transmission and flow control of data, and is not responsible for the actual transmission.

Network layer


  • Internet Layer ( Internet Layer ): The actual transmission function layer. The Internet layer transmits data packets (also called datagrams) from the source host to the destination host through the Internet layer protocol (such as the IP protocol).
  • Steps for data transmission at the network layer:
    • Data segmentation: If the size of the datagram exceeds the maximum transmission unit (MTU) of the network, the network layer will divide the datagram into small pieces suitable for transmission. Each small piece is called a data segment.
    • IP addressing: The network layer adds the source IP address and destination IP address to the header of the datagram. The source IP address is the unique identifier of the sending host, and the destination IP address is the identifier of the receiving host, which is used to determine the source and destination of the datagram.
    • Routing selection: The network layer selects an appropriate path to transmit the datagram from the source host to the destination host according to the destination IP address and the routing information in the routing table. Routing involves communication between routing algorithms and routers.
    • Datagram forwarding: According to the result of routing selection, the datagram will be forwarded through a series of routers, and each router will search for the next-hop route according to the destination IP address.
    • Data encapsulation: When each router forwards a datagram, it will encapsulate the datagram into a new data frame, and add the frame header and frame tail of the physical layer for transmission on the physical layer.
    • Data transmission: The forwarded data frames are transmitted through the physical layer and transmitted through transmission media such as network cables, optical fibers, and wireless channels.
    • Data decapsulation: After receiving the data frame, the destination host will decapsulate it and extract the datagram.
    • Data reassembly: If the datagram is transmitted in fragments, the destination host needs to reassemble the fragmented datagrams into complete data.
    • Data delivery: The destination host delivers the data to the upper-layer application to complete the data transmission process.

network interface layer


  • Network interface layer ( Link Layer ): responsible for processing the hardware and software operations of the network interface in order to transmit data on the physical medium.
  • Its main functions include:
    • Frame encapsulation: Encapsulate the IP datagram transmitted from the network layer into a data frame, and add control information (such as source and destination MAC addresses, frame type) to the head of the data frame.
    • Media Access Control (MAC): Control access to shared physical media (such as Ethernet, wireless LAN) through the MAC protocol to avoid conflicts and collisions.
    • Transmission and reception of data frames: The network interface layer is responsible for sending data frames to the physical medium for transmission, or receiving data frames from the physical medium.
    • Error detection and correction: The network interface layer is responsible for detecting errors that may occur during the transmission of data frames and correcting them. Commonly used error correction mechanisms include cyclic redundancy check (CRC).
    • Data link control: The network interface layer ensures reliable transmission of data frames, detects lost or damaged data frames through frame confirmation and retransmission mechanisms, and performs corresponding retransmissions.
    • Physical address (MAC address) resolution: The network interface layer uses physical addresses (also known as MAC addresses) to uniquely identify network interfaces and transmit data frames from one network interface to another.
    • Router and switch interface: The network interface layer implements the interface with routers and switches, and sends data frames from the local network to other networks.

Explanation of computer system terminology


domain name


A domain name is a name used to identify and locate resources on the Internet. For example:lys2021.com

Simply put, a domain name is the address of a website , through which a specific website or resource can be accessed conveniently.

Domain names can be classified according to their position in the domain name system, and are divided into the following levels:

  • Top-Level Domain (TLD): The top-level domain name is the highest-level domain name classification, on the far right of the domain name, usually composed of several letters. Top-level domains can be further divided into two categories:
    • Generic Top-Level Domain (gTLD): Including common .com, .net, .org, etc., used to indicate the classification or use of domain names.
    • Country Code Top-Level Domain (ccTLD): A domain name suffix used by a country or region, such as .cn for China, .jp for Japan, etc., used to indicate the country or region of the domain name.
  • Second-Level Domain (SLD): Located under the top-level domain name, it is a part of the domain name customized according to the registrant's choice.
    • For example, in lys2021.com, "lys2021" is the second-level domain name.
  • Subdomain: Located under the second-level domain name, it can be further subdivided into multiple levels.
    • For example, under the main domain name of lys2021.com, you can create the following subdomain names: game.lys2021.com, blog.lys2021.com.

What is www :

  • "www" is a common subdomain prefix that is often used to represent World Wide Web (WWW) services on the Internet. It is usually used to identify the main access address of the website as the default prefix of the website. Most websites will have "www" as part of the subdomain in the URL.

DNS


DNS (Domain Name System) is a network protocol whose main function is to convert domain names into corresponding IP addresses.

  • DNS acts as a phone book on the Internet, and users can access a specific website by entering a URL (domain name) without remembering the IP address of the website.
  • When a user enters a domain name, the computer will send a DNS query request to the DNS server, and the DNS server will return the IP address corresponding to the domain name, and then the computer will establish a connection with the server based on the IP address and point the user to the correct website.

Domain names in DNS are separated by dotslys2021.com , for example , the dots here represent the boundaries between different levels .

  • In a domain name, the farther to the right the higher the level .
  • The actual domain name has a dot at the end, for example lys2021.com., the last dot represents the root domain name.
  • That is, .the root domain is at the top level, the next level is .comthe top-level domain, and the next level is the top-level domain lys2021.com.

The hierarchical relationship of domain names is similar to a tree structure:

  • root DNS server (.)
  • Top-level domain DNS server (.com)
  • Authoritative DNS server (lys2021.com)

DNS resolution process :

What is a CDN :

  • CDN (Content Delivery Network) is a network architecture that provides high-speed, reliable and secure content delivery through servers distributed around the world. The goal of CDN is to improve the user's access experience by storing content on edge servers close to users to reduce network latency and increase content transmission speed.
  • The working principle of CDN is to set up multiple edge node servers in various locations around the world, and these servers store static content (such as web pages, images, videos, etc.). When a user requests content from the CDN, the CDN will provide the content from the edge node server closest to the user instead of the original server according to the user's location. This can effectively reduce the number of hops requested by users, reduce network delays, and improve response speed and bandwidth utilization.

When does the CDN work :

  • The premise is that the website has deployed CDN service.
  • After the DNS is resolved and a connection is established with the server, when the user initiates a request for specific content, the CDN will route the request to the nearest edge node server according to the user's location and network environment.
  • When the content requested by the user is not cached or has expired. When the content requested by the user (such as images, videos, web pages, etc.) is not in the cache of the edge node server, or has expired, the CDN will forward the request to the original server to obtain the latest content, and then cache the content to the edge Node server for subsequent requests.

HTTP


HTTP is the abbreviation of Hypertext Transfer Protocol.

  • It is an application-layer protocol for transmitting hypertext and multimedia files in computer networks .
  • The HTTP protocol is the most commonly used protocol in Web applications. It is built on the TCP/IP protocol and communicates by using the client-server model.

In HTTP, the client sends an HTTP request, and the server returns an HTTP response, realizing communication and data exchange between the client and the server.

  • The HTTP protocol is a stateless protocol, and each request and response are independent.

When an HTTP request is generated :

  • After the user enters the domain name in the browser, the browser URLdetermines Webthe server and file name after parsing, and then generates an HTTP request message based on these information.

How HTTP requests are sent :

  • After the browser parses URLand generates HTTPthe message, the operating system needs to be entrusted to send the message to Webthe server.
  • But before sending, you need to query the IP address corresponding to the server domain name , because when entrusting the operating system to send a message, you must provide the IP address of the communication object.
  • Therefore, it needs to be handed over to DNSfor analysis.

What conditions are required to transfer data :

  • HTTP is transmitted based on the TCP protocol. Before HTTP transmits data, it first needs to establish a TCP connection. The establishment of a TCP connection is usually called a three-way handshake .
  • The purpose of the three-way handshake is to ensure that both parties have the ability to send and receive .

What is stateless :

  • "Stateless" means that during network communication, the server does not save any information or state of the client.
  • Each request and response is independent of each other, and the server does not remember previous requests or associations with previous requests. This means that each request needs to provide enough information for the server to understand and process the request, and the response returned by the server contains only the data and state required by the current request.
  • Due to the stateless nature, the load on the server is lighter, and it is easier to achieve scalability and reliability.
  • In order to implement session and state management, such as saving user login status, session management technologies (such as using cookies or tokens) are usually used to store and transmit client state information.

What are cookies :

  • A cookie is a small text file that stores data on the client side.
  • It is sent by the web server to the client (usually a browser), and then saved locally by the client. When the client sends subsequent requests, these cookies will be carried in the request so that the server can identify and track the client.
  • The main advantage of using cookies is that it can maintain session state between different requests. By storing session ID and other information in cookies, the server can track the user's operation and status, and realize user authentication and personalized experience.
  • However, cookies also have some security and privacy considerations, so you need to pay attention to the handling and protection of sensitive information, and implement encryption and security measures when necessary.

HTTPS


HTTPS is the abbreviation of Hypertext Transfer Protocol Secure:

  • It is a protocol that protects network communication security through encryption and authentication.
  • It is an encrypted version based on the HTTP protocol, and its purpose is to establish a secure communication channel between users and websites to prevent data from being stolen, tampered with or forged.

HTTPS encrypts transmitted data by using the SSL (Secure Sockets Layer) or TLS (Transport Layer Security) protocols:

  • This means that third parties cannot directly intercept or read the content of the data during data transmission.

At the same time, HTTPS also uses certificates to verify the identity of the website:

  • When a user visits a website that uses HTTPS, the browser checks the website's certificate to ensure that the user is connecting to a verified and trusted website.

How HTTPS works :

  • The working principle of HTTPS is to add SSL/TLS handshake process and encryption algorithm on the basis of HTTP communication.
  • When a user visits an HTTPS website, the browser will shake hands with the server of the website, exchange encryption algorithms and keys, and then use the keys to encrypt and decrypt data.
  • In this way, even if the data is intercepted during transmission, it cannot be decrypted, thereby protecting the confidentiality and integrity of the data.

SSL


SSL (Secure Sockets Layer) is an encryption protocol used to protect the security of network communication, and it is used to establish a secure connection between the client and the server. It is a security protocol built on the Transport Layer (Transport Layer), which is mainly used to protect the security of sensitive data during network transmission.

SSL implements data encryption, integrity protection and authentication by using technologies such as public key encryption, symmetric encryption, and message digests. It uses digital certificates to verify the identity of the server and provides a secure means for two parties to exchange keys, encrypt and decrypt data.

How the SSL protocol works :

  • The client sends an SSL connection request to the server and provides the encryption algorithm and protocol version it supports.
  • The server verifies its identity through a digital certificate and sends the public key to the client.
  • The client verifies the validity of the server certificate and generates a random symmetric encryption key and encrypts it with the server's public key.
  • After receiving the encrypted symmetric key, the server uses its own private key to decrypt, and negotiates with the client on the symmetric algorithm and key used.
  • A secure connection is established between the client and server, and data transfers can be encrypted and decrypted using symmetric keys.

What is an SSL certificate :

  • SSL certificate (Secure Sockets Layer Certificate), also known as TLS certificate (Transport Layer Security Certificate), is a digital certificate used to verify the identity of a website and establish a secure connection.
  • The security of an SSL certificate depends on the trustworthiness and correct configuration of the certificate authority. Browsers and operating systems have built-in root certificates of many trusted certificate authorities for users to verify when connecting to websites with SSL certificates. If the certificate is valid and issued by a trusted authority, the browser displays a lock or a green address bar to indicate that the connection is secure.

What is TLS :

  • The SSL protocol later evolved into the TLS (Transport Layer Security) protocol in order to keep pace with the times and provide stronger security. Therefore, the common HTTPS communication now actually uses TLS to encrypt and protect data transmission.

IP


IP division method


Why divide IP :

  • Address allocation: Reasonable division of IP addresses can be effectively allocated to various networks and hosts, ensuring that each network and host has enough IP addresses available, and avoiding address conflicts.
  • Routing and Forwarding: Dividing IP addresses helps routers and network devices route and forward packets more efficiently. According to different network divisions, the router can decide to forward the data packet to the corresponding network interface according to the network part of the target IP address, so as to improve network performance.

How to divide IP :

  • Divide IP into network number and host number.
  • IP addresses can be allocated to different networks and hosts more efficiently, and the purpose of routing and forwarding can be achieved.
  • This division also facilitates network segmentation, security controls, and IP address management.

Use subnet mask to divide


  • Address category classification method:

    • The subnet mask is divided according to the class of IP address (class A, class B, class C).
    • For example, the default subnet mask of class A addresses is 255.0.0.0, the default subnet mask of class B addresses is 255.255.0.0, and the default subnet mask of class C addresses is 255.255.255.0.
  • Classless Inter-Domain Routing (CIDR) division method:

    • By adding a slash and a number (such as 192.168.0.0/24) after the IP address, the number indicates the number of consecutive 1s in the subnet mask, that is, the length of the network part.
    • In this way, IP addresses can be more flexibly divided according to specific requirements.

Other ways of dividing


  • VLAN division:

    • VLAN (Virtual Local Area Network) is a logical division method, which can divide a physical local area network into multiple virtual local area networks.
    • VLAN can be divided according to different requirements and security policies, not limited by IP address or subnet mask.
  • VRF (Virtual Routing and Forwarding) division:

    • VRF virtualizes multiple routing instances on the router, and each instance has an independent routing table and forwarding table.
    • Through VRF division, a physical network can be divided into multiple logical networks, and each logical network has an independent routing environment.
  • Virtualization division:

    • Virtualization technology can divide a physical server into multiple virtual machines, and each virtual machine has an independent operating system, network and resources.
    • Through virtualization, a physical network can be divided into multiple logical networks, which can be flexibly adjusted and managed according to requirements.

Public IP & Private IP


Why divide IP into public IP and private IP :

  • IP address resource limitation:
    • The address space of IPv4 is limited, only about 4.2 billion addresses are available.
    • Public IP addresses are limited and must be reasonably allocated to organizations and institutions on the Internet.
    • Whereas private IP addresses are reserved for internal use and can be freely allocated within an organization without registration or payment to the Internet.
  • cyber security:
    • Using a private IP address can increase the security of your network.
    • Private IP addresses can only be used within a specific private network and cannot be accessed directly from the Internet.
    • This provides a layer of protection for the network, effectively preventing unauthorized external access and attacks.
  • Subnetting:
    • Private IP addresses can allow for more flexible subnetting within an internal network.
    • Organizations can freely divide subnets according to their own needs and topology to meet actual network connection and management requirements without applying for additional IP addresses from any external organization.

Distinguish between public IP and private IP


The IP addresses used in our offices, homes, and schools are generally private IP addresses. Because these addresses allow the IT staff within the organization to manage and assign themselves, and they can be repeated. Therefore, a private IP address of your school can be the same as mine.


NAT


What is NAT :

  • Network Address Translation (NAT)
  • Convert an IP address used in one network to an IP address used in another network.
  • The main purpose of NAT technology is to solve the problem of IPv4 address exhaustion, and it can also provide network security and flexibility.

What is responsible for the conversion :

  • NAT technology is usually implemented on routers, which operate at the network layer (layer 3 of the OSI model) to translate IPv4 addresses.
  • It combines the source IP address and port, destination IP address and port, and creates a mapping table that maps private IP addresses and ports on the internal network to public IP addresses and ports on the external network.

What is the use of NAT :

  • IP address translation:
    • NAT technology realizes the translation of private IP addresses (such as 192.168.xx) into public IP addresses.
    • Devices on the internal network can communicate with the external network by sharing a public IP address without assigning a public IP address to each device.
  • Port translation:
    • NAT technology can also map devices and services on the internal network to different ports on the external network through port mapping.
    • Multiple services (such as Web server, FTP server, etc.) can be provided on one public IP address without assigning a separate public IP address to each service.
  • Dynamic address allocation:
    • Using NAT technology, routers can automatically assign temporary public IP addresses to devices on the internal network.
    • This method is called dynamic NAT, which can reduce the consumption of public IP addresses and the complexity of management.

NAT penetration


Intranet traversal (NAT traversal) is a network technology used to access servers or applications located in a private network (intranet) through a public network (such as the Internet).

Usually, the devices in the private network cannot be directly accessed from the external network , because the private network uses non-public IP addresses, and there may also be limitations of network devices such as firewalls and routers.

The intranet penetration technology realizes the mapping of services in the private network to the public network through some special technical means, so that external networks can access and use these services. It involves two main components: internal endpoints (on private networks) and external endpoints (on public networks).

The working principle of intranet penetration :

  • Usually by deploying an intermediate proxy (such as a reverse proxy or VPN service) on a device in the internal network, the proxy creates a channel on the public network to forward requests from the external network to the target device in the internal network.
  • In this way, users can use the public network to connect to the services of the internal network no matter where they are.

Application scenario of intranet penetration :

  • Remotely access servers or applications within your enterprise.
  • In the development and test environment, access the internal test server from the external network.
  • On a home network, access files or media located on a home network device.

Some common intranet penetration tools and protocols include: ngrok, frp, SSH reverse tunnel, VPN, etc. These tools and protocols provide different functions and configuration options to meet different intranet penetration needs.


VPN


VPN, full name ( Virtual Private Network ), that is, a virtual private network, is a technology that establishes a private and encrypted connection through a public network (such as the Internet):

  • A VPN enables data transmitted over a public network to be transmitted securely and privately by creating an encrypted tunnel between two communicating nodes (such as a user device and a corporate network).

What a VPN can do :

  • Bypass geo-restrictions:
    • A VPN can connect to a server located in another country or region, allowing users to obtain an IP address in that region when browsing websites or using online services.
    • This allows users to bypass geo-restrictions and access blocked or restricted content, websites or services.
  • remote access:
    • Enterprises can use VPN technology to provide employees with remote access to the company's internal network. Employees can connect to the company's network through a VPN and access internal resources and applications without being in the office.
  • Surf anonymously:
    • By connecting to a remote server through a VPN, users can surf the Internet with the IP address of the region where the server is located, thereby hiding their real IP address and realizing anonymous surfing.

VPN can be implemented through various protocols, such as IPSec, OpenVPN, PPTP, L2TP, etc. Users can connect to a VPN server and establish a secure connection by installing a VPN client on a computer, smartphone, or other device. At the same time, many companies and service providers also provide VPN services for users to choose and use.


ICMP


ICMP (Internet Control Message Protocol) is the abbreviation of Internet Control Message Protocol.

  • It is a network protocol used to transmit control information and error reporting over IP networks.
  • ICMP usually carries control information and error reports in the header of IP data packets, and these information and reports can help network devices diagnose and solve various network communication problems.

What is ICMP useful for :

  • Error Reporting: ICMP generates an error report when an error occurs during the transmission of a data packet, such as destination unreachable, timeout, etc.
  • Detection and diagnosis: ICMP can also be used for communication detection and diagnosis between network devices to determine the availability and status of network connections, such as sending ICMP Echo requests through the Ping command to test the reachability of hosts.
  • Routing information: ICMP can also be used to transmit routing information, for example, a router can notify the sender of a better path selection through an ICMP redirect message.

Common ICMP packets


ICMP message types are different types of messages defined in the ICMP protocol for control and error reporting in the network:

  1. Echo Request / Echo Reply (Type 8 / Type 0): Used for network connectivity testing, the common Ping command uses the ICMP Echo message type.

  2. Destination Unreachable (type 3): It is used to indicate that the data packet cannot reach the destination host. Possible reasons include destination port unreachable, network unreachable, host unreachable, etc.

  3. Source Quench (Type 4): Used to inform the sender to reduce the sending rate to avoid network congestion.

  4. Redirect (Type 5): It is used to notify the sender to use a better route to improve the forwarding path of data packets.

  5. Time Exceeded (type 11): Used to indicate that the time-to-live (TTL) of the packet has expired, usually when routing loops or transmission delays are too high.

  6. Parameter Problem (Type 12): It is used to indicate some parameter errors in the data packet, such as incorrect IP header length, etc.

  7. Timestamp Request / Timestamp Reply (Type 13 / Type 14): Used to provide timestamp information for network diagnosis and synchronization.

  8. Address Mask Request / Address Mask Reply (type 17 / type 18): used to request or reply subnet mask information, used for subnet address configuration.

These are just some of the common ICMP message types, ICMP has other types for different control and error reporting purposes. Each message type has its specific purpose and format.


Ping


What is Ping :

  • Command general format:ping <目标IP或域名>
  • The Ping command is a commonly used network tool that can be used in the command line interface to test the reachability of network devices and the latency of network connections.
  • It uses the Echo request and Echo reply messages of the ICMP protocol.

How Ping works :

  • After executing the Ping command, the system will send an ICMP Echo request packet to the target host, and wait for the target host to reply with an ICMP Echo reply packet.
  • The Ping command will show the round trip time (RTT) of each packet and the percentage of packet loss (if any). By observing the Ping results, you can judge the reachability of the target host and the quality of the network connection.

For example:


127.0.0.1&localhost


What is 127.0.0.1 :

  • 127.0.0.1 is the local loopback address (loopback address), also known as the local host address. It is a special address in the IP address used to indicate the local host or the machine itself. Is part of the IPv4 address range.
  • When an application on the computer tries to connect to this address, the data packets are not transmitted over the network, but are sent directly to the local network interface for processing. Therefore, 127.0.0.1 is used for self-testing and loopback detection of the local host.
  • Usually, when accessing a certain network service on the local machine, the target address can be set to 127.0.0.1, so that the application program will send the request to the local host for processing, thereby realizing the testing and debugging of the local service.

what is localhost

  • localhost is a special host name (hostname) used to represent the local host or the machine itself. It has the same meaning as the IP address 127.0.0.1, both indicating the local loopback address. In network protocols, localhost is often used for local host testing and loopback detection.
  • Compared with 127.0.0.1, localhost is more like a symbolic name, an alias in network communication. Normally, localhost resolves to the IP address 127.0.0.1. This means that when the application tries to connect to localhost, it actually connects to the loopback address of the localhost, realizing the self-test and loopback detection of the localhost.

What is the difference between :

  • Format:
    • 127.0.0.1 is a specific IP address, which is part of the IPv4 address space;
    • And localhost is a host name, which is a symbolic name used to represent the local host.
  • scenes to be used:
    • 127.0.0.1 is commonly used in network settings in applications or operating systems, especially when testing and debugging local network services;
    • Localhost is more commonly used in some applications or configuration files, and is used when accessing local services or specifying servers.

Let’s ping 127.0.0.1 first:

Let’s ping localhost again:

Summary :

  • 127.0.0.1is the loopback address . localhostis the domain name , equal to by default 127.0.0.1.
  • In most cases, localhost will resolve to the IP address 127.0.0.1, but there may be exceptions, such as in some network environments or configurations, localhost may be set to other IP addresses. But in any case, the role of localhost is to represent the local host or the machine itself, which is used for local network connection and loopback testing.

Guess you like

Origin blog.csdn.net/LYS00Q/article/details/131508897