• Data transfer protocol tcp ip. What is TCP-IP protocol

    UNIX, which contributed to the growing popularity of the protocol, as manufacturers included TCP/IP in the set software every UNIX computer. TCP/IP finds its mapping in the OSI reference model, as shown in Figure 3.1.

    You can see that TCP/IP is located at layers three and four of the OSI model. The point of this is to leave the LAN technology to the developers. The purpose of TCP/IP is message transmission V local networks any type and establish communication using any network application.

    The TCP/IP protocol works because it is connected to OSI model at the two lowest layers - the data transfer layer and the physical layer. This allows TCP/IP to work well with virtually any network technology and, as a result, with any computer platform. TCP/IP includes four abstract layers, listed below.


    Rice. 3.1.

    • Network interface. Allows TCP/IP to actively interact with all modern network technologies, based on the OSI model.
    • Internetwork. Defines how IP controls forwarding messages through routers of a network space such as the Internet.
    • Transport. Defines a mechanism for exchanging information between computers.
    • Applied. Specifies network applications for performing tasks, such as forwarding, email, and others.

    Due to its widespread use, TCP/IP has become the de facto Internet standard. The computer on which it is implemented network technology, based on the OSI model (Ethernet or Token Ring), has the ability to communicate with other devices. In "Networking Fundamentals" we looked at layers 1 and 2 when discussing LAN technologies. Now we'll move on to the OSI stack and look at how a computer communicates over the Internet or private network. This section discusses the TCP/IP protocol and its configurations.

    What is TCP/IP

    The fact that computers can communicate with each other is itself a miracle. After all, these are computers from different manufacturers, working with different operating systems and protocols. Without some common basis, such devices would not be able to exchange information. When sent over a network, data must be in a format that is understandable to both the sending device and the receiving device.

    TCP/IP satisfies this condition through its internetworking layer. This layer directly matches the network layer of the OSI reference model and is based on a fixed message format called an IP datagram. A datagram is something like a basket in which all the information of a message is placed. For example, when you load a web page into a browser, what you see on the screen is delivered piecemeal by datagram.

    It's easy to confuse datagrams with packets. Datagram is information item, while a packet is a physical message object (created at the third and higher layers) that is actually sent over the network. Although some consider these terms interchangeable, their distinction actually matters in a specific context - not here, of course. It is important to understand that the message is broken into fragments, transmitted over the network and reassembled at the receiving device.


    The positive thing about this approach is that if a single packet is corrupted during transmission, then only that packet will need to be retransmitted, not the entire message. Another positive is that no host has to wait indefinitely for a long time until the other host has finished transmitting to send its own message.

    TCP and UDP

    When sending an IP message over a network, one of the transport protocols is used: TCP or UDP. TCP (Transmission Control Protocol) makes up the first half of the acronym TCP/IP. The User Datagram Protocol (UDP) is used instead of TCP to transport less than important messages. Both protocols are used for the correct exchange of messages in TCP/IP networks. There is one significant difference between these protocols.

    TCP is called a reliable protocol because it communicates with the recipient to verify that the message was received.

    UDP is called an unreliable protocol because it does not even attempt to contact the recipient to verify delivery.


    It is important to remember that only one protocol can be used to deliver a message. For example, when a web page is loaded, TCP controls packet delivery without any UDP intervention. On the other hand, Trivial File Transfer Protocol (TFTP) downloads or sends messages under the control of the UDP protocol.

    The transport method used depends on the application - it could be email, HTTP, the application responsible for networking work, and so on. Developers network programs use UDP wherever possible, since this protocol reduces excess traffic. The TCP protocol makes more effort to guarantee delivery and transmits many more packets than UDP. Figure 3.2 provides a list of network applications and shows which applications use TCP and which use UDP. For example, FTP and TFTP do essentially the same thing. However, TFTP is mainly used for downloading and copying network device programs. TFTP can use UDP because if the message fails to be delivered, nothing bad happens because the message was not intended for the end user, but for the network administrator, whose priority level is much lower. Another example is a voice video session, in which ports for both TCP and UDP sessions can be used. Thus, a TCP session is initiated to exchange data when a telephone connection is established, while the TCP session itself telephone conversation transmitted via UDP. This is due to the speed of voice and video streaming. If a packet is lost, there is no point in resending it, since it will no longer match the data flow.


    Rice. 3.2.
    IP Datagram Format

    IP packets can be broken down into datagrams. The datagram format creates fields for the payload and for message transmission control data. Figure 3.3 shows the datagram diagram.

    Note. Don't be fooled by the size of the data field in a datagram. The datagram is not overloaded with additional data. The data field is actually the largest field in the datagram.


    Rice. 3.3.

    It is important to remember that IP packets can have different lengths. In "Networking Fundamentals" it was said that information packets on an Ethernet network range in size from 64 to 1400 bytes. In the Token Ring network their length is 4000 bytes, in the ATM network - 53 bytes.

    Note. The use of bytes in a datagram can be confusing, since data transfer is often associated with concepts such as megabits and gigabits per second. However, because computers prefer to work with data bytes, datagrams also use bytes.

    If you look again at the datagram format in Figure 3.3, you'll notice that the leftmost margins are a constant value. This happens because CPU A person working with packets must know where each field begins. Without standardization of these fields, the final bits will be a jumble of ones and zeros. On the right side of the datagram are packets of variable length. The purpose of the various fields in a datagram is as follows.

    • VER. The version of the IP protocol used by the station where the original message appeared. Current version IP is version 4. This field ensures concurrent existence different versions in the internetwork space.
    • HLEN. The field informs the receiving device of the length of the header so that the CPU knows where the data field begins.
    • Service type. Code that tells the router the type of packet control in terms of service level (reliability, priority, deferment, etc.).
    • Length. The total number of bytes in the packet, including header fields and data fields.
    • ID, frags and frags offset. These fields tell the router how to fragment and reassemble the packet and how to compensate for differences in frame size that may occur as the packet traverses LAN segments with different network technologies (Ethernet, FDDI, etc.).
    • TTL. An abbreviation for Time to Live is a number that decreases by one each time a packet is sent. If the lifetime becomes zero, the packet ceases to exist. TTL prevents loops and lost packets from wandering endlessly across the Internet.
    • Protocol. The transport protocol to use to transmit the packet. The most common protocol specified in this field is TCP, but other protocols may be used.
    • Header checksum. A checksum is a number that is used to verify the integrity of a message. If checksums all message packets do not match the correct value, this means that the message has been corrupted.
    • Source IP address. The 32-bit address of the host that sent the message (usually a personal computer or server).
    • Destination IP address. The 32-bit address of the host to which the message was sent (usually a personal computer or server).
    • IP options. Used for network testing or other special purposes.
    • Padding. Fills all unused (empty) bit positions so that the processor can correctly determine the position of the first bit in the data field.
    • Data. The payload of the sent message. For example, the package data field may contain the text of an email.

    As mentioned earlier, the packet consists of two main components: data about message processing, located in the header, and the information itself. The information part is located in the payload sector. You can imagine this sector as the cargo compartment of a spaceship. The header is all of the shuttle's onboard computers in the control cabin. It manages all the information needed by all the different routers and computers along the message path, and is used to maintain a certain order in assembling the message from individual packets.

    In short, this is a set of rules that govern the “communication” of computers with each other over the network. There are about a dozen of them, and each of them defines the rules for transferring a specific type of data. But for ease of use, they are all combined into a so-called “stack”, calling it after the most important protocol - TCP protocol/IP (Transmission Control Protocol and Internet Protocol). The word "stack" implies that all these protocols are like a "stack of protocols" in which the upper-level protocol cannot function without the lower-level protocol.

    The TCP/IP stack includes 4 layers:

    1. Application - HTTP, RTP, FTP, DNS protocols. The top level; responsible for the work application applications, For example postal services, displaying data in the browser, etc.

    2. Transport - TCP, UDP, SCTP, DCCP, RIP protocols. This protocol level ensures the correct interaction of computers with each other and is a data conductor between different network participants.

    3. Network - IP protocol. This layer provides identification of computers on the network by giving each of them a unique digital address.

    4. Channel - Ethernet, IEEE 802.11, Wireless Ethernet protocols. Lowest level; it interacts with physical equipment, describes the data transmission medium and its characteristics.

    Therefore, your computer uses the HTTP - TCP - IP - Ethernet protocol stack to display this article.

    How information is transmitted over the Internet

    Each computer on the network is called a host and, using the protocol of the same name, receives a unique IP address. This address is written in the following form: four numbers from 0 to 255 separated by a period, for example, 195.19.20.203. To successfully communicate over a network, the IP address must also include a port number. Since it is not the computers themselves that exchange information, but the programs, each type of program must also have its own address, which is displayed in the port number. For example, port 21 is responsible for FTP, port 80 for HTTP. The total number of ports on a computer is limited and equal to 65536, numbered from 0 to 65535. Port numbers from 0 to 1023 are reserved by server applications, and the niche of ports from 1024 to 65535 is occupied by client ports, which programs are free to use as they please. "Client ports" are assigned dynamically.

    Combination IP addresses and port numbers called " socket". In it, the address and port values ​​are separated by a colon, for example, 195.19.20.203:110

    Thus, in order for a remote computer with IP 195.19.20.203 to receive email, you just need to deliver data to its port 110. And since this port “listens” day and night to the POP3 protocol, which is responsible for receiving emails, then further - "a matter of technology."

    For convenience, all data on the network is divided into packets. A package is a file of 1-1.5 MB in size, which contains address data of the sender and recipient, transmitted information, plus service data. Splitting files into packages can significantly reduce the load on the network, because the path of each from the sender to the recipient will not necessarily be identical. If a traffic jam occurs in one place on the network, packets can bypass it using other communication paths. This technology makes it possible to use the Internet as efficiently as possible: if some transport part of it collapses, information can continue to be transmitted, but along other paths. When the packets reach the target computer, it begins to assemble them back into a single file using the service information they contain. The whole process can be compared to some kind of large puzzle, which, depending on the size of the transferred file, can reach truly enormous sizes.

    As mentioned earlier, the IP protocol gives each network participant, including websites, a unique numeric address. However, no person can remember millions of IP addresses! Therefore, the Domain Name System (DNS) domain name service was created, which translates numeric IP addresses into alphanumeric names that are much easier to remember. For example, instead of dialing the dreaded number 5.9.205.233 every time, you can dial address bar browser www.site.

    What happens when we type the address of the site we are looking for in the browser? From our computer, a packet with a request is sent to the DNS server on port 53. This port is reserved by the DNS service, which, after processing our request, returns the IP address corresponding to the alphanumeric name of the site. After this, our computer connects to socket 5.9.205.233:80 of computer 5.9.205.233, which hosts the HTTP protocol responsible for displaying sites in the browser, and sends a packet with a request to receive the www.site page. We need to establish a connection on port 80, since it is the one that corresponds to the Web server. If you really wish, you can specify port 80 directly in the address bar of your browser - http://www.site:80. The web server processes the request received from us and issues several packets containing HTML text, which our browser displays. As a result, we see the main page on the screen

    StackTCP/ IP.

    The TCP/IP stack is a set of hierarchically ordered network protocols. The stack is named after two important protocols – TCP (Transmission Control Protocol) and IP (Internet Protocol). In addition to them, the stack includes several dozen more different protocols. Currently, TCP/IP protocols are the main ones for the Internet, as well as for most corporate and local networks.

    In the Microsoft Windows Server 2003 operating system, the TCP/IP stack is selected as the main one, although other protocols are also supported (for example, the IPX/SPX stack, the NetBIOS protocol).

    The TCP/IP protocol stack has two important properties:

      platform independence, i.e. it can be implemented on a variety of operating systems and processors;

      openness, i.e. the standards by which the TCP/IP stack is built are available to anyone.

    History of creationTCP/ IP.

    In 1967, the Advanced Research Projects Agency of the US Department of Defense (ARPA - Advanced Research Projects Agency) initiated the development of a computer network that was supposed to connect a number of universities and research centers that carried out orders from the Agency. The project was called ARPANET. By 1972, the network connected 30 nodes.

    As part of the ARPANET project, the main protocols of the TCP/IP stack - IP, TCP and UDP - were developed and published in 1980–1981. An important factor in the spread of TCP/IP was the implementation of this stack in the UNIX 4.2 BSD operating system (1983).

    By the end of the 80s, the significantly expanded ARPANET network became known as the Internet (Interconnected networks) and united universities and research centers in the USA, Canada and Europe.

    In 1992 appeared new service Internet – WWW (World Wide Web), based on the HTTP protocol. Largely thanks to WWW, the Internet, and with it the TCP/IP protocols, received rapid development in the 90s.

    At the beginning of the 21st century, the TCP/IP stack is acquiring a leading role in the means of communication not only of global, but also local networks.

    ModelOSI.

    Interaction model open systems(OSI - Open Systems Interconnection) was developed by the International Organization for Standardization (ISO - International Organization for Standardization) for a uniform approach to building and connecting networks. Development of the OSI model began in 1977 and ended in 1984 with the approval of the standard. Since then, the model has been the reference for the development, description and comparison of various protocol stacks.

    Let's briefly look at the functions of each level.


    The OSI model includes seven layers: physical, data link, network, transport, session, presentation, and application.

      The physical layer describes the principles of signal transmission, transmission speed, and specifications of communication channels. The layer is implemented by hardware (network adapter, hub port, network cable).

      The data link layer solves two main tasks: it checks the availability of the transmission medium (the transmission medium is most often divided between several network nodes), and also detects and corrects errors that occur during the transmission process. The implementation of the level is hardware and software (for example, a network adapter and its driver).

      The network layer provides the unification of networks operating using different channel and physical levels,into the composite network. In this case, each of the networks included in a single network is called subnet(subnet). At the network level, two main problems have to be solved: routing(routing, choosing the optimal path for transmitting a message) and addressing(addressing, each node in a composite network must have a unique name). Typically, network layer functions are implemented by a special device - router(router) and its software.

      The transport layer solves the problem of reliable message transmission in a composite network by confirming delivery and resending packets. This level and all the following are implemented in software.

      The session layer allows you to remember information about the current state of a communication session and, in the event of a connection break, resume the session from this state.

      The presentation layer ensures the conversion of transmitted information from one encoding to another (for example, from ASCII to EBCDIC).

      The application layer implements the interface between the other layers of the model and user applications.

    StructureTCP/ IP. The TCP/IP structure is not based on the OSI model, but on its own model, called DARPA (Defense ARPA - the new name of the Advanced Research Projects Agency) or DoD (Department of Defense - US Department of Defense). This model has only four levels. The correspondence of the OSI model to the DARPA model, as well as the main protocols of the TCP/IP stack, is shown in Fig. 2.2.

    It should be noted that the lower level of the DARPA model - the network interface level - strictly speaking, does not perform the functions of the data link and physical layers, but only provides communication (interface) of the upper DARPA levels with the network technologies included in the composite network (for example, Ethernet, FDDI, ATM ).

    All protocols included in the TCP/IP stack are standardized in RFC documents.

    DocumentsRFC.

    Approved official Internet and TCP/IP standards are published as RFC (Request for Comments) documents. Standards are developed by the entire ISOC community (Internet Society, an international public organization). Any ISOC member may submit a document for consideration for publication in an RFC. The document is then reviewed by technical experts, development teams, and an RFC editor and is passed in accordance with RFC 2026 next steps, called maturity levels:

      draft(Internet Draft) – at this stage, experts familiarize themselves with the document, additions and changes are made;

      proposed standard(Proposed Standard) - the document is assigned an RFC number, experts have confirmed the viability of the proposed solutions, the document is considered promising, it is desirable that it be tested in practice;

      draft standard(Draft Standard) - a document becomes a draft standard if at least two independent developers have implemented and successfully applied the proposed specifications. At this stage, minor corrections and improvements are still allowed;

      Internet standard(Internet Standard) - the highest stage of approval of the standard, the document specifications have become widespread and have proven themselves in practice. A list of Internet standards is given in RFC 3700. Of the thousands of RFCs, only a few dozen are documents with the status of “Internet standard”.

    In addition to standards, RFCs can also be descriptions of new networking concepts and ideas, guidelines, results of experimental studies presented for information, etc. Such RFCs can be assigned one of the following statuses:

      experimental(Experimental) – a document containing information about scientific research and developments that may be of interest to ISOC members;

      informational(Informational) - a document published to provide information and does not require approval by the ISOC community;

      best modern experience(Best Current Practice) - a document intended to convey experience from specific developments, such as protocol implementations.

    The status is indicated in the header of the RFC document after the word Category (Category). For documents in the status of standards (Proposed Standard, Draft Standard, Internet Standard), the name is indicated Standards Track, since the level of readiness may vary.

    RFC numbers are assigned sequentially and are never reissued. The original RFC is never updated. The updated version is published under a new number. An obsolete and superseded RFC becomes historical(Historic).

    All existing RFC documents can be viewed, for example, on the website www.rfc-editor.org . There were over 5,000 in August 2007. The RFCs referenced in this course are listed in Appendix I.

    Overview of the main protocols.

    Protocol IP (Internet Protocol) – This is the main network layer protocol responsible for addressing in composite networks and packet transmission between networks. The IP protocol is datagram protocol, i.e. it does not guarantee delivery of packets to the destination node. The transport layer protocol TCP provides guarantees.

    Protocols R.I.P. (Routing Information Protocol routing information protocol ) AndOSPF (Open Shortest Path First – « The shortest routes open first" ) – routing protocols in IP networks.

    Protocol ICMP (Internet Control Message Protocol Control Message Protocol in Composite Networks) is designed to exchange error information between network routers and the source node of the packet. Using special packets, it reports the impossibility of delivering a package, the duration of assembling a package from fragments, anomalous parameter values, changes in the forwarding route and type of service, the state of the system, etc.

    Protocol ARP (Address Resolution Protocol – Address Translation Protocol) converts IP addresses into hardware addresses of local networks. The reverse conversion is carried out using the protocol RAPR (Reverse ARP).

    TCP (Transmission Control Protocol – transmission control protocol) ensures reliable transmission of messages between remote network nodes through the formation of logical connections. TCP allows you to deliver a byte stream generated on one computer without errors to any other computer included in the composite network. TCP divides the byte stream into parts - segments and transmits them to the network layer. Once these segments are delivered to their destination, TCP reassembles them into a continuous stream of bytes.

    UDP (User Datagram Protocol – User Datagram Protocol) provides data transmission in a datagram manner.

    HTTP (HyperText Transfer Protocol – hypertext transfer protocol) – web document delivery protocol, the main protocol of the WWW service.

    FTP (File Transfer Protocol – file transfer protocol) – a protocol for transferring information stored in files.

    POP 3 (Post Office Protocol version 3 – post office protocol) and SMTP (Simple Mail Transfer Protocol – Simple Mail Forwarding Protocol) – protocols for delivering incoming email (POP3) and sending outgoing email (SMTP).

    Telnet – terminal emulation protocol 1, allowing the user to connect to other remote stations and work with them from their machine, as if it were their remote terminal.

    SNMP (Simple Network Management Protocol – simple network management protocol) is designed to diagnose the performance of various network devices.

    To exchange information between computers, standards for transmitting and processing information were developed, which were called network protocols. The most common protocols are IP, ICMP, TCP, UDP, SMTP, POP/POP3, IMAP, HTTP/HTTPS and FTP, but there are others, less well known, such as SSH, TELNET and others.

    For two people to speak, they must speak the same language. However, they do not need to strictly adhere to grammar and formal language structures in order to understand each other. To exchange information between computers, everything must be clearly defined and structured. Therefore, transmission and processing standards should be used various types information. The protocols are established by international agreement and guarantee the exchange of information between any computers anywhere. There are many different protocols for different needs and types of information.

    IP, ICMP, TCP and UDP

    IP (Internet Protocol) and TCP (Transmission Control Protocol) are two completely different protocols that are usually associated with each other. Combinations of several protocols are often used, since the functions of different protocols can be combined in such a way as to obtain a solution to the problem. In combination, each protocol performs operations at its own level.

    When transmitting information over the Internet, it is divided into small parts - Internet packets, which are transmitted independently of each other. This significantly speeds up the transfer of information due to the fact that different parts can be transmitted along different routes, after which they are reassembled at the point of receipt into a single whole. This is also a measure to prevent information loss during transmission. The TCP protocol is responsible for creating Internet packets and reassembling them in the required order at the receiving location, and also checks the integrity of the information. If some packets are lost during transmission, they are retransmitted.

    Internet Protocol (IP) is used to deliver information over to the right address. Each computer that has an Internet connection has its own unique address - . Each package sent contains a delivery address. An Internet packet may pass through many routers before reaching its destination. The Internet Protocol is responsible for routing the packet to the specified computer. IP does not create physical connections between computers. It can be used in conjunction with other protocols that create connections.

    To transmit small pieces of information you can use UDP protocol(User Datagram Protocol - user datagram protocol). It is also used in conjunction with the Internet Protocol, but is much simpler than TCP. Unlike TCP, UDP does not guarantee the delivery of packets in the required sequence and does not duplicate the transmission of lost packets; accordingly, it consumes less system resources and the transmission speed is significantly higher. It is used in applications that require large throughput communication lines, or short data delivery time, for example for audio or video communications.

    There is a completely different protocol low level– ICMP (Internet Control Message Protocol). It is primarily used for diagnostic or service purposes, such as reporting errors and other exceptional situations encountered during data transmission, such as the requested service is not available, or the host or router is not responding.

    Mail protocols – SMTP, POP, IMAP

    Sending and receiving email requires its own protocols. Mail is usually sent using SMTP (Simple Mail Transfer Protocol). It is also used to transfer mail between mail servers. When setting up email clients (for example, Outlook Express), you must specify the address SMTP servers. Mail clients typically use POP (Post Office Protocol) to receive mail from a Mailbox server. post office). Currently, its third edition (version) is in effect, which is called POP3 (Post Office Protocol Version 3 - post office protocol, version 3). To be able to receive mail, you must specify the POP3 server address when setting up your mail client. The SMTP and POP3 server addresses may or may not be the same; they should be checked with your mail provider. The SMTP and POP3 protocols work in conjunction with the TCP protocol to transmit and deliver mail over the Internet.

    There is also a more functional, but less known protocol for reading email - IMAP (Internet Message Access Protocol - Internet Email Access Protocol). This protocol allows you to access messages stored in a mailbox on the server without having to upload it to local computer. This is very convenient when you need to access mailbox messages from several computers. IMAP also works in conjunction with the TCP protocol.

    HTTP and HTTPS protocols

    Web pages use HyperText Markup Language (HTML). HTML pages are transmitted over the Internet using a standard called HyperText Transfer Protocol (HTTP). The basis of HTTP is the client-server technology, that is, the user initiates a connection to the server to request information, and the server waits for the connection to receive the request, processes the request and returns a message with the result. HTTP works in conjunction with the TCP protocol. Addresses using the HTTP protocol begin with “http:”.

    Associated with the HTTP protocol HTTPS protocol(HTTP over TLS – HTTP over TLS). It provides encryption during data transmission to protect confidential information. URLs using the HTTP protocol begin with “https:”.

    File Transfer Protocol – FTP

    The File Transfer Protocol (FTP) is designed to transfer files over computer networks from one computer to another. It provides the opportunity simple controls files on the remote computer. This is a fairly old protocol that was put into operation before world wide web(WWW – World Wide Web). Currently, it is used mainly for uploading files to web servers, but there are also file storages that operate using the FTP protocol. It works in conjunction with the TCP protocol. URLs using the FTP protocol begin with “ftp:”.

    For simultaneous operation of servers using protocols SMTP, POP, IMAP, HTTP, HTTPS, FTP etc. separate computers or IP addresses are not required at all. All these servers can be installed on one computer with one IP address. This is achieved due to the fact that each protocol uses its own .


    Introduction to TCP/IP

    Job Internet networks is based on the use of the TCP/IP family of communication protocols, which stands for Transmission Control Protocol/Internet Protocol. TCP/IP is used for data transmission both on the Internet and on many local networks.
    Of course, working with the Internet as a user does not require any special knowledge of the TCP/IP protocols, but understanding the basic principles will help you in solving possible general problems that arise, in particular, when setting up an email system.
    TCP/IP is also closely related to the other two basic applications Internet: FTP and Telnet. Finally, understanding some of the fundamental concepts of the Internet will help you fully appreciate the complexity of this system, just as understanding the workings of an internal combustion engine helps you appreciate the workings of a car.
    TCP/IP is a fairly complex and extensive topic, which is the subject of many reference books and voluminous articles. This section covers only basic concepts and does not cover technical details.

    What is TCP/IP

    TCP/IP is the name of a family of networking protocols. A protocol is a set of rules that all companies must adhere to to ensure the compatibility of the hardware and software they produce. These rules ensure that a Digital Equipment machine running TCP/IP can communicate with a Compaq PC also running TCP/IP. As long as certain standards are met for the functioning of the entire system, it does not matter who the software or hardware manufacturer is. The open systems ideology involves the use of standard hardware and software. TCP/IP is an open protocol, which means that all protocol-specific information is published and can be freely used.
    A protocol defines how one application communicates with another. This software communication is like a conversation: "I'm sending you this piece of information, then you send me back this, then I'll send you this. You have to add up all the bits and send back the total result, and if there's a problem, you have to send me corresponding message."The protocol defines how the different parts of the overall packet control the transfer of information. The log shows whether the packet contains an email message, a newsgroup article, or a service message. The protocol standards are formulated in such a way that they take into account possible unforeseen circumstances. The protocol also includes error handling rules.
    The term TCP/IP includes the names of two protocols - Transmission Control Protocol (TCP) and Internet Protocol (IP). TCP/IP is not one program, as many users mistakenly believe. In contrast, TCP/IP refers to a whole family of related protocols designed to transmit information over a network while simultaneously providing information about the state of the network itself. TCP/IP is software component networks. Each part of the TCP/IP family performs a specific task: sending email, providing remote login services, transferring files, routing messages, or handling network failures. The use of TCP/IP is not limited global network Internet. These are the most widely used network protocols throughout the world, used both in large corporate networks and in local networks with a small number of computers.
    As just mentioned, TCP/IP is not one protocol, but a family of them. Why is the term TCP/IP sometimes used when a service other than TCP or IP is meant? Usually the general name is used when discussing the entire family of network protocols. However, some users, when talking about TCP/IP, mean only some of the protocols in the family: they assume that the other party in the dialogue understands what exactly is being discussed. In fact, it is better to call each of the services by its own name to bring greater clarity to the subject matter.

    TCP/IP Components

    The various services included in TCP/IP and their functions can be classified according to the type of task they perform. The following is a description of protocol groups and their purpose.
    Transport protocols control the transfer of data between two machines.

    • TCP (Transmission Control Protocol). A protocol that supports data transfer based on a logical connection between the sending and receiving computers.
    • UDP (User Datagram Protocol). A protocol that supports data transfer without establishing a logical connection. This means that data is sent without first establishing a connection between the recipient and sender computers. An analogy can be drawn with sending mail to some address, when there is no guarantee that this message will arrive at the addressee, if he exists at all. , (The two machines are connected in the sense that they are both connected to the Internet, but they do not communicate with each other through a logical connection.)
    Routing protocols handle data addressing and determine the best ways to the addressee. They can also ensure that large messages are broken into several smaller messages, which are then transmitted sequentially and assembled into a single whole on the destination computer.
    • IP (Internet Protocol). Provides actual data transfer.
    • ICMP (Internet Control Message Protocol). Handles status messages for IP, such as errors and changes in network hardware that affect routing.
    • RIP (Routing Information Protocol). One of several protocols that determine the best route for delivering a message.
    • OSPF (Open Shortest Path First). An alternative protocol for determining routes.
    Network address support is a way to identify a machine with a unique number and name. (See below for more details on addresses)
    • ARP (Address Resolution Protocol). Defines unique numeric addresses of machines on the network.
    • DNS (Domain Name System). Determines numeric addresses from machine names.
    • RARP (Revere Address Resolution Protocol). Determines the addresses of machines on the network, but in a reverse way to ARP.
    Application services are programs that a user (or computer) uses to access various services.
    • BOOTP (Boot Protocol) boots a network machine by reading boot information from the server.
    • FTP (File Transfer Protocol) transfers files between computers.
    • TELNET provides exposed terminal access to the system, i.e. a user of one computer can connect to another computer and feel as if he is working at the keyboard of a remote machine.
    Gateway protocols help transmit routing messages and network status information across networks and process data for local area networks.
    • EGP (Exterior Gateway Protocol) is used to transmit routing information for external networks.
    • GGP (Gateway-to-Gateway Protocol) serves to transfer routing information between gateways.
    • IGP (Interior Gateway Protocol) is used to transmit routing information for internal networks.
    Other protocols do not fall into the categories mentioned above but play an important role in the network.
    • NFS (Network File System) allows you to use directories and files on a remote computer as if they existed on the local machine.
    • NIS (Network Information Service) maintains information about users of multiple computers on a network, making it easier to log in and check passwords.
    • RPC (Remote Procedure Call) allows remote application programs to communicate with each other in a simple and efficient way.
    • SMTP (Simple Mail Transfer Protocol) is a protocol that transfers email messages between machines.
    • SNMP (Simple Network Management Protocol) is an administrative protocol that sends messages about the status of the network and devices connected to it.
    All these types of services together make up TCP/IP - a powerful and efficient family of network protocols.
    We will not consider all these protocols in detail, because the technical details are not important for the end user. Instead, we will briefly discuss some important aspects of the TCP/IP protocols. If you want to learn more about TCP/IP, then refer to books specifically devoted to this topic.

    Brief history TCP/IP and Internet

    The Internet, as mentioned earlier, is not a single network, but is a collection of many networks that communicate through the use of common protocols. TCP/IP and the Internet are so closely related that the architecture of the TCP/IP network is often called the Internet architecture. The Internet emerged from the first ARPANET (the Advanced Research Projects Agency's network), which was designed to provide researchers working on military projects with the ability to quickly communicate with each other. initial stage The network was developed by Bolt, Beranek and Newinan (BBN), a company that had a strong influence on the development of this network.
    ARPANET began operating in 1971. Since its inception, the network has been constantly upgraded in accordance with the requirements of users, providing them with more and more functionality. One important requirement was the ability to transfer files between computers, which ultimately led to the development of the File Transfer Protocol (FTP).
    Another important need was support for remote terminal access to the system, which would allow a user of one system to connect to another machine on the network and work on it as if it were their own. For this purpose, Telnet and login were created - two utilities that implement remote terminal access to the system.
    With the increase in the number of users and the increase in network usage by already connected users, network traffic has increased significantly. Consequently, it became obvious that not only the network must be expanded, but an improved communication protocol must be developed. The TCP/IP protocols were proposed in 1973 and adopted in a standardized version in 1982. One of the research laboratories working on networking software was located at the University of California at Berkeley (UCB). This university was the center of development of the UNIX operating system for many years and contributed greatly to the improvement of TCP/IP. In 1983, UCB released a version of the UNIX system that included TCP/IP as an integral part of the operating system. TCP/IP became very popular due to the widespread use of UNIX, especially on networks connected to the growing ARPANET.
    When TCP/IP became sufficiently mature, proposals were submitted to the National Science Foundation, which led to the opening of funding for a project to create the Computer Science Network as a replacement for the overloaded ARPANET. In 1984, this led to the division of the network into two. One network, called MILNET, was dedicated to the military department. Another part of the ARPANET was dedicated to research and other non-military applications.
    The ARPANET was transformed when the Office of Advanced Scientific Computing (OASC) project to create a network for large-scale access to supercomputing was approved. OASC created another network - NSFNET, which, using high-speed telephone channels, connected six supercomputers located in different parts of the country. Other networks joined this network to share access to supercomputers and high-speed communication links. NFSNET has become the main backbone of the Internet. In 1990, the Department of Defense, which created the ARPANET, officially announced its abolition as having served its purpose and now being obsolete.

    Computer numeric address

    Each machine that is connected to the Internet or any other TCP/IP network must be uniquely identified. Without a unique identifier, the network doesn't know how to deliver the message to your machine. If several computers have the same identifier, the network will not be able to address the message.
    On the Internet, computers on a network are identified by assigning an Internet address, or more correctly, an IP address. IP addresses are always 32 bits long and consist of four 8-bit parts. This means that each part can take a value between 0 and 255. The four parts are combined into a notation in which each eight-bit value is separated by a period. For example, 255.255.255.255 or 147.120.3.28 are two IP addresses. When we talk about a network address, we usually mean an IP address.
    If all 32 bits of an IP address were used, there would be over four billion possible addresses - more than enough for the future Internet extensions! However, some bit combinations are reserved for special purposes, which reduces the number of potential addresses. Additionally, the 8-bit quads are grouped in special ways depending on the type of network, so that the actual number of possible addresses is even smaller.
    IP addresses are not assigned based on the principle of listing hosts on the network -1,2,3,.... In fact, an IP address consists of two parts: the network address and the host address in this network. Thanks to this structure of the IP address, computers on different networks can have the same numbers. Since the network addresses are different, computers are uniquely identified. Without such a scheme, numbering quickly becomes very awkward.
    IP addresses are allocated depending on the size of the organization and the type of its activities. If this is a small organization, then most likely there are few computers (and therefore IP addresses) on its network. In contrast, a large corporation may have thousands of computers organized into several interconnected local area networks. To ensure maximum flexibility, IP addresses are allocated depending on the number of networks and computers in the organization and are divided into classes A, B and C. There are also classes D and E, but they are used for specific purposes.
    Three classes of IP addresses allow them to be allocated based on the size of an organization's network. Since 32 bits is acceptable full size IP addresses, the classes break down the four 8-bit parts of the address into a network address and a host address depending on the class. One or more bits are reserved at the beginning of the IP address to identify the class.
    A Class A network address only has 7 bits for the network address and 24 bits for the host address. This allows you to identify more than 16 million different hosts on a single subnet - more than enough for the largest organization. Of course, there can only be 128 (2 to the seventh power) Class A networks.
    A Class B network address has 14 bits for the network address and 16 bits for the host address, allowing for more Class B networks to be allocated, but with fewer hosts. However, 16 bits can identify more than 65,000 hosts. Finally, Class C IP networks can have a maximum of 254 hosts, but there can be many such networks. Most networks are classified as Class B or Class C, although the Internet Network Information Center (InterNIC) has final say on the network class designation.
    The type of class to which the company's network belongs can be determined by the first number of the IP address. There are the following rules for the first 8-bit number:

    • Class A addresses - numbers between 0 and 127
    • Class B addresses - numbers between 128 and 191
    • Class C addresses - numbers between 192 and 223
    If your machine's IP address is 147.14.87.23, then you know that your machine is on a class B network, the network ID is 147.14, and your machine's unique number on this network is 87.23. If the IP address is 221.132.3.123, then the machine is on a class C network with network ID 221.132.3 and host ID 123.
    Whenever a message is sent to any host on the Internet, the IP address is used to indicate the sender and recipient addresses. Of course, you don't have to remember all the IP addresses yourself, since there is a special TCP/IP service for this called Domain Name System ( Domain system names).

    Gateway protocols

    To forward datagrams quickly and efficiently, gateways must know what is happening on the network. In addition to information about message routing, they need information about the parameters of subnets connected to the larger network so that they can adjust routes if some parts of the network fail.
    There are two types of gateways: internal and external. Gateways that are located on a small subnet can provide connectivity to a larger corporate network. Such gateways are called autonomous or self-contained because the connections between these gateways are persistent and rarely change. These gateways communicate with each other using the internal gateway protocol - IGP (Internal Gateway Protocol).
    Large networks, like the Internet, are not static in structure. Gateway settings are constantly changing as changes occur in numerous small subnets. Communication between such gateways is carried out through an external gateway protocol - EGP (Extenor Gateway Protocol).
    There is another gateway protocol that you may have heard of called Gateway-to-Gateway Protocol, or GGP. It is used between special gateways on Internet backbones. Such gateways relate to the entire Internet as a whole and ensure the transmission of traffic in the high-speed backbone part of the network.

    TCP and UDP

    As discussed at the beginning of this chapter when discussing protocol layers, the transport layer of the TCP/IP architecture provides a message delivery service. The TCP/IP family includes two different protocols that implement this service: Transmission Control Protocol (TCP) and User Datagram ProtocolUser Datagram Protocol (UDP). Both have found widespread use.
    The difference between them lies in the way the connection is established between the two computers. TCP establishes a direct logical connection, i.e., the computers are connected directly and each of them knows about the state of the other. UDP does not attempt to establish such a connection. This protocol simply adds an IP address to the generated message and sends it to the network.
    Obviously, TCP is a more reliable communication method because every received message is acknowledged. With UDP there is no guarantee that the message will actually be received. To confirm the receipt of a message, UDP uses a scheme in which the recipient's machine must send an acknowledgment of the received message, and if such an acknowledgment is not received by the sender within a certain period of time, then the transmission of the message is repeated.
    You might think that everyone would want to use TCP to transmit the message, but in reality most rely on UDP. Imagine how many connections need to be established with all the machines on the network - this is a gigantic figure, and every second new connections appear and old connections disappear. Using UDP greatly simplifies network traffic.
    Each type of TCP/IP service is designed to allow the use of either UDP or TCP. For example, Telnet and FTP use TCP because the connection must always exist between the two computers. Another way to transfer files, a protocol called Trivial FTP (TFTP), uses UDP (see "Trivial FTP" later in this chapter).
    Both protocols (TCP and UDP) add a header to the beginning of the message that the transport layer receives from more high levels. The content and structure of the TCP header is different from UDP, but both contain the same basic information about who sent the packet and to whom, specific message type information, and statistics.
    And finally, a few words about the term “datagram” associated with TCP/IP. A datagram is a composed message transmitted through all layers to the network. When talking about TCP/IP, it is more correct to use the term “datagram” instead of the term “message”.

    TCP ports and sockets

    Applications that use TCP must have a way to communicate with a specific service. To do this, the port numbers corresponding to each type of service are entered. For example, Telnet uses port number 23. The port number determines service type, requested by one machine from another, so when one machine sends a request to the 23rd port of another machine, the response will also come to the 23rd port.
    Don't confuse TCP ports with the ports on the back of your computer. A machine's serial ports, for example, are physical, while TCP ports are logical. When establishing a connection with a computer, its physical port may be used (a data line may be connected to it), but the system will then assign a logical TCP port for each type of service.
    Port numbers can be reassigned by the administrator, but changing the port number may cause problems. Most systems use standard port numbers, a list of which is available in the TCP/IP documentation. Regular users may not know which port is being used when, but this is not necessary since all Windows versions of TCP/IP packages use standard port numbers. A list of the most commonly used ports is given below:

    Each entry/exit point of any TCP layer on each machine is uniquely identified by a pair of numbers, collectively called a socket number, which consists of an IP address and a port number. A computer can use a socket number to communicate with another computer and network because IP addresses uniquely identify all computers on a network.
    Each machine on the network maintains a small table that contains a description of the usage of all ports. It's called a port table. When a connection is established, the port table of the other machine that supports the connection is entered into the port table. Thus, both machines participating in the connection will have the port numbers of the other machine, which is called port bindings. A port can be used for multiple connections at the same time - this is called multiplexing.

    IP protocol

    Internet Protocol (IP) is the main TCP/IP protocol. It is important to understand that although the word "Internet" appears in the name of the protocol, this does not limit its use. IP defines the protocol, not the connection.
    Internet Protocol does not establish a logical connection. This means that IP does not control the delivery of messages to the final destination. The IP addresses of the sending machine and the receiving machine are included in the datagram header and are used to transmit datagrams between gateways. This uses routing information located at the gateway to indicate where to send the datagram at each stage.
    The main task of IP is to address datagrams and transmit them between computers. It analyzes information about the destination and uses it to determine the best route. IP adds its own header to the message received from higher layers (TCP or UDP).
    IP also solves another problem associated with breaking long datagrams into several smaller parts and then reassembling them into their original form at the destination. Large datagrams can be broken for a number of reasons, including IP message size limitations (approximately 64K). Typically, the network cannot directly transmit such a large message, requiring the datagram to be broken into small fragments of several kilobytes.
    Several special terms are used to describe this process:

    • Segmentation is the process of breaking a datagram into several smaller datagrams.
    • Reassembly is the process of combining small datagrams into an original large datagram.
    • Separation is the inverse of concatenation, the process of splitting an entire datagram into several small messages for different application programs.
    IP performs all these processes without you noticing. Special algorithms are implemented to verify that the message is restored correctly and in its original form, and that all parts of the large message are received correctly. This is provided by information in the IP header and a number of special counters that IP uses to wait for all parts of the message. One of the problems with this type of message breakdown is that a fragmented message has a lower probability of delivery than an unfragmented message. Most application programs try to avoid fragmentation wherever possible.

    IPMR protocol

    Network failures may occur due to incorrect routing, loss or corruption of datagrams. At the same time, notifying the sender about problems that have arisen is no less important than processing error situations in the network itself. To accomplish this task, the Internet Control Message Protocol (ICMP) was created.
    ICMR is an error reporting system built into the Internet Protocol. ICMP messages can be treated as special IP messages. In other words, ICM is an IP-level communication system. The header of ICMP messages is the same as that of regular IP packets, and their processing on the network is completely the same as the processing of datagrams. In most cases, error messages sent by ICMP are sent back to the sender whose IP address is in the header.
    The ICMR message contains information about the problem that has occurred, as well as a fragment of the original message. This fragment serves to identify the error message and also contains some diagnostic information.

    TCP/IP Applications

    Now that you know how TCP, UDP, and IP package and transport messages, we can look at the TCP/IP family of protocols that are directly used in application programs. Some of the most commonly used protocols are Telnet and FTP. The main application protocols also include the Simple Mail Transfer Protocol (SMTP), used to transfer email messages. Finally, there is a set of utilities called Berkeley r-utilities, named after the university where they were developed.

    Telnet

    The Telnet protocol (from the words telecommurncation network - telecommunications network) provides the ability to log into a remote system. It allows the user of one computer to log on to a remote computer located on another part of the network. In this case, the user seems to be working at the terminal of a remote computer. Telnet may be useful if you are working on slow computer, you want to take advantage of the computing resources of a more powerful machine, or if the remote computer has the software you need.
    Before Telnet was developed, the only way to access the resources of another computer was a direct connection via a modem or through dedicated network ports, which, along with its simplicity, also had a number of significant limitations.
    Telnet is operated by a special program (server) running on the computer you are connecting to and processing incoming requests. Your computer is running a Telnet program (Telnet-KAiiCHT) that accesses the server. During the connection process, computers agree on the terminal emulation mode for a given work session. Essentially, one machine asks another what functions it supports.
    To start a Telnet session, you must enter the domain name or IP address of the remote computer. A domain name can only be used if the system can resolve the name to a numeric IP address using the DMS service. Once a connection is established, the system will typically prompt for a username and password, although this will vary depending on the type of operating system and software Telnet software installed on the stifled computer.
    Telnet commands vary depending on the Tclnet client you are using, especially when working with a GUI like Windows. In most cases, the Tclnet client will create a window in which work takes place in the command line.
    Once the connection is established, your computer plays the role of the remote machine's terminal. All commands you enter are executed on the remote computer. To end the work session, enter the appropriate command (for UNIX systems - usually logout or +.
    While in command input mode for a remote system, you can persist in command mode Telnet, usually using a key combination +. In this mode, you control the operation of the Tclnet client, not the remote computer.

    FTP

    Unlike Telnet, FTP (File Transfer Protocol) is not designed to work on a remote computer, but to transfer files between computers connected to the network. Just like Telnet, the FTP service is based on the joint use of two programs - the ssrserver program, which runs constantly in background, and the client program that you must run on your computer to start an FTP session. The FTP protocol allows you to transfer files in both text and binary formats.
    To establish an FTP connection, you must enter the domain name or numeric IP address of the computer on which the server program is running.
    After establishing a connection with a remote computer, you usually need to register on it. (Some FTP servers support what is called anonymous access, allowing all users to freely copy files stored there.) Once you log on to the remote computer, you still continue to work on your computer, sending only commands to the remote machine to browse directories and transfer files. This is essential FTP difference from Telnet, because with Telnet you are essentially working on a remote computer.
    Most FTP clients are designed to run in command line mode. However, FTP clients for Windows provide the user with a graphical interface that eliminates the need to enter commands in command line mode. All actions are performed using the menu, dialog boxes and graphic buttons. Therefore, connecting to a remote computer, browsing directories and transferring files requires only selecting the appropriate menu items and buttons.
    In general, working with an FTP server requires entering a user ID and password, but many systems provide the ability for all Internet users to freely copy files on them. This service is called anonymous FTP. To work with anonymous FTP, you do not need to be a registered user of the system, but simply enter “anonymous” as the login name. In this case, you either do not enter a password at all, or you can enter the word “guest” as a password, or your real name, or your email address.

    Trivial FTP

    Trivial File Transfer Protocol (TFTP, Trivial File Transfer Protocol) is one of the simplest protocols used to transfer files. It differs from FTP in that it does not require registration on the remote computer to transfer files. The user simply enters a file transfer request, specifying the name of the remote computer. In this case, TFTP generates UDP messages that are sent to the remote machine and with the help of which the file is transferred. When the transfer is complete, some versions of TFTP send a notification to the user. Note that many versions of TCP/IP software for Windows do not support TFTP.

    SMTP

    Simple Mail Transfer Protocol (SMTP) supports email over the Internet and other networks. Because the way e-mail is sent varies from operating system to operating system, many local networks do not use SMTP, but it is used to send mail over the Internet.
    The Internet (as well as most large corporate networks) is built on UNIX systems, which adopt SMTP as the standard mail transfer protocol. On UNIX systems, SMTP is supported through a program called sendmail. Users do not interact directly with sendmail, but use various application programs to work with sendmail. by email. These programs, in turn, exchange messages with sendmail.
    Packages for working with email in Windows environment are based on the use of various protocols, including SMTP. Many advanced email systems have built-in SMTP support, allowing you to exchange messages with global TCP/IP networks.