In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
To build a basic network, it only takes a hub (Hub) or a switch, several network cards and dozens of meters of UTP cable.
In fact, such a simple network is the basic unit of a more complex network. By interconnecting these small, simple networks, it is formed.
A more complex local area network (LAN).
3.1 the simplest network
As shown in the figure, several computers can be connected together with a simple Hub, so that several computers can be connected to each other.
Computers are connected together. After buying a hub, simply connect the computers to the hub with a twisted pair
There is no need to do anything else, a simple network is built successfully.
The function of a hub is to help the computer forward packets. It is the simplest network device. The working principle of the hub is very simple
When a hub receives a packet from one port, it simply forwards the packet to all ports. Send the message of the host packet
The header contains the MAC address of the target host, and only hosts with the same MAC address will receive packets, while other hosts will not
Receive the Datagram.
3.2 basic technology of network connection
3.2.1 data encapsulation-the basis of computer network communication
Before sending a packet, the host needs to encapsulate the header for each segment. In the header, the most important thing is the address.
Figure 3.2 packet segmentation and encapsulation
As shown in figure 3.2, the Datagram is added with a frame header (Frame Header), an IP header (IP Header),
TCP header (TCP Header), trailer (Frame Trailer). A data segment that is encapsulated at the end of the header and is
It is called a data frame.
There are two purposes for segmenting data transmission by frame: data error retransmission and communication line contention balance.
The frame header (Frame Header) contains the destination MAC address and source MAC address
The IP header (IP Header) contains the destination IP address and the source IP address
The TCP header (TCP Header) contains the destination port (port) address and the source port (port) address.
The network card decides whether to receive the Datagram by judging whether the Datagram MAC address is the same as its own.
When building a complex network, we need to know not only the address of the target host, but also the network location of the target host.
Address. The IP address contains both the network address and the host address. When a Datagram is sent from the source host to the destination host
Router devices in the Internet need to query the network address information part of the IP address in order to know that the data should be reported.
To which network it is sent, and then sent to the target host through the host address portion of the IP address.
When the data reaches the target host through the joint addressing of the MAC address and the IP address, the target host gives the Datagram to an application
Program to deal with, but how to determine which application to hand over? This is through the final destination port (port) address
To be sure.
Thus, to complete the data transmission, three levels of addressing are required:
IP address is used for internetwork addressing
MAC address is used for network segment addressing
The port address is used for application addressing.
The tail of frame (Frame Trailer) is used for data intact check. The more popular frame check algorithms are CRC check and two-Vicky even check.
Check (Two-dimension parity), Internet check (Internet checksum).
3.2.2 MAC address
If 3. 3, the higher 3 bytes (00 602F) represents the manufacturer's enterprise code (OUI), and the lower 3 are random numbers. Need
Ensure that the MAC addresses of each host in the local area network are unique.
The special MAC address FF:FF:FF:FF:FF:FF is the broadcast address, and the Datagram using that address indicates that the frame data is sent
For all mainframes.
3.2.3 Network Card
The network card solidifies the MAC address.
There is a MAC address comparison circuit to determine whether the MAC address of the Datagram is the same as itself to decide whether to receive the Datagram or not.
3.2.4 Ethernet
In Ethernet, if multiple hosts need to communicate at the same time, who will compete for the transmission medium (communication line) first?
Whoever gets the right to send data is called bus contention for media access.
In addition, there is token network technology, which takes turns to obtain media access through tokens.
Ethernet specification: IEEE 802.3 protocol
Token Network Specification: IEEE 802.5 Protocol
Figure 3.4 Media access control technology
3.2.5 IEEE 802.3 data frame structure
Figure 3.5 frame format of IEEE 802.3
Synchronization field (Preamble): the early field used for synchronization pulse. The value is fixed at 01010101. It is no longer used now, so it is reserved.
To maintain compatibility.
Start tag field (Start of Frame Delimeter): the value is fixed at 10101011.
Destination MAC address field (Destination Address): destination host MAC address. All one is the broadcast address.
Source host MAC address field (Source Address): source host MAC address.
Frame length / Type field (Length/Type): indicates the length when the value of this field is less than 0x0600
When greater than 0x0600, represents the type.
The length refers to the number of bytes of the data frame; the type indicates that the upper layer of the host is accepted.
For example, ARP, this field should be 0x0806.
Data (Data): frame data. The minimum is 46 bytes and the maximum is 1500 bytes. The minimum number of bytes for a frame is specified for timing.
Yes, if it is not enough for this byte, it needs to be filled in.
Frame check byte (Frame Check Sequence): a 4-byte CRC check value.
Before IEEE 802.3, there was an Ethernet protocol, but now IEEE 802.3 is compatible with the Ethernet protocol.
To distinguish whether the segment Length/Type is 0x0600.
3.3 Ethernet switch
3.3.1 how Ethernet switches work
The switch is used to replace the hub (Hub) to connect PC, servers and peripherals into a network.
What distinguishes a switch from a hub is that it can provide multiple point-to-point links at the same time, thus greatly increasing the network bandwidth.
Figure 3.6 switching table in an Ethernet switch
The core of the switch is the exchange table. The exchange table is a table that maps switch ports to MAC addresses.
After a frame of data arrives at the switch, the switch takes out the destination MAC address from the packet header and looks up the table to know which port it should go to.
Forward, which in turn forwards the data frame out the correct port. If the switch cannot find out which port to forward to, the
All ports forward.
So how did you get the exchange table? The switch obtains the exchange table through self-learning. The exchange table is placed on the switch
In the memory of the switch, when the switch is powered on, the exchange table is empty, at this time, if the master 0260.8c01.1111 in figure 3.6
When the computer sends a message to the 0260.8c01.2222 host, the switch cannot look up the table to know which port it should forward to.
Message, and then forwarded to all ports. Although the switch does not know which end the target host 0260.8c01.2222 is on
Port, but it knows that the message is from port e0, so after forwarding the message, the switch sends the source MAC address of the frame header
0260.8c01.1111 is placed in the e0 port row of its exchange table. The switch recognizes MAC addresses in the same way for other ports.
After a while, the switch gets a complete exchange table.
Figure 3.7 the E1 port of the switch (left) bundles multiple MAC addresses
When a switch is cascaded, multiple MAC addresses can be bundled on a single port. As shown in figure 3.7, when the switch is cascaded, the
The MAC addresses of hosts connected to other switches are bundled to the cascading ports of this switch.
In order to avoid junk addresses in the exchange table, the switch will clear the exchange table and relearn every once in a while.
Of course, this will also cause a waste of bandwidth. The new smart switch can choose to forget the traffic that has not been communicated for a long time.
MAC address, which in turn improves the performance of the switch.
If you connect a simple network with an Ethernet switch, a new switch does not require any configuration, and each host
Connect to the switch and work.
3.3.2 types of Ethernet switch
Cut-through (cut through) and store-and-forward (store and forward).
After receiving the message, the cut-through switch can forward it as soon as it receives the destination MAC address in the header. There is no need to wait.
Wait for the entire data frame.
The storage and forwarding mode first performs the CRC check on the received message, and then confirms according to the MAC address in the frame header and the exchange table.
The output port for forwarding is determined, and then the message is queued and forwarded in the cache of that output port.
Cut-through fast, but will forward damaged packets; while store-and-forward years have delay, but do not forward bad packets, high reliability and save CPU
Resources and bandwidth.
In addition, quality of service first (QoS) technology can only be implemented in storage-and-forward switches.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.