Protocol stack TCP / IP: structure, layers, configuration. Internet protocols

This article will cover the basics of the TCP / IP model. For a better understanding, basic protocols and services are described. The main thing is not to rush and try to understand each thing in stages. All of them are interconnected and without understanding one, it will be difficult to understand the other. Very superficial information is compiled here, so this article can be safely called the “TCP / IP protocol stack for dummies”. However, many things here are not as difficult to understand as it might seem at first glance.

TCP / IP

The TCP / IP stack is a network model for transmitting data on a network; it determines the order in which devices interact. Data arrives at the link layer and is processed alternately by each layer above. The stack is presented as an abstraction that explains the principles of processing and receiving data.

The TCP / IP network protocol stack has 4 layers:

  1. Channel (Link).
  2. Network (Internet).
  3. Transport (Transport).
  4. Applied (Application).
Device Interoperability in the TCP / IP Protocol Stack

Application level

The application layer provides the possibility of interaction between the application and other levels of the protocol stack, analyzes and converts the incoming information into a format suitable for software. It is closest to the user and interacts with him directly.

The most common protocols are:

  • HTTP
  • FTP
  • SMTP
  • DNS

Each protocol defines its own order and principles of working with data.

HTTP (HyperText Transfer Protocol) is designed for data transfer. It sends, for example, HTML documents that serve as the basis for a web page. Simplified scheme of work is presented as a “client - server”. The client sends the request, the server accepts it, properly processes and returns the final result.

FTP (File Transfer Protocol) is the standard for transferring files on a network. The client sends a request to a certain file, the server searches for this file in its database and, upon successful detection, sends it as an answer.

SMTP (Simple Mail Transfer Protocol) is used for sending email. An SMTP operation involves three consecutive steps:

  1. Determining the sender address. This is necessary to return letters.
  2. Recipient Definition. This step can be repeated a number of times when specifying multiple destinations.
  3. Identify message content and send. As service information, data on the type of message is transmitted. If the server confirms its readiness to accept the packet, the transaction itself is committed.

Title (Header)

Headers on the TCP / IP stack

The header contains service data. It is important to understand that they are intended only for a specific level. This means that as soon as the packet is sent to the recipient, it will be processed there according to the same model, but in the reverse order. The nested header will carry special information that can only be processed in a specific way.

For example, a header nested at the transport level on the other side can only be processed by the transport layer. Others will simply ignore him.

Transport level

At the transport level, the information received is processed as a single unit, regardless of the content. Received messages are divided into segments, a header is added to them, and all this is sent below.

Data Transfer Protocols:

  • TCP
  • UDP

TCP (Transmission Control Protocol) is the most common protocol. He is responsible for guaranteed data transfer. When sending packets, their checksum and transaction process are controlled. This means that the information will be “safe and sound” regardless of the conditions.

UDP (User Datagram Protocol) is the second most popular protocol. He is also responsible for data transmission. A distinctive property lies in its simplicity. Packets are simply sent without creating a special connection.

TCP or UDP?

Each of these protocols has its own field of application. It is logically determined by the features of the work.

The main advantage of UDP is the transmission speed. TCP is a complex protocol with many checks, while UDP seems to be more simplified, and therefore faster.

The disadvantage is simplicity. Due to the lack of checks, data integrity is not guaranteed. Thus, information is simply sent, and all checks and similar manipulations are left to the application.

UDP is used, for example, to watch video. For a video file, the loss of a small number of segments is not critical, while download speed is the most important factor.

However, if you need to send passwords or bank card details, then the need to use TCP is obvious. The loss of even the smallest part of the data can lead to disastrous consequences. Speed ​​in this case is not as important as safety.

Network layer

The network layer of the received information forms packets and adds a header. The most important piece of data is the IP and MAC addresses of senders and recipients.

IP address (Internet Protocol address) - the logical address of the device. Contains information about the location of the device on the network. Example record: [192.168.33.4].

MAC address (Media Access Control address) - the physical address of the device. Used for identification. Assigned to network equipment at the manufacturing stage. Presented as a six-byte number. For example: [08-00-27-AB-0E-25].

The network layer is responsible for:

  • Determination of delivery routes.
  • Transfer packets between networks.
  • Assigning Unique Addresses.

Routers are network layer devices. They pave the way between the computer and the server based on the data received.

The most popular protocol at this level is IP.

