[Computer Network] Chapter 3 Data Link Layer (MAC Address IP Address ARP Protocol)




insert image description here

3.7.1 MAC address

A MAC address (Media Access Control address) is a unique identifier of a network device (such as a network card, wireless network card) on the data link layer. Here are some key points about MAC addresses:

Description: A MAC address is a globally unique identifier consisting of 48 binary bits (usually expressed in hexadecimal) that identifies the physical hardware address of each network interface (NIC) in a computer network.

Function: MAC address is used to uniquely identify network devices in the local area network. It provides direct addressability at the data link layer to send data from a source device to a destination device.

Format: The MAC address is represented by six groups of hexadecimal numbers separated by colons or hyphens. For example, 00:1A:2B:3C:4D:5E. The first three groups (24 binary digits) usually represent the Organizationally Unique Identifier (OUI, Organizationally Unique Identifier), and the last three groups (24 binary digits) are the unique identification codes assigned to the manufacturer.

Uniqueness: The MAC address of each network device should be unique, so as to ensure that there are no duplicate addresses in the LAN. Uniqueness is managed and assigned by the IEEE (Institute of Electrical and Electronics Engineers) organization.

Broadcast Address: One of the special addresses in the MAC address is the broadcast address (FF:FF:FF:FF:FF:FF). A broadcast address can be used when a message needs to be sent to all devices on the LAN.

MAC address is a local address, only meaningful within the same local area network. When communicating between different networks connected through a router, IP addresses need to be used for addressing.


image.png
MAC: It is the address used by the MAC sublayer of Ethernet, which belongs to the data link layer .
When multiple hosts are connected to the same broadcast channel, in order to realize communication between two hosts, each host must have a unique identifier, that is, a data link layer address.
The frame sent by each host must carry the addresses identifying the sending host and the receiving host. Since this type of address is used for media access control MAC (Media Access Control), this type of address is called a MAC address.

Generally, the user host will contain two network adapters: a wired network adapter (wired network card) and a wireless network adapter (wireless network card). Each network adapter has a globally unique MAC address. Switches and network routers tend to have more network interfaces, so they will have more MAC addresses. To sum up: Strictly speaking, the MAC address is the unique identification of each interface on the network, not the unique identification of each device on the network.

3.7.2 IP address

An IP address is an address used by hosts and routers on the Internet to identify two pieces of information:

  • Network Numbers: Identifying Millions of Networks on the Internet
  • Host number: Identify different hosts (or router interfaces) on the same network

IP addresses belong to the network layer.

Changes of IP address and MAC address during packet forwarding
Change of address

insert image description here


3.7.3 ARP protocol

ARP address resolution protocol
ARP protocol can only be used on a link or a network, but not across networks.

ARP (Address Resolution Protocol) is a network protocol for resolving IP addresses into physical addresses (MAC addresses). Here are some key points about the ARP protocol:

Description: The ARP protocol is a protocol for communicating between the network layer and the data link layer in the TCP/IP protocol stack. It obtains the MAC address of the target device by sending a specific message.

Function: The ARP protocol has two main functions:

IP address resolution: When a host needs to send data to a destination IP address, it first checks the local ARP cache table to find the corresponding MAC address. If there is no MAC address corresponding to the IP address in the cache table, an ARP request will be sent.

Update and maintain ARP cache: When a host receives an ARP request from another host, it will update the local ARP cache and reply to the requester with its own MAC address for its use.
Working principle: When the source host wants to send data to the target host, it first looks up the local ARP cache table. If the MAC address corresponding to the target IP address is found, the data frame is directly sent to the target host. If not found, the source host will broadcast an ARP request message to all hosts in the local network, requesting the MAC address of the target host. After the target host receives the request, it will send an ARP response message to the source host, which contains its own MAC address. After the source host receives the response, it can use the MAC address of the target host to send data.

ARP cache: Each host maintains an ARP cache table (also called ARP cache), which is used to store IP addresses and corresponding MAC addresses. Doing so avoids frequent sending of ARP requests. Entries in the ARP cache table have a certain lifetime, after which they will be considered expired and need to be retrieved.

The ARP protocol works in a Local Area Network (LAN) environment, communicating by broadcasting messages. For communication across routers, you may need to use other protocols, such as RARP (Reverse Address Resolution Protocol) or technologies such as ARP proxy.


insert image description here

Guess you like

Origin blog.csdn.net/m0_60915009/article/details/131627346