Networking

发布时间 2023-10-16 10:22:38作者: ZhangZhihuiAAA

Computer networks use network protocols to communicate with each other. Network protocols are often abstracted into different layers. For example, Open Systems Interconnection (OSI) describes seven layers of communication protocols — starting from the application layer at the top, followed by the presentation, session, transport, network, data link, and physical layers. The Internet Protocol suite, popularly known as TCP/IP, has only four layers, starting with the application layer, followed by the transport, internet, and link layers. TCP/IP predates OSI and is more commonly used, but either protocol suite is only an abstraction layer used to describe the network communications.


The application layer is, as the name suggests, the protocol layer that describes how applications talk to each other. Examples of protocols on this layer include HyperText Transfer Protocol (HTTP) and File Transfer Protocol (FTP).


The transport layer describes how datagrams are sent and received. The two main protocols in this layer are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). TCP ensures packets of data (called datagrams) are delivered reliably. UDP, on the other hand, doesn’t ensure datagram delivery. TCP is reliable but has a high overhead, while UDP is often much faster.


Internet layer protocols describe how bits and bytes of data are organized into datagrams and how devices on the network find each other. The Internet Protocol (IP) is the most widely used internet layer protocol in the world. Two main versions of IP are in use today: the first is IP version 4, which is identified by a 4 - byte number written in a dotted quad format — for example, 192.168.1.1 — where each of the four numbers is an unsigned byte with value from 0 to 255.

There are about 4 billion possible IPv4 addresses, which means they are running out. IP version 6, on the other hand, has a 16 - byte address that provides 340 undecillion (340 trillion trillion trillion) addresses, which should be more than enough for a while. IPv6 addresses are written in eight blocks of four hexadecimal digits separated by colons — for example, 2001:0db8:85a3:0000:0000:8a2e:0370:7334.

In addition to addresses, each IP address has 65,535 logical ports, which are normally used to identify a service. For example, HTTP normally uses port 80 while FTP uses two ports: port 20 for command and port 21 for data. Port numbers 1 to 1023 are reserved for well - known services such as HTTP or FTP.