Basic principles and configuration of switches under the data link layer

Data link layer function

The data link layer is located between the network layer and the physical layer.
data link layer
What are the specific functions of the data link layer?

Insert picture description here
The interconnection between the network card and the network card

Ethernet frame format

Insert picture description here
For the introduction of MAC address, our IP address is 32-bit, and the MAC address is 48-bit binary, divided into six segments. If the last bit of the first segment of the MAC address is 1, it is a logical address, and if it is 0, it is Physical address. MAC is usually represented by six-segment dotted hexadecimal in life. The first three paragraphs usually indicate the manufacturer, and the latter three paragraphs are the physical serial numbers.

Insert picture description here
The format of the data frame is
mainly the source and destination MAC address + the protocol type of the upper layer is IP or ARP + the data transmitted from the upper layer, which constitute the data frame. Down to the physical layer will encapsulate a "preamble"
Insert picture description here

How the switch works

Here we mainly understand the working principle of the switch.
First of all, we need to understand that the switch does not have the function of autonomous learning. It only records the MAC address into the MAC table through the MAC address contained in the received data frame, and the life of the MAC address table The cycle is only 300 seconds. Therefore, it will be necessary to relearn the MAC address to generate records after a while.
1. In the initial state
, the three hosts A, B, and C are connected to the switch. The switch does not record any MAC addresses. At this time, our machine A sends a data frame containing the MAC addresses of itself and machine B to the switch.
2.
MAC address learning The switch will query its own MAC address table at this time. If the relevant MAC address is not queried, then the port A connected to the switch will be recorded by the switch from A’s MAC address to its MAC address table. in. (As long as the sent data frame passes through the switch port, the sender’s MAC address will be recorded in the address table)
3. Broadcast unknown data frames.
Because there is no corresponding destination MAC address sent by A in the switch’s MAC table, the switch will monitor all networks. The device of the port broadcasts, that is, the data frame sent by A is sent to all the devices connected to this switch for identification.
4. The receiver responds
here and sent it to device B and device C. After receiving the data frame, B finds that A's destination MAC number matches with B's own source MAC number after receiving the data frame, and then sends B's own MAC address and A to device A The MAC address is encapsulated into a data frame to respond, and the C device finds that the MAC address does not match after receiving it, and discards it directly.
5. The switch realizes unicast communication.
B responds to A through the encapsulated data frame unicast process. When passing through the switch, record the switch port corresponding to the MAC of the B device to the MAC table for recording, and then pass the check The table finds that our destination MAC address A has been recorded in the table, and the data frame is sent directly to the port corresponding to A. After A receives it, it directly sends the data to be transmitted through the switch and the known switch MAC table for unicast communication

Insert picture description here

Switch command configuration

Here we use eNSP as an example.
User view mode <Huawei> switch to system view mode [Huawei]
<Huawei >system-view
1. History command query
[Huawei] display history-command

2. Configure the host name
<Huawei> system-view
[Huawei] sysname Router1

3. Status information query
<Huawe i>display version ####View VRP version
<Huawei >display users ####View user terminal information

4. Enter interface mode and view information
<Huawei>sys
[Huawei] int g0/0/o
[Huawei-GigabitEthernet0/0/0]dis this ####View the configuration information in the current view

5. Configuration file management command
[Huawei]display saved-configuration ###View the information saved by the device
[Huawei]display current-configuration ###View the current configuration information of the device
<Huawei >reset saved-configuration ###Erasing the storage The configuration file in the device
<Huawei >compare confiauration ###Compare whether the current configuration information is consistent with the saved file in the storage device

6. Close Huawei's information prompt center
[Huawei] undo info-center enable
or
<Huawei >undo terminal monitor

7, eternal time
[Huawei] user-interface console o
[Huawei-ui-console0] idle-timeout oo

8. Configure duplex and rate commands
<Huawei >sys
[Huawei]int g0/0/1
[sw1一Ethernet0/0/1] undo negotiation auto ###Turn off auto negotiation
[Sw1-Ethernet0/0/1] speed 100 ###Adjust to speed 100M
[Sw1-Ethernet0/0/1] duplex full ###Adjust to full duplex mode,
explanation: full:Full-Duplex (full-duplex mode) half: Half-Duplex (half-duplex) mode)

9. Save the configuration <Huawei> save

10. Set the remote login password
[Huawei]user-interface vty 0 4 #0 is the initial value, 4 is the end value. Means that you can open 5 sessions at the same time to enter the switch to configure the command
[Huawei-ui-vty0-4] authentication-mode password
[Huawei-ui-vty0-4]set authentication password simple 222
[Huawei-ui-vtyo-4]user privilege level 3
[Huawei-ui-vtyo-4]dis this

Guess you like

Origin blog.csdn.net/weixin_44324367/article/details/109203469
Recommended