Protocol of the network layer and data link layer

The network layer handles packets of data (packet: the smallest unit of data transmitted over the network) as they flow over the network. The network layer dictates which path (transmission line) among many options reaches each other’s computers and transmits packets to each other.

The most prominent Protocol in this layer is the Internet Protocol (IP), so this layer is also called the IP layer. At the heart of IP are two main functions: address and routing.

IP is the core of TCP/IP. All TCP, UDP, IMCP, and IGMP data are transmitted in IP format. It is important to note that IP is not a reliable protocol, that is, the IP protocol does not provide a mechanism for handling data after it is not transmitted, which is what the upper layer protocols are supposed to do: TCP or UDP.

Network layer functions:

  • IP addressing

  • routing

  • packaging

  • shard

Data link layer functions:

  • Logical link control

  • Media access control

  • Encapsulate link layer frames

  • The MAC address

  • Error detection and processing

  • Define physical layer standards

IPv4 Class address

In the data link layer we usually identify different nodes by MAC address, and in the IP layer we also have a similar address identifier, which is the IP address.

32-bit IP address (IPv4 address dotted decimal representation) into the network and address bits, doing so can reduce the number of router middle of table records, with the network address, can be qualified with the same network address of the terminal are in the same range, then only need to maintain a routing table that the direction of the network address, You can find the corresponding terminals.

When the Internet is small, category information is encoded into IP addresses:

CIDR Subnet mask

Classless Inter-domain Routing (CIDR) is a method of classifying IP addresses for assigning IP addresses to users and Routing IP packets efficiently over the Internet.

A.B.C.D/N (N range [0, 32])

MAC address of the link layer

  • Media Access Control Address (MAC)

    • Realize direct transmission between local network devices
  • Network Layer IP Address Internet Protocol Address (IP)

    • To realize transmission between large networks

View the MAC address:

# Window
ipconfig / all

# Linux
ifconfig
Copy the code

Address resolution protocol ARP

Dynamic Address Resolution Protocol (ARP) is a Protocol for obtaining MAC addresses based on IP addresses. In simple terms, ARP maps IP addresses to physical addresses, while RARP maps physical addresses to IP addresses.

NAT Address Translation

Network Address Translation (ABBREVIATED: NAT; In computer networks, network masking (also known as network masking, IP masking) is a technique to override the source or destination IP address of an IP packet as it passes through a router or firewall. This technique is commonly used in private networks with multiple hosts that access the Internet through only one public IP address. It is a convenient and widely used technique. NAT also complicates the communication between hosts, reducing the communication efficiency.

IPv6

Internet Protocol Version 6 (English: Internet Protocol Version 6, abbreviated: IPv6) is the latest version of the Internet Protocol used as the Protocol for the Internet. It replaces IPv4 mainly to solve the problem of IPv4 address exhaustion, but it also has many improvements over IPv4 in other aspects.

IPv6 purpose:

  • Larger address space: 128 bits long

  • Better address space management

  • Eliminate addressing technologies such as NAT

  • Easier IP configuration management

  • Excellent route selection design

  • Better multicast support

  • security

  • mobility