• What is network protocol

    Network protocol A set of rules, standards, or conventions established for the exchange of data in a computer network

    At ordinary times we signed the contract, for example, it is mainly used for restraint on both sides of some behavior, and must abide by the rules and conventions, so does the network protocol, if you want to come to a communication, must both sides of the constraints, if two terminal use different character sets, then two terminals send messages will not be able to identify each other, so unable to complete the communication, in order to communicate, It is stipulated that each terminal must transform the characters in its own character set into the characters of the standard character set before entering the network for transmission. After reaching the destination terminal, the characters are converted into the characters of the terminal character set

  • Network interconnection model

    • Origin of network interconnection model

      Said to the role of the network protocol, if the rules of the network protocol without a fixed standard so everyone everyone with protocol standard is not the same, so everyone got a new agreement will to learn new standards, at the same time if it is a development need access to both the company’s servers, two server protocol, Developers are required to be familiar with the standards of both protocols. Therefore, an international standard has emerged to regulate the standard of network protocol, i.eNetwork interconnection model

    • Network interconnection model concept

      Is the OSI reference model has 7 layers structure (from low to high respectively is the physical layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer), the OSI reference model is a standard model, approved by the network model in practical application is TCP/IP protocol reference model (is actually the session layer, presentation layer, Application layer merging into the application layer, physical layer, data link layer consolidated into the network interface layer) four layer model (from low to high: the network interface layer, network layer, transport layer, application layer), there are also studies use the five layer model of the difference between the international standard is to the session layer, presentation layer, application layer merging into the application layer, other are all the same

  • Network request process

  • The basis of communication between computers

    • The first step is to know the IP address of the receiver
    • The next step is to find the corresponding network adapter address (that is, the MAC address) by IP, and then send the data to the network adapter
    • The NIC checks the MAC address of the target to determine whether it is the nic. If it is not, the NIC discards the data. If it is, the NIC sends the data to the upper layer for processing
  • The way computers are linked to each other

    • Straight connection of network cables (crossover cables)

      It’s easy to understand that two computers are connected by a network cable, which we can use herePacket TracerThis tool Through the simulation experiment, we can also see that two computers can communicate

    • Coaxial cable

      A single signal cable connects multiple machines as shown belowThe way it works is that if one computer sends a signal the coaxial cable will be sent to all the computers that are connected to it knowing where the terminating resistance is compared to the direct line which is connected to multiple machines at the same time.

      The disadvantages are also obvious

      • Half duplex communication (both parties can send messages, but not simultaneously (and therefore not simultaneously))
      • If two machines send messages at the same time, there will be a conflict, so it is easy to conflict
      • No, a message sent by one computer will be sent to everyone.
      • Cannot communicate across network segments
    • A hub

      Hubs basically functional advantages and disadvantages and coaxial cable, the only advantage is that unlike the coaxial cable of the column in the middle line broke the whole network is paralyzed, hub is a computer link line is broken This is the only a computer can’t normal communication other are normal, the rest and coaxial cable, as is half duplex communication, It is also insecure and cannot communicate across network segmentsSignals from two computers at the same time will conflict as shown below

    • The bridge

      The bridge has only two interfaces. Unlike the above devices, it can remember the MAC address of each interface and thus isolate the conflict domain, as shown in the following figureComputer 2 sends the message with the MAC address of the host so the bridge remembers that the interface to its left has the MAC address of computer 2, but the first time it sends the message is ARP broadcast and there’s no target MAC address so it still sends it to everyone, When the target computer replies with the MAC address of computer 2, it sends a message back with the MAC address of computer 2. Therefore, the reply does not go to computer 3 or computer 4, and the final message is also the same

      When the bridge remembers all the MAC addresses on both sides, it can send messages in about two days at the same time (if it knows the MAC address of the target, it will send ARP broadcast or send arp broadcast to everyone) as shown below:

    • switches

      Popular point will be more interface bridge, full duplex communication, but also have memory function, so that it is more secure, but also can effectively solve the problem of conflict, but can not solve the problem of cross-segment access

      As shown in the figure above, messages can be sent at the same time, and messages are not sent to all users. Those who think that the switch has the memory function can know the MAC address of each interface

    • The router

      The coaxial cable, hub, switch and bridge mentioned above must be in the same network segment. If cross-network segment access is required, a router is needed.

      If you do not know the MAC address, you will send an ARP broadcast to find the MAC address, but the ARP broadcast is sent in the same broadcast domain. Devices on the same network segment are connected to a LOCAL area network (LAN). The set of all devices is called the broadcast domain. Now, cross-segment access is performed, so the communicating party cannot receive ARP broadcasts.

      In this case, you need to use a router. Before sending data, all devices will determine whether the IP address of the communication partner is in the same network segment as their own

      • In the same network segment, send ARP broadcast directly as described above
      • If the data is not on the same network segment, the router needs to forward the data. The router interface provides a gateway for cross-network access. The data is first sent to the gateway and then transmitted to the corresponding network segment by the router

      Therefore, if you want to send data across network segments, ARP broadcast will be sent first, but the IP address is not the target IP address but the gateway IP(the router and computer need to set the gateway IP, and the gateway IP must be in the same network segment as the linked broadcast domain). After obtaining the gateway MAC address, data will be sent to the gateway. After receiving the data, the router sends it to the specified network segment and then finds the MAC address of the target IP address to complete the data transmission. The whole process is shown in the following figure

  • Packet transmission process

    I’m going to talk a little bit about how IP and MAC addresses change during transmission and we’ll talk more about that later

    The diagram below:Computer 0 communicates with computer 2. The destination IP and the source IP remain the same throughout the process, but the MAC address keeps changing as it passes through more devices as shown in the figure above.

  • ISP

    Internet Service Provider refers to the Internet Service Provider, such as China Mobile, China Telecom, Netcom, and Tietong

    Like we get to the Internet at ordinary times at this time we need access to a server in Beijing in xinjiang, our own economic strength may not allow ourselves to deploy a network has been to Beijing, so this time need ISP to help us access to the Beijing server (that is, the deployment of the network’s job to provider do we pay for them to provide us with the interface on the Internet)

  • Network classification

    • Local Area NetWork (LAN)
      • Generally, it is a computer network composed of computers in a range of several hundred meters to ten kilometers
      • The most widely used networking technology in lans is Ethernet.
      • WLAN(Wireless LAN)
    • Metropolitan Area NetWork (MAN)

      The general range is tens of kilometers to hundreds of kilometers, can cover a city

    • Wide Area NetWork (WAN)

      The typical range is hundreds to thousands of kilometers, can cover a country, usually will rent ISP lines

  • Common interfaces

    • FastEthernet

      Fast Ethernet interface (also known as 100m interface)

    • GigabitEthernet

      Gigabit Ethernet interface

      Usually at home for broadband is gigabit, but their network speed is found to be gigabit broadband, at this time you can check whether your router has gigabit Ethernet interface, if not, then your network speed can only reach gigabit

    • Serial

      Serial interface

      Used to connect routers (necklaces between routers can also use Ethernet ports as shown below)

  • Internet connection

    • Telephone line accessAs shown above:
      • Modem: a modem that converts digital signals to analog signals
      • Asymmetric digital subscriber line, providing the transmission bandwidth called by the upstream and downstream forces (that is, usually their own home network speed measurement, upload speed is often slower than the download speed)
    • The optical fiber asThis is an optical modem that converts digital signals to optical signals
  • The logic structure of home wireless router

  • Public IP address and private IP address

    • Public IP Address Public IP addresses can be connected to external networks. All public IP addresses in the world are unique. Routers on the Internet have only the routing table to the public network, but not the routing table to the private network. ISP needs to apply for public IP from Inter NIC, that is, if we go to broadband ISP will allocate a public IP to you so that your home can connect to the Internet

    • The biggest difference between a private IP address and a public network is that a private IP address is limited to a LOCAL area network (LAN) and cannot be connected to an external network. If multiple devices are not on the same LAN, their private IP addresses may be the same. But in the same LAN private IP must be unique, usually we deal with the broadband is to divide you a public IP, and then the whole family equipment link to travel a LAN and then share the public IP, so generally we can see the IP are private IP.

      Reserved private network segment used mainly for lans:

      • Class A: 10.0.0.0/8, 1 Class A network,
      • Class B: 172.16.0.0/16 to 172.31.0.0/16:16 Class B networks
      • Class C: 192.168.0.0/24 to 192.168.255.0/24, 256 Class C networks
  • NAT

    NAT is used to configure private IP addresses on the Intranet and translate them into public IP addresses on border devices, such as routes or firewalls, to access the Internet. In this way, there is no need to configure public IP addresses for each terminal device on the LAN, and public IPV4 addresses are exhausted.

    Configuration mode:

    1. Static translation: Manually configure the NAT mapping table to implement one-to-one translation
    2. Dynamic translation: Defines the external address pool, dynamic random translation

    The disadvantage is that you can only convert one to one and you can use PAT

    PAT: Implements many-to-one conversion to minimize public IP address resources. Ports are multiplexed to identify different data flows by port numbers