The data link layer has three purposes:
Sends and receives IP data packets for the IP module.
Sends ARP requests to the ARP module and receives ARP responses.
Send RARP requests for RARP and receive RARP responses
We have heard of ip addresses. As for ARP and RARP, ARP is called the Address Resolution Protocol. It is a protocol that uses IP addresses for MAC addresses, while RARP is called the Reverse Address Resolution Protocol, I will introduce them later in the TCP/IP protocol (using ARP in the LAN can easily paralyze the network)
There are still a lot of data link layer protocols, including the most commonly used Ethernet (that is, the network card we usually use) protocols, the uncommon licensing ring, and FDDI. Of course, there is also a widely used PPP protocol (adsl Broadband) in China and a loopback protocol.
Contact the ifconfig-a command in linux. The command usually gets the following results:
Eth0 Link encap: Ethernet HWaddr 00: 01: 4A: 03: 5B: ED
Inet addr: 192.168.11.2 Bcast: 192.168.11.255 Mask: 255.255.255.0
Inet6 addr: fe80: 201: 4aff: fe03: 5bed/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 2819 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 76 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX bytes: 241609 (235.9 KiB) TX bytes: 9596 (9.3 KiB)
Lo Link encap: Local Loopback
Inet addr: 127.0.0.1 Mask: 255.0.0.0
Inet6 addr: 1/128 Scope: Host
Up loopback running mtu: 16436 Metric: 1
RX packets: 2713 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 2713 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 3516032 (3.3 MiB) TX bytes: 3516032 (3.3 MiB)
Eth0 is the Ethernet interface, while lo is the loopback interface. This also indicates that the host supports at least loopback and Ethernet protocols on the network link layer.
Ethernet (Ether-net) is a Digital Equipment company (Digital Equipment Corp .), Intel Corp .) A standard jointly announced by Xerox in 1982, which uses a method called CSMA/CD. The standard set 802.3 provided by IEEE802 (some are defined in 802.2) also provides a CSMA/CD standard. The two standards are slightly different. The TCP/IP protocol handles this situation as follows:
IP datagram of Ethernet is defined in RFC894, while IP datagram of IEEE802 network is defined in RFC1042.
A host must be able to send and receive RFC894-defined data packets.
A host can receive a hybrid datagram in RFC894 and RFC1042 encapsulation formats.
A host may be able to send RFC1042 data packets .. If the host can send two types of group data at the same time, the sent group must be configurable, and the default group must be RFC 894.
It can be seen that RFC1042 is in a supporting role in TCP/IP. For the two different datagram formats, refer to the tutorial.
Ppp (Point-to-Point Protocol) is a substitute from SLIP. They all provide a low-speed access solution. Each data link layer protocol has a MTU (maximum transmission unit) Definition. Under this definition, fragmentation is required if the IP datagram is too large ), make each piece smaller than MTU. Note that the MTU of PPP is not a physical definition, but a logical definition (in my opinion, it is controlled by a program ). You can use netstat to print MTU results, such as typing netstat-in.
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR Flg
Eth0 1500 0 1774 0 0 0 587 0 0 0 BMRU
Lo 16436 0 2667 0 0 2667 0 0 0 LRU
We can see that the MTU of eth0 is 1500. The MTU of lo (loop interface) is 16436.
Finally, let's talk about the loopback interface ). We usually use 127.0.0.1 to try our own server. This loopback interface is used. The following three aspects of the loop interface are worth noting:
Any data sent to the loopback address (generally 127.0.0.1) is used as the I P input.
Copy the datagram sent to the broadcast address or multicast address and send it to the loopback interface, and then to the Ethernet. This is because the definition of broadcast and Multicast Transmission includes the host itself.
Any data sent to the Host IP address is sent to the loopback interface.
This chapter is very simple. Generally, it is enough to understand the knowledge, and there is no need to explain it in detail.