To form a basic network, you need only one hub (hub) or one switch, several NICs, and dozens of-meter UTP lines to complete.
In fact, such a simple network is the basic unit of a more complex network. By connecting these small, simple networks together, they form a
More complex local area networks (LANs).
3.1 The simplest network
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/82/1C/wKioL1dL8SuxD8-BAAGyseXLHG4802.jpg-wh_500x0-wm_3 "Title=" qq20160530154707.jpg "width=" 229 "height="-wmp_4-s_2704800497.jpg "border=" 0 "hspace=" 0 "vspace=" 0 "style = "width:229px;height:180px;" alt= "Wkiol1dl8suxd8-baagysexlhg4802.jpg-wh_50"/>
, you can connect several computers together by simply using a hub (hub), so that computers can be counted
Connected to the computer. Once you have purchased a hub, simply use the twisted pair to connect the computers and hubs together,
There is no need to do anything else, and a simple network is built to succeed.
The function of the hub is to help the computer forward the packet, which is the simplest network device. A hub works very simply,
when a hub receives a packet from a port, it simply forwards the packet to all the ports . Sending the host packet's report
Header contains the MAC address of the destination host, only the host that is the same as the MAC address receives the packet, and the other host does not
Receive the datagram.
3.2 Basic Technology of network connection
3.2.1 Data Encapsulation-the basis of computer network communication
Before a packet is sent, the host needs to encapsulate the header for each data segment. And in the header, the most important is the address.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/82/1C/wKioL1dL9hWyte4UAABf7QzvAgA748.jpg "title=" Qq20160530160735.jpg "alt=" Wkiol1dl9hwyte4uaabf7qzvaga748.jpg "/>
Figure 3.2 Fragmentation and encapsulation of packets
3.2, the datagram is added to the frame header, the IP header (the IP header),
TCP Header (TCP header), frame Trailer. A data segment that is encapsulated in the tail of the header is
Called a data frame .
There are 2 purposes for data fragmentation by frame: Data error re-send, communication line contention balance.
The frame header contains the destination MAC address and the 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 address and the source port address.
The network card decides whether to receive the datagram by judging whether the MAC address of the datagram is the same as itself.
When building a complex network, we need not only to know the destination host's address, but also to know the target host's network location
Access. The IP address contains two information for the network address and host address. When sending data from the source host to the target host,
Router devices in the Internet need to query the IP address of the network address Information section in order to know to send the data
Which network is sent to the destination host via the host address portion of the IP address.
When the data is reached through a federated addressing of the MAC address and IP address to the target host, the target host will deliver the datagram to an application
program to handle, but how to determine which application to give? This is the last destination port address
To make sure of it.
Thus, to complete the data transfer, three-level addressing is required:
IP addresses are used for inter-network addressing,
The MAC address is used for network segment addressing,
The port address is used for application addressing.
Frame Trailer is used for data good check, the more popular frame check algorithm has CRC check, two-dimensional parity school
(two-dimension parity), Internet checksum.
3.2.2 MAC Address
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/82/1D/wKioL1dL_9jztS9SAABRCJT9Pq0996.jpg "title=" Qq20160530164959.jpg "alt=" Wkiol1dl_9jzts9saabrcjt9pq0996.jpg "/>
If 3.3, the height of 3 bytes (2F) represents the manufacturer of the Enterprise Code (OUI), the low 3 itself is a random number. Need
Ensure that the MAC address of each host in the LAN is unique.
A special MAC address, FF:FF:FF:FF:FF:FF, is a broadcast address, and a datagram using that address indicates that the frame data is
To all the hosts.
3.2.3 Nic
The NIC cures the MAC address.
With the MAC address comparison circuit, determine whether the MAC address of the datagram and its own to determine whether to receive the datagram.
3.2.4 Ethernet
In Ethernet, if more than one host needs to communicate at the same time, then these hosts who first win the transmission media (communication lines),
Who gets the right to send data, the technology is called bus contention media access .
There is also a token-network technology, which takes each of the tokens in turn to gain access to the media.
Ethernet Specification: IEEE 802.3 protocol
Token network specification: IEEE 802.5 protocol
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/82/1D/wKioL1dMA-DiI2KcAABd2_OMiX8086.jpg "title=" Qq20160530154707.jpg "alt=" Wkiol1dma-dii2kcaabd2_omix8086.jpg "/>
Figure 3.4 Media access control technology
3.2.5 IEEE 802.3 data frame structure
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/82/1D/wKioL1dMBJ-zF5zYAAC1n95X1H8498.jpg "title=" Qq20160530171042.jpg "alt=" Wkiol1dmbj-zf5zyaac1n95x1h8498.jpg "/>
Figure 3.5 The frame format for IEEE 802.3
Synchronization field (Preamble): The field used to synchronize pulses earlier, with a fixed value of 01010101, is now unused, reserved
To maintain compatibility.
Start Tag field (start of Frame delimeter): The value is fixed to 10101011.
Destination MAC Address field (Destination address): Destination host MAC address. All 1 are broadcast addresses.
Source Host MAC Address field (source address): Origin host MAC address.
Frame Length/Type field (Length/type): Indicates length when the field value is less than 0x0600;
Represents a type when it is greater than 0x0600.
Length refers to the number of bytes of the data frame, and the type represents the upper association
such as ARP, the field should be 0x0806.
Data: Frame data. A minimum of 46 bytes, and a maximum of 1500 bytes. Specifies the minimum number of bytes for a frame to be
To, if this byte is not enough, it needs to be populated.
Frame Check byte Sequence: A 4-byte CRC checksum value.
Before IEEE 802.3, there was also a Ethernet protocol, now IEEE 802.3 is already compatible with the Ethernet protocol, using the word
Whether segment Length/type is 0x0600 to distinguish.
3.3 Ethernet Switch
How the 3.3.1 Ethernet switch works
Switches are used instead of hubs to connect PCs, servers, and peripherals into a single network.
A switch that differs from a hub is the ability to provide multiple links at the same time to a point-to-point, which greatly improves network bandwidth.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/82/20/wKiom1dMCB_T3ZLZAAIV-deTCFA853.jpg "title=" Qq20160530171042.jpg "alt=" Wkiom1dmcb_t3zlzaaiv-detcfa853.jpg "/>
Figure 3.6 Exchange table in the Ethernet switch
the core of the switch is the exchange table . The swap table is a map of the switch port and MAC address .
After a frame of data arrives at the switch, the switch takes the target MAC address out of the header and checks the table to see which port
Forwards, and then forwards the data frame from the correct port. If the switch does not check which port to forward, the
All port forwarding.
So how did the exchange table get it? Switches are obtained by self-learning to exchange tables. The exchange table is placed on the switch
In memory, when the switch is just power on, the swap table is empty, at this point, if the 0260.8c01.1111 master in Figure 3.6
When the machine sends a message to the 0260.8c01.2222 host, the switch cannot find out which port it should be forwarded to
Message, and then forwards it to all ports. Although the switch does not know which side of the target host 0260.8c01.2222 on its own
Port, but it knows that the message comes from the E0 ports, so after forwarding the message, the switch then puts the source MAC address of the frame header
The 0260.8c01.1111 is placed in the E0 Port row of its swap table. The switch also recognizes MAC addresses on other ports,
After a time, the switch gets the complete exchange table.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/82/1F/wKioL1dMDnSR2M8kAAF354h8I6c766.jpg "title=" Qq20160530171042.jpg "alt=" Wkiol1dmdnsr2m8kaaf354h8i6c766.jpg "/>
Figure 3.7 The E1 port of the switch (left) bundles multiple MAC addresses
When a switch is cascaded, one port can bundle multiple Mac addresses. 3.7, when the switch is cascaded, the connection
The MAC address of the host that receives the other switch is bundled into the Cascade port on the switch.
In order to avoid the junk address in the exchange table, the switch will clear the exchange table and re-learn every time.
Of course, this will also be a waste of bandwidth, the new smart switch can choose to forget those long time no traffic
MAC address, which in turn improves switch performance.
If you connect to a simple network with an Ethernet switch, a new switch does not require any configuration, and the individual hosts
Connect to the switch and it will work.
3.3.2 Types of Ethernet Switches
Straight-through (cut through) and storage-forward (store and forward).
The straight-through switch can be forwarded immediately after receiving the message, and the target MAC address in the header is not required.
To the entire data frame.
The storage and forwarding type first carries on the CRC check to the received message, then according to the frame header's MAC address and the exchange table, actually
To the output port, and then put the message in the buffer memory of the output port to queue and forward.
Pass-through is fast, but the damaged packet is forwarded, while the store forwards the old with delay, but does not forward bad packets, high reliability, save CPU
Resources and bandwidth.
In addition, service quality First (QoS) technology can only be implemented in storage-forward switches.
This article is from the "Jimokuangxiangqu" blog, make sure to keep this source http://4594296.blog.51cto.com/4584296/1784556
Computer network Learning (3): Build a Simple network