IP (Internet Protocol) is an Internet protocol designed for network addressing. It is used to build routes along which packets are exchanged. It does not have any means of verification and confirmation of integrity. To ensure delivery guarantees, TCP is used, which uses IP as the transport protocol. Understanding the principles of this transaction largely explains the basis of how the TCP / IP protocol stack works.

Types of IP Addresses

Private and public IP addresses

Networks use two types of IP addresses:

  1. Public.
  2. Private

Public are used on the Internet. The main rule is absolute uniqueness. An example of their use is routers, each of which has its own IP address for interacting with the Internet. This address is called public.

Private (Private) are not used on the Internet. In a global network, such addresses are not unique. An example is a local area network. Each device is assigned a unique IP address within the network.

Interaction with the Internet is carried out through a router, which, as mentioned above, has its own public IP address. Thus, all computers connected to the router are represented on the Internet on behalf of one public IP address.

IPv4

The most common version of the Internet protocol. IPv6 precedes. The recording format is four eight-bit numbers separated by dots. The subnet mask is indicated through the fraction sign. The address is 32 bits long. In the vast majority of cases, when it comes to IP-address, IPv4 is meant.

Recording format: [192.168.7.2/24].

IPv6

This version is intended to solve problems with the previous version. The address length is 128 bits.

The main problem that IPv6 solves is running out of IPv4 addresses. Prerequisites began to appear in the early 80s. Despite the fact that this problem entered its acute stage already in 2007-2009, the implementation of IPv6 is very slowly “gaining momentum”.

The main advantage of IPv6 is a faster Internet connection. This is because address translation is not required for this version of the protocol. Simple routing is in progress. This is less costly and therefore access to Internet resources is faster than in IPv4.

An example entry is [4003: 0af3: 06s8: 11f3: 8b4e: 09d8: 623b: d34f].

There are three types of IPv6 addresses:

  1. Unicast
  2. Anycast.
  3. Multicast.

Unicast is a type of unicast IPv6. When sending a packet, it reaches only the interface located at the corresponding address.

Anycast refers to multicast IPv6 addresses. The sent packet will go to the nearest network interface. Used only by routers.

Multicast are multicast. This means that the sent packet will reach all the interfaces that are in the multicast group. Unlike broadcast, which is “broadcast for everyone,” multicast only broadcasts to a specific group.

Subnet mask

The subnet mask identifies the subnet and host number from the IP address.

For example, the IP address [192.168.38.2] has the mask [255.255.255.0]. In this case, the recording format will look like this [192.168.38.2/24]. The number "24" is the number of bits in the mask. Eight bits equals one octet, which may also be called a byte.

If in more detail, the subnet mask [255.255.255.0] can be represented in binary notation in the following way: [11111111.11111111.11111111.00000000]. It has four octets, and the record consists of “1” and “0”. If you add the number of units, we get in the sum of "24". Fortunately, counting by one is not necessary, because in one octet there are 8 values. We see that three of them are filled with units, add [8 + 8 + 8 + 0] and get “24”.

If we talk specifically about the subnet mask, then in binary representation it has either one units or zeros in one octet. In this case, the sequence is such that bytes with ones go first, and only then with zeros.

Subnet Mask Classification

Consider a small example. There is an IP address [192.168.46.2] and a subnet mask [255.255.255.0]. We read and write: [192.168.46.2/24]. Now match the mask with the IP address. Those mask octets in which all values ​​are equal to one (255) leave the corresponding octets in the IP address unchanged. If the value has zeros (0), then the octets in the IP address also become zeros. Thus, in the value of the subnet address we get [192.168.46.0].

Subnet and host

The subnet is responsible for logical separation. In fact, these are devices that use the same local area network. Defined by a range of IP addresses.

The host is the address of the network interface (network card). Determined from an IP address using a mask. For example: [192.168.15.2/24]. Since the first three octets are a subnet, it remains [0.0.0.2]. This is the host number.

IP Address Structure

The host address range is from 0 to 255. The host with the number “0” is, in fact, the address of the subnet itself. And the host number 255 is broadcast.

Addressing

TCP / IP Stack Interoperability

Three types of addresses are used for addressing in the TCP / IP protocol stack:

  1. Local.
  2. Network
  3. Domain names.

Local addresses are MAC addresses. They are used for addressing in such LAN technologies as, for example, Ethernet. In the context of TCP / IP, the word "local" means that they only work within the subnet.

The network address in the TCP / IP protocol stack is the IP address. When sending a file, the recipient address is read from its header. With its help, the router recognizes the host number and subnet and, based on this information, paves the route to the end node.

Domain names are human-readable website addresses on the Internet. Web servers on the Internet are available at the public IP address. It is successfully processed by computers, but for people it seems too inconvenient. In order to avoid such complications, domain names are used, which consist of areas called “domains”. They are arranged in strict hierarchy, from the upper level to the lower.

The first level domain represents specific information. General (.org, .net) are not limited to any strict boundaries. The reverse situation is with local (.us, .ru). They are usually geographically attached.

Lower-level domains are all the rest. It can be of any size and contain any number of values.

Domain name

For example, “www.test.quiz.sg” is the correct domain name, where “sg” is the local domain of the first (top) level, “quiz.sg” is the second-level domain, “test.quiz.sg” is the third-level domain . Domain names can also be called DNS names.

DNS (Domain Name System) establishes the correspondence between domain names and public IP address. When you type a domain name in the browser bar, DNS will detect the corresponding IP address and inform the device. The device will process this machine code and return it as a web page.

Channel level

At the channel level, the relationship between the device and the physical transmission medium is determined, a header is added. Responsible for encoding data and preparing frames for transmission over the physical environment. At this level, network switches work.

The most common protocols are:

  1. Ethernet
  2. WLAN

Ethernet is the most common wired LAN technology.

WLAN - a local area network based on wireless technologies. The interaction of devices occurs without physical cable connections. An example of the most common method is Wi-Fi.

Configure TCP / IP to use a static IPv4 address

A static IPv4 address is assigned directly in the device’s settings or automatically when connected to a network and is permanent.

To configure the TCP / IP protocol stack to use a fixed IPv4 address, you must enter the ipconfig / all command in the console and find the following data.

Ipconfig / all output

Next you need to go into the properties of the desired connection, open the IPv4 properties and put the marks as shown in the picture. Enter the previously found data in the appropriate fields.

Manual TCP / IPv4 Configuration

Configure TCP / IP to use a dynamic IPv4 address

A dynamic IPv4 address is used for a while, leased, and then changed. Assigned to the device automatically when connected to a network.

To configure the TCP / IP protocol stack to use a non-persistent IP address, go to the properties of the desired connection, open the IPv4 properties and check the boxes as indicated.

Automatically configure TCP / IPv4

Data Transfer Methods

Data is transmitted through the physical medium in three ways:

  • Simplex
  • Half-duplex.
  • Full duplex.

Simplex is a one-way communication. Transmission is carried out by only one device, while the other only receives the signal. We can say that information is broadcast in only one direction.

Simplex communication

Simplex communication examples:

  • Broadcasting.
  • Signal from GPS satellites.

Half-duplex is a two-way communication. However, only one node can transmit a signal at a particular point in time. With this connection, two devices cannot simultaneously use the same channel. Full two-way communication may not be physically possible or lead to collisions. It is said that they conflict over the transmission medium. This mode is used when using a coaxial cable.

Half-duplex communication

An example of half-duplex communication is radio communication on a single frequency.

Full Duplex - full two-way communication. Devices can simultaneously transmit a signal and receive. They do not conflict over the transmission medium. This mode is used when using Fast Ethernet technology and a twisted pair connection.

Duplex (Full Duplex) communication

An example of duplex communication is telephone communication over a mobile network.

TCP / IP vs OSI

The OSI model defines the principles of data transfer. The layers of the TCP / IP protocol stack correspond directly to this model. Unlike four-level TCP / IP, it has 7 layers:

  1. Physical
  2. Channel (Data Link).
  3. Network (Network).
  4. Transport (Transport).
  5. Session (Session).
  6. Executive (Presentation).
  7. Applied (Application).

At the moment, you should not go deep into this model, but at least a superficial understanding is necessary.

Correspondence between TCP / IP protocol stack and OSI model

The application layer in the TCP / IP model corresponds to the top three OSI layers. They all work with applications, so you can clearly trace the logic of such a union. This generic TCP / IP protocol stack structure makes it easier to understand abstraction.

The transport layer remains unchanged. It performs the same functions.

The network layer is also not changed. Performs exactly the same tasks.

The link layer in TCP / IP corresponds to the last two OSI layers. The data link layer establishes protocols for transmitting data through the physical medium.

Physical is a physical connection itself - wires, cables, electrical signals, connectors, etc. In the TCP / IP protocol stack, it was decided to combine these two layers into one, since they both work with the physical environment.


All Articles