IP routing protocol. Routing protocols in IP networks Determining the route of information passing

IP stands for Internet Protocol, and specifically the 4th version of this protocol is currently the most common. IPv4 is defined through RFC 791.

Within OSI, it is a layer 3 network protocol. Let me remind you that this level is intended to determine the data transmission path.

IPv4 uses packet switching. In this case, the original transmitted message is divided into small parts (packets), which are transmitted over the network independently.

In addition, IPv4 does not guarantee that packets will be delivered or that there will be no duplicates. This is the so-called “best effort delivery” (as opposed to guaranteed delivery). Accordingly, these tasks are shifted to higher-level protocols such as TCP.

Addressing

IPv4 identifies the sender and recipient using a 32-bit address, which limits the number of possible addresses to 4,294,967,296. Of this number, IPv4 reserves special address ranges called private (~ 18 million) and multicast (~ 270 million).

Addresses are usually written as four decimal octets separated by a dot, for example: 198.51.100.25 corresponds to the number C6336419 16.

When using the global address space, it is necessary to distinguish between the addresses available in local physical networks that do not require routing, and addresses that are physically on another network. In the case of the latter, the packets are forwarded to the router, which must forward them further.

In the first versions of the standard, the first octet was used to identify the network, the rest to identify the node. It quickly became clear that 256 networks are not enough. Therefore, the classes of networks were introduced:

Class First bits Network address length Host address length
A 0 8 24
B 10 16 16
C 110 24 8
D 1110 N / A N / A
E 1111 N / A N / A
Class Range start End of range
A 0.0.0.0 127.255.255.255
B 128.0.0.0 191.255.255.255
C 192.0.0.0 223.255.255.255
D 224.0.0.0 239.255.255.255
E 240.0.0.0 255.255.255.255

Class D is reserved for multicast, class E is simply reserved “just in case”.

The length of the network address and the length of the host address were determined by the first bits of the address. Since about 1985, this has also been abandoned. The reason for this is that many organizations required more addresses than the class C network provided and received a class B network. The class B network, however, exceeded the organization's requirements at times.

The network classes have been replaced by the network mask. It is a bit mask that indicates which bits of the address are network related and which are host. By standard convention, the mask should be filled from left to right, so that the network address is always in the most significant bits. This only allows you to specify network address length, instead of the entire netmask.

For example, 192.0.2.0/24 means that the first 24 bits (three octets) refer to the network address and the rest to the host address. / 24 is equivalent to netmask 255.255.255.0.

The use of network masks is described in RFC 1517.

Numerous standards also reserve different address ranges for special needs.

Range Description RFC
0.0.0.0/8 Current network (source address) 6890
10.0.0.0/8 Private network 1918
100.64.0.0/10 Shared CGN Address Space 6598
127.0.0.0/8 Loopback 6890
169.254.0.0/16 Autoconfiguration 3927
172.16.0.0/12 Private network 1918
192.0.0.0/24 IETF Protocol Assignments 6890
192.0.2.0/24 Documentation and examples 1 5737
192.88.99.0/24 Relay ipv6 to ipv4 3068
192.168.0.0/16 Private network 1918
198.18.0.0/15 Testing network bandwidth 2544
198.51.100.0/24 Documentation and examples 2 5737
203.0.113.0/24 Documentation and examples 3 5737
224.0.0.0/4 Multicast 5771
240.0.0.0/4 Reserved 1700
255.255.255.255 Broadcast request 919

The addresses of nodes are also reserved, in binary representation consisting of zeros (denotes the entire network, reserved) and ones (broadcast request for this network).

For example, 203.0.113.0 means (in the text) the network 203.0.113.0/24, and 203.0.113.255 is a broadcast request to this network.

Packet format

The package consists of a header and data. IP does not imply any kind of integrity check. The underlying protocol (say, Ethernet) already provides integrity checking at the link layer, and the upstream protocol (say, TCP) at the data layer.

Version, 4 bits First header field. In IPv4 it is 0010 2, i.e. 4. Header length, 4 bits The number of 32-bit words in the header. The minimum value is 5, which corresponds to a header length of 20 bytes. The maximum is 15, the length of the header is 60 bytes. DSCP or ToS - type of service, 6 bits Determines the prioritization for, say, VoIP. ECN, 2 bits Flag to explicitly indicate network congestion. Requires support from both sides (receiving and transmitting). When this flag is received, the baud rate is lowered. If there is no flag support, the packets are simply dropped. Full length, 16 bits The total length of the packet in bytes, including header and data. The minimum length is 20, the maximum is 65535. Identification, 16 bits Used to uniquely identify the datagram. Since it may be necessary to split the packet into smaller parts during transmission over different networks, this field is used to identify the parts belonging to the same packet. Flags, 3 bits

Bit flags:

  1. Reserved, always 0
  2. Don't fragment. If further transmission of the packet requires fragmentation, the packet is discarded.
  3. More fragments. For fragmented packets, all but the last one have this flag set to 1.
Offset, 13 bits Offset of the fragment relative to the beginning of the datagram, measured in blocks of 64 bits. The first fragment has an offset of 0. The maximum offset is 65528 bytes, which exceeds the maximum packet length of 65515 (minus the 20-byte header). Time to Live (TTL), 8 bits When a packet passes through a router, this field is decremented by 1. If this field is zero, the router discards it. Protocol, 8 bit
  • 1 - ICMP
  • 6 - TCP
  • 17 - UDP
Header checksum, 16 bits The sum of 16-bit words in the header is counted, except for the checksum itself. This sum is also summed up in blocks of 16 bits until there is one left. Negation is then applied to the result bit by bit. Sender's address, 32 bits Everything is clear here Recipient's address, 32 bits Everything is clear here too. Options (optional field)

It is rarely used. Consists of header-data blocks. The option header is 8-16 bits long and consists of the following fields:

  • Option type, 8 bits - a field that defines what this option is. The value “0” means the end of the list of options. A total of 26 codes have been registered.
  • Length, 8 bits - the size of the entire option in bits, including the header. May not be available for some types of options.

ARP

IP defines logical addresses. However, in order to send a packet on an Ethernet network, you also need to know the physical address of the target node (or router). ARP is used to map one to the other.

ARP (Address Resolution Protocol) is formally a network (3rd) layer protocol in the OSI model, although in fact it provides interworking of the 2nd and 3rd layers. ARP is implemented for various pairs of Layer 2 and Layer 3 protocols.

The protocol itself is built on a simple request-response scheme. Let's consider a specific example.

If a host, say A with logical address 198.51.100.1 (on network 198.51.100.0/24) wants to send a packet to host B with logical address 198.51.100.2, it sends a L2 protocol broadcast request (in this case Ethernet) with an encapsulated message ARP asking network nodes - what is the physical address of the node with the logical address 198.51.100.2, and containing the logical and physical addresses of the node A. Node B, seeing its own logical address in the request, sends a response to the node A at the logical and physical addresses received in the request. Query results are cached.

ARP messages are structured as follows:

Physical protocol (HTYPE), 2 bytes Layer 2 protocol used. Ethernet has an identifier of 1. Logical protocol (PTYPE), 2 bytes The protocol used is 3 layer. Corresponds to EtherType types. IPv4 has an ID of 0x0800. Physical address length (HLEN), 1 byte Physical address length in octets, for Ethernet - 6 Logical address length (PLEN), 1 byte Logical address length in octets, for IPv4 - 4 Operation (OPER), 2 bytes 1 for request, 2 for an answer, and many other options for protocol extensions. Physical address of the sender (SHA), HLEN bytes In the request - the address of the requestor. The response contains the address of the requested node. Sender logical address (SPA), PLEN bytes
Destination physical address (THA), HLEN bytes Ignored in the request. The reply contains the address of the requestor. Destination logical address (TPA), PLEN bytes

Typically hosts will also send ARP messages when they change their IP address or when they turn on. This is usually implemented as an APR request where TPA = SPA and THA = 0. Another option is an ARP response where TPA = SPA and THA = SHA.

In addition, ARP can be used to detect logical address collisions (with SPA = 0).

There are protocol extensions that perform reverse operations, InARP (Inverse ARP), which gets the L3 address from the L2 address, and RARP, which gets the L3 address of the requesting node.

RARP was used to autoconfigure L3 addresses. Subsequently replaced by BOOTP and then DHCP.

IPv4 routing

The basic routing algorithm in IPv4 networks is called the forwarding algorithm.

If there is a target address D and a network prefix N, then

  • If N is the same as the network prefix of the current node, send the data over the local link.
  • If there is a route for N in the routing table, send the next-hop data to the router.
  • If there is a default route, send next-hop data to the default router
  • Otherwise - an error.

The routing table is a table of mapping between network addresses and next-hop router addresses for these networks. So, for example, a node with the address 198.51.100.54/24 can have the following routing table: 203.0.113.0/24

Destination Gateway Device
198.51.100.0/24 0.0.0.0 eth0
203.0.113.0/24 198.51.100.1 eth0
0.0.0.0/0 203.0.113.1 eth0

Basically, the route is also tied to the network device from which the data should be sent.

If a node can be reached via more than one route, a route with a longer netmask (i.e. more specific) is chosen. There can be only one default route.

For example, node 198.51.100.54/24 has a routing table:

Destination Gateway Device
198.51.100.0/24 0.0.0.0 eth0
203.0.113.0/24 198.51.100.1 eth0
203.0.113.224/27 198.51.100.5 eth0

Or gateway, is called a network node with several IP interfaces (containing its own MAC address and IP address) connected to different IP networks, which, based on the solution of the routing problem, redirects datagrams from one network to another for delivery from the sender to the recipient.

They are either specialized computers or computers with several IP-interfaces, the operation of which is controlled by special software.

IP routing

Routing is used to receive a packet from one device and transmit it over the network to another device through other networks. If there are no routers on the network, then routing is not supported. Routers direct (forward) traffic to all networks that make up the internetwork.

To route a packet, a router must have the following information:

  • Destination address
  • Neighboring router from which it can learn about remote networks
  • Accessible paths to all remote networks
  • Best path to every remote network
  • Maintenance Techniques and Checking Routing Information

The router learns about remote networks from neighboring routers or from the network administrator. The router then builds a routing table that describes how to find remote networks.

If a network is connected directly to a router, it already knows how to route a packet to that network. If the network is not directly connected, the router must learn (learn) the access paths to the remote network using static routing (by the administrator manually entering the location of all networks in the routing table) or using dynamic routing.

Dynamic routing is a routing protocol process that determines how a device communicates with neighboring routers. The router will update information about every network it learns. If a change occurs in the network, the dynamic routing protocol automatically informs all routers of the change. If you are using static routing, your system administrator will have to update the routing tables on all devices.

IP routing is a simple process that is the same across networks of all sizes. For example, the figure shows the step-by-step process for host A to interact with host B on a different network. In the example, the user of host A ping the IP address of host B. Further operations are not so simple, so let's take a closer look at them:

  • At the command line, the user types ping 172.16.20.2. Host A generates the packet using network layer protocols and ICMP.

  • IP refers to ARP to find out the destination network for the packet by looking at the IP address and subnet mask of host A. This is a request to the remote host, i.e. the packet is not intended for a host on the local network, so the packet must be directed to a router to be redirected to the correct remote network.
  • For Host A to be able to send a packet to the router, the host must know the hardware address of the router interface on the LAN. The network layer passes the packet and destination hardware address to the link layer for framing and forwarding to the local host. To obtain a hardware address, a host looks for the location of the destination in its own memory, called the ARP cache.
  • If the IP address was not already available and is not in the ARP cache, the host sends an ARP broadcast to look up the hardware address at IP 172.16.10.1. This is why the first Ping request will usually time out, but the other four will succeed. After caching the address, there is usually no timeout.
  • The router responds and reports the hardware address of the Ethernet interface connected to the LAN. The host now has all the information to forward the packet to the router over the local network. The network layer drops the packet down to generate an ICMP echo request (Ping) at the link layer, padding the packet with the hardware address to which the host should send the packet. The packet has source and destination IP addresses along with an indication of the packet type (ICMP) in the network layer protocol field.
  • The link layer creates a frame in which the packet is encapsulated along with the control information needed to be sent over the local network. This information includes the source and destination hardware addresses, and the type field value set by the network layer protocol (this will be the type field, since IP defaults to Ethernet_II frames). Figure 3 shows a frame generated at the link layer and sent over the local media. Figure 3 shows all the information needed to communicate with the router: source and destination hardware addresses, source and destination IP addresses, data, and the frame CRC in the FCS (Frame Check Sequence) field.
  • Host A's data link layer passes the frame to the physical layer. There, zeros and ones are encoded into a digital signal with the subsequent transmission of this signal over a local physical network.

  • The signal reaches the Ethernet 0 interface of the router, which is synchronized to the digital signal preamble to retrieve the frame. After building the frame, the router interface checks the CRC, and at the end of receiving the frame, it compares the received value with the contents of the FCS field. In addition, it checks the transfer process for fragmentation and media conflicts.
  • The hardware destination address is checked. Since it matches the address of the router, the frame type field is analyzed to determine what to do next with this data packet. The type field is IP, so the router forwards the packet to the IP process that the router runs. The frame is deleted. The original packet (generated by host A) is placed in the router buffer.
  • IP looks at the destination IP address in a packet to determine if the packet is forwarded to the router itself. Since the destination IP address is 172.16.20.2, the router determines from its routing table that the 172.16.20.0 network is directly connected to Ethernet 1.
  • The router sends the packet from the buffer to the Ethernet 1 interface. The router needs to frame the packet to forward the packet to the destination host. The router first checks its ARP cache to determine if the hardware address has already been resolved in previous interactions with this network. If the address is not in the ARP cache, the router sends an ARP broadcast request to Ethernet 1 to look up the hardware address for IP address 172.16.20.2.
  • Host B responds with the hardware address of its network adapter to an ARP request. The Ethernet 1 interface of the router now has everything it needs to forward the packet to the final destination. The figure shows a frame generated by a router and transmitted over the local physical network.

The frame generated by the router's Ethernet 1 interface has a source hardware address from Ethernet 1 and a destination hardware address for host B's network adapter. source and destination never change. The package is not modified in any way, but frames are changed.

  • Host B receives the frame and checks the CRC. If the check is successful, the frame is dropped and the packet is forwarded to IP. It analyzes the destination IP address. Since the destination IP address is the same as the address set on host B, the IP protocol examines the protocol field to determine the target of the packet.
  • Our packet contains an ICMP echo request, so host B generates a new ICMP echo reply with a source IP address equal to that of host B and a destination IP address equal to that of host A. The process starts over, but in the opposite direction. However, the hardware addresses of all devices along the packet path are already known, so all devices can obtain the hardware interface addresses from their own ARP caches.

In large networks, the process is similar, but the packet will have to travel more sections on the way to the destination host.

Routing tables

In the TCP / IP stack, routers and end nodes make decisions about who to send a packet to in order to successfully deliver it to its destination based on so-called routing tables.

The table is a typical example of a route table using IP network addresses for the network shown in the figure.

Routing table for Router 2

The table shows the multi-route routing table, since it contains two routes to the network 116.0.0.0. In the case of building a single-route routing table, you need to specify only one path to the network 116.0.0.0 using the smallest metric value.

As you can see, the table contains several routes with different parameters. Each such entry in the routing table must be read as follows:

To deliver a packet to the network with an address from the Network address field and a mask from the Network mask field, you need to send the packet from the interface with the IP address from the Interface field to the IP address from the Gateway address field, and the "cost" of such delivery will be equal to the number from the field Metrics.

In this table, the "Destination network address" column contains the addresses of all networks to which this router can forward packets. In the TCP / IP stack, a so-called one-step approach to optimizing the packet forwarding route (next-hop routing) is adopted - each router and end node takes part in choosing only one step for transmitting a packet. Therefore, in each line of the routing table, not the entire route is indicated as a sequence of IP addresses of routers through which the packet must pass, but only one IP address - the address of the next router to which the packet must be transmitted. Along with the packet, the responsibility for choosing the next hop is passed to the next router. A one-step approach to routing means a distributed solution to the route selection problem. This removes the restriction on the maximum number of transit routers on the path of a packet.

To send a packet to the next router, knowledge of its local address is required, but in the TCP / IP stack, routing tables use only IP addresses to preserve their universal format, regardless of the type of networks included in the internetwork. To find a local address from a known IP address, you need to use the ARP protocol.

One-hop routing has another advantage - it allows you to reduce the size of the routing tables in end nodes and routers by using the so-called default route (0.0.0.0) as the destination network number, which usually occupies the last row in the routing table. If there is such an entry in the routing table, then all packets with network numbers that are not in the routing table are forwarded to the router specified in the default line. Therefore, routers often store limited information about the networks on the internetwork in their tables, forwarding packets for the rest of the networks to the default port and router. It is assumed that the default router will forward the packet to the backbone, and the routers connected to the backbone are fully aware of the composition of the internetwork.

In addition to the default route, there are two types of special entries in the routing table — an entry for a host-specific route and an entry for the addresses of networks directly connected to the router's ports.

A node-specific route contains a full IP address instead of a network number, that is, an address that has non-zero information not only in the network number field, but also in the node number field. It is assumed that for such an end node, the route should be chosen differently than for all other nodes of the network to which it belongs. In the case when the table contains different records on the forwarding of packets for the entire network N and its separate node with the address N, D, when a packet addressed to the node N, D arrives, the router will give preference to the record for N, D.

Routing table entries for networks directly connected to the router contain zeros (connected) in the Metric field.

Routing algorithms

Basic requirements for routing algorithms:

  • accuracy;
  • simplicity;
  • reliability;
  • stability;
  • Justice;
  • optimality.

There are various algorithms for constructing tables for one-hop routing. They can be divided into three classes:

  • simple routing algorithms;
  • fixed routing algorithms;
  • adaptive routing algorithms.

Regardless of the algorithm used to build the routing table, the result of their work has a uniform format. Due to this, in the same network, various nodes can build routing tables according to their algorithms, and then exchange the missing data with each other, since the formats of these tables are fixed. Therefore, an adaptive router can provide an end node using a fixed routing algorithm with information about the path to a network that the end node knows nothing about.

Simple routing

This is a routing method that does not change when the topology and state of the data transmission network (PDN) change.

Simple routing is provided by various algorithms, typical of which are the following:

  • Random routing is the transmission of a message from a node in any randomly chosen direction, with the exception of the directions along which the message arrived by the node.
  • Avalanche routing is the transmission of a message from a node in all directions, except for the direction in which the message arrived at the node. This routing guarantees short packet delivery times at the expense of bandwidth degradation.
  • Routing by previous experience - each packet has a counter of the number of nodes passed, a counter is analyzed at each communication node and the route that corresponds to the minimum value of the counter is memorized. This algorithm allows you to adapt to changes in the network topology, but the adaptation process is slow and inefficient.

In general, simple routing does not provide directional packet transmission and has low efficiency. Its main advantage is to ensure the stable operation of the network in the event of failure of various parts of the network.

Fixed routing

This algorithm is used in networks with a simple link topology and is based on manual creation of the routing table by the network administrator. The algorithm often works effectively also for the backbones of large networks, since the backbone itself can have a simple structure with obvious best paths for packets in the subnets connected to the backbone, the following algorithms are distinguished:

  • One-way fixed routing is when a single path is established between two subscribers. A network with such routing is not resilient to failures and congestion.
  • Multipath Fixed Routing - Several possible paths can be set and a path selection rule is introduced. The efficiency of such routing decreases with increasing load. If any communication line fails, it is necessary to change the routing table; for this, several tables are stored in each communication node.

Adaptive routing

This is the main type of routing algorithms used by routers in modern networks with complex topologies. Adaptive routing is based on the fact that routers periodically exchange specific topological information about the networks available on the internetwork, as well as about the connections between the routers. Usually, not only the topology of links is taken into account, but also their throughput and state.

Adaptive protocols allow all routers to collect information about the topology of links in the network, quickly processing all changes in the configuration of links. These protocols are distributed in nature, which is expressed in the fact that there are no dedicated routers in the network that would collect and generalize topological information: this work is distributed among all routers, the following algorithms are distinguished:

  • Local adaptive routing - each node contains information about the state of the link, the length of the queue and the routing table.
  • Global adaptive routing - based on the use of information received from neighboring nodes. To do this, each node contains a routing table, which indicates the transit time of messages. Based on the information received from neighboring nodes, the table value is recalculated taking into account the queue length in the node itself.
  • Centralized adaptive routing - there is some central node that collects information about the state of the network. This center generates control packets containing routing tables and sends them to communication nodes.
  • Hybrid adaptive routing - based on the use of a table periodically sent out by the center and on the analysis of the queue length from the node itself.

Algorithm indicators (metrics)

Routing tables contain information that switching programs use to select the best route. What characterizes the construction of routing tables? What is the peculiarity of the nature of the information they contain? This section on algorithm performance attempts to answer the question of how an algorithm determines the preference of one route over others.

Many different metrics are used in routing algorithms. Complex routing algorithms can be based on multiple metrics in route selection, combining them in such a way that the result is a single hybrid metric. The following are the metrics that are used in routing algorithms:

  • Route length.
  • Reliability.
  • Delay.
  • Bandwidth.

Route length.

Route length is the most common routing metric. Some routing protocols allow network administrators to assign arbitrary prices to each channel on the network. In this case, the path length is the sum of the costs associated with each channel that has been traversed. Other routing protocols define "hop count" (hops), which is a measure of the number of passes a packet must make on its way from source to destination through network interconnections (such as routers).

Reliability.

Reliability, in the context of routing algorithms, refers to the reliability of each link in the network (usually described in terms of the bit / error ratio). Some channels on the network may fail more often than others. Failures of some network channels can be eliminated more easily or faster than failures of other channels. Any reliability factors can be taken into account when assigning reliability ratings. Reliability ratings are usually assigned to network links by administrators. As a rule, these are arbitrary digital values.

Delay.

Routing latency is generally understood to mean the length of time it takes for a packet to travel from source to destination across the internetwork. Latency depends on many factors, including the bandwidth of the intermediate network links, the queues at the port of each router in the path of the packet, congestion on all intermediate links in the network, and the physical distance the packet needs to move. Since there is a conglomeration of several important variables, latency is the most common and useful metric.

Bandwidth.

Bandwidth refers to the available traffic power of a channel. All things being equal, 10 Mbps Ethernet is the preferred link for any leased line with 64 Kb / s bandwidth. Although bandwidth is an estimate of the maximum achievable channel capacity, routes that go through links with higher bandwidth are not necessarily better than routes that go through less fast links.

Internal Routing Protocol RIP

This routing protocol is designed for relatively small and relatively homogeneous networks. The route is characterized by the vector of the distance to the destination. Each router is assumed to be the starting point for several routes to the networks with which it is associated. Descriptions of these routes are stored in a special table called route. The RIP routing table contains an entry for each serviced machine (for each route). The entry must include:

  • Destination IP address.
  • Route metric (1 to 15; number of steps to destination).
  • The IP address of the nearest router (gateway) along the path to the destination.
  • Route timers.

Periodically (once every 30 seconds), each router broadcasts a copy of its routing table to all neighboring routers with which it is directly connected. The receiving router looks at the table. If there is a new path or shorter path message in the table, or there have been changes in path lengths, those changes are committed by the receiver in its routing table. RIP must be able to handle three types of errors:

Cyclic routes.

To suppress instabilities, RIP should use a small value of the maximum possible number of steps (no more than 16).

The slow propagation of routing information over the network creates problems when the routing situation changes dynamically (the system does not keep up with the changes). A small metric limit improves convergence, but does not fix the problem.

OSPF Link State Protocol

The Open Shortest Path Firs (OSPF) protocol is an implementation of the link state algorithm (it was adopted in 1991) and has many features oriented to use in large heterogeneous networks.

OSPF calculates routes on IP networks while preserving other routing exchange protocols.

The directly connected routers are called neighbors. Each router stores information about the state in which it thinks the neighbor is. A router relies on neighboring routers and only sends data packets to them if it is confident that they are fully operational. To find out the state of the links, the neighboring routers exchange short HELLO messages quite often.

To propagate link state data across the network, routers exchange messages of a different type. These messages are called router links advertisement - advertisement of the router's links (more precisely, the state of the links). OSPF routers exchange not only their own, but also foreign link advertisements, eventually receiving information about the state of all links in the network. This information forms the graph of network connections, which, of course, is the same for all routers in the network.

BGP protocol

The general scheme of BGP work is as follows. BGP routers of neighboring SSs that decide to exchange routing information establish BGP connections between themselves and become BGP neighbors (BGP peers).

BGP then uses an approach called path vector, which is an extension of the distance vector approach. BGP neighbors advertise path vectors to each other. A path vector, unlike a distance vector, contains not just the network address and distance to it, but the network address and a list of path attributes that describe various characteristics of the route from the sending router to the specified network. In what follows, for brevity, we will call a data set consisting of a network address and attributes of a path to this network a route to a given network.

BGP implementation

A pair of BGP neighbors establishes a TCP connection with each other, port 179. Neighbors belonging to different AS should be directly accessible to each other; there is no such restriction for neighbors from one AS, since the internal routing protocol will ensure that all the necessary routes are available between the nodes of the same autonomous system.

The flow of information exchanged between BGP neighbors over TCP consists of a sequence of BGP messages. The maximum message length is 4096 octets, the minimum is 19. There are 4 message types.

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-2.jpg" alt = "(! LANG:> IP Routing Protocol">!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-3.jpg" alt = "(! LANG:> IP address l IPv 4 address is a unique 32-bit a sequence of binary digits,"> IP-адрес l IPv 4 -адрес - это уникальная 32 разрядная последовательность двоичных цифр, с помощью которой компьютер однозначно идентифицируется в IP сети. (на канальном уровне в роли таких же уникальных адресов компьютеров выступают МАС адреса сетевых адаптеров, невозможность совпадения которых контролируется изготовителями на стадии производства.)!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-4.jpg" alt = "(! LANG:> IP version l version 4, or IPv 4 l version 6 (IPv 6),"> Версии l версия 4 протокола IP, или IPv 4 l версия 6 (IPv 6), в которой IP адрес представляется в виде 128 битной последовательности двоичных цифр. ipv 6 install!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-5.jpg" alt = "(! LANG:> Structure l For the convenience of working with IP addresses, the 32-bit sequence is usually"> Структура l Для удобства работы с IP адресами 32 разрядную последовательность обычно разделяют на 4 части по 8 битов (на октеты) l каждый октет переводят в десятичное число и при записи разделяют эти числа точками. l в таком виде (это представление называется «десятичные числа с точками» , или, «dotted decimal notation») IP адреса занимают гораздо меньше места и намного легче запоминаются 192. 168. 5. 200 11000000 10101000 0000101 11001000!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-6.jpg" alt = "(! LANG:> Subnet mask l Subnet mask is a 32-bit number consisting of going"> Маска подсети l Маска подсети - это 32 разрядное число, состоящее из идущих вначале единиц, а затем - нулей, например (в десятичном представлении) 255. 0 ИЛИ 255. 240. 0.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-7.jpg" alt = "(! LANG:> Subnet mask l Subnet mask plays an extremely important role in IP addressing and"> Маска подсети l Маска подсети играет исключительно важную роль в IP адресации и маршрутизации l сеть ARPANet строилась как набор соединенных друг с другом гетерогенных сетей. Для правильного взаимодействия в такой сложной сети каждый участник должен уметь определять, какие IP адреса принадлежат его локальной сети, а какие - удаленным сетям. l здесь и используется маска подсети, с помощью которой производится разделение любого IP адреса на две части: идентификатор сети (Net ID) и идентификатор узла (Host ID). l такое разделение делается очень просто: там, где в маске подсети стоят единицы, находится идентификатор сети, а где стоят нули - идентификатор узла. Например, в IP адресе 192. 168. 5. 200 при использовании маски подсети 255. 0 идентификатором сети будет число 192. 168. 5. 0, а идентификатором узла - число 200. Стоит поменять маску подсети, на число 255. 0. 0, как и идентификатор узла, и идентификатор сети изменятся на 192. 168. 0. 0 и 5. 200, соответственно, и от этого, иначе будет вести себя компьютер при посылке IP пакетов.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-8.jpg" alt = "(! LANG:> Rules for assigning IP addresses of networks and hosts 1. network ID is not can only contain"> Правила назначения IP-адресов сетей и узлов 1. идентификатор сети не может содержать только двоичные нули или только единицы. Например, адрес 0. 0 не может являться идентификатором сети; 2. идентификатор узла также не может содержать только двоичные нули или только единицы - такие адреса зарезервированы для специальных целей l все нули в идентификаторе узла означают, что этот адрес является адресом сети. Например, 192. 168. 5. 0 является правильным адресом сети при использовании маски 255. 0 и его нельзя использовать для адресации компьютеров, l все единицы в идентификаторе узла означают, что этот адрес является адресом широковещания для данной сети. Например, 192. 168. 5. 255 является адресом широковещания в сети 192. 168. 5. 0 при использовании маски 255. 0 и его нельзя использовать для адресации компьютеров!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-9.jpg" alt = "(! LANG:> Rules for assigning IP addresses of networks and hosts l host ID within one and"> Правила назначения IP-адресов сетей и узлов l идентификатор узла в пределах одной и той же подсети должен быть уникальным; l диапазон адресов от 127. 0. 0. 1 до 127. 255. 254 нельзя использовать в качестве IP адресов компьютеров. Вся сеть 127. 0. 0. 0 по маске 255. 0. 0. 0 зарезервирована под так называемый «адрес заглушки» (loopback), используемый в IP для обращения компьютера к самому себе. PING 127. 12. 34. 56!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-10.jpg" alt = "(! LANG:> l IP addresses are distributed worldwide by a private non-profit corporation called ICANN"> l Распределением IP адресов в мире занимается частная некоммерческая корпорация под названием ICANN (Internet Corporation for Assigned Names and Numbers), а точнее, работающая под ее патронажем организация IANA (Internet Assigned Numbers Authority).!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-11.jpg" alt = "(! LANG:> Classless and Classless IP Addressing">!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-12.jpg" alt = "(! LANG:> Development l Initially, the entire space of possible IP addresses was divided into five classes"> Развитие l Первоначальная все пространство возможных IP адресов было разбито на пять классов l принадлежность IP адреса к определенному классу определялась по нескольким битам первого октета l для адресации сетей и узлов использовались только классы А, В и С. l для этих сетей были определены фиксированные маски подсети по умолчанию, равные, соответственно, 255. 0. 0. 0, 255. 0. 0 и 255. 0, которые не только жестко определяли диапазон возможных IP адресов узлов в таких сетях, но и механизм маршрутизации.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-13.jpg" alt = "(! LANG:> Address Classes in Original IP Addressing Scheme Class First Possible Bits v"> Классы адресов в первоначальной схеме IP-адресации Класс Первые Возможное число биты в значения сетей узлов в сети октете первого октета А 0 1 -126 16777214 В 10 128 -191 16384 65534 С 110 192 -223 2097152 254 D 1110 224 -239 Используется для многоадресной рассылки (multicast) Е 1111 240 -254 Зарезервирован как экспериментальный!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-14.jpg" alt = "(! LANG:> Problems l Organizations were asked to fill out a registration form to get the desired range of IP addresses ,"> Проблемы l Для получения нужного диапазона IP адресов организациям предлагалось заполнить регистрационную форму, в которой следовало указать текущее число компьютеров и планируемый рост компью терного парка в течение двух лет. l с развитием Интернета такой подход к распределению IP адресов стал вызывать проблемы, особенно острые для сетей класса В. l организациям, в которых число компьютеров не превышало нескольких сотен (скажем, 500), приходилось регистрировать для себя целую сеть класса В. l Поэтому количество доступных сетей класса В стало на глазах «таять» , но при этом громадные диапазоны IP адресов (в нашем примере - более 65000) пропадали зря.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-15.jpg" alt = "(! LANG:> Solving the problem l To solve the problem, a classless IP addressing scheme was developed">!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-16.jpg" alt = "(! LANG:> Classless IP Addressing Scheme (Classless Inter. Domain Routing,) , CIDR l missing IP address binding"> Бесклассовая схема IP-адресации (Classless Inter. Domain Routing,), CIDR l отсутствует привязка IP адреса к классу сети и маске подсети по умолчанию l допускается применение так называемых масок подсети с переменной длиной (Variable Length Subnet Mask, VLSM). l Например, если при выделении сети для вышеуказанной организации с 500 компьютерами вместо фиксированной маски 255. 0. 0 использовать маску 255. 254. 0 то получившегося диапазона из 512 возможных IP адресов будет вполне достаточно. Оставшиеся 65 тысяч адресов можно зарезервировать на будущее или раздать другим желающим подключиться к Интернету. Этот подход позволил гораздо более эффективно выделять организациям нужные им диапазоны IP адресов, и проблема с нехваткой IP сетей и адресов стала менее острой.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-17.jpg" alt = "(! LANG:> l Calculation of the maximum possible number of nodes in any IP network how many bits"> l Рассчет максимально возможного количества узлов в любой IP сети сколько битов содержится в идентификаторе узла, или, иначе, сколько нулей имеется в маске подсети. l Это число используется в качестве показателя степени двойки, а затем из результата вычитается два зарезервированных адреса (сети и широковещания). l Аналогичным способом легко вычислить и возможное количество сетей классов А, В или С, если учесть, что первые биты в октете уже зарезервированы, а в классе А нельзя использовать IP адреса 0. 0 и 127. 0. 0. 0 для адресации сети.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-18.jpg" alt = "(! LANG:> IP addresses for local networks l All addresses used on the Internet, must register with"> IP-адреса для локальных сетей l Все используемые в Интернете адреса, должны регистрироваться в IANA, что гарантирует их уникальность в масштабе всей планеты. Такие адреса называют реальными, или публичными (public) IP адресами. l Для локальных сетей, не подключенных к Интернету, регистрация IP адресов, естественно, не требуется, так что, в принципе, здесь можно использовать любые возможные адреса. Однако, чтобы не допускать возможных конфликтов при последующем подключении такой сети к Интернету, RFC 1918 рекомендует применять в локальных сетях только следующие диапазоны так называемых частных (private) IP адресов (в Интернете эти адреса не существуют и использовать их там нет возможности): ¡ 10. 0- 10. 255; ¡ 172. 16. 0. 0- 172. 31. 255; а!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-19.jpg" alt = "(! LANG:> IP Routing Basics l to properly interact with other computers and networks , each"> Основы IР-маршрутизации l чтобы правильно взаимодействовать с другими компьютерами и сетями, каждый компьютер определяет, какие IP адреса принадлежат его локальной сети, а какие - удаленным сетям. l если выясняется, что IP адрес компьютера назначения принадлежит локальной сети, пакет посылается непосредственно компьютеру назначения, если же это адрес удаленной сети, то пакет посылается по адресу основного шлюза.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-20.jpg" alt = "(! LANG:> Example COMPUTER l IP address 192.168.5.200 ; l subnet mask -"> Пример КОМПЬЮТЕР l IP адрес - 192. 168. 5. 200; l маска подсети - 255. 0; l основной шлюз - 192. 168. 5. 1. При запуске протокола IP на компьютере выполняется операция логического «И» между его собственными IP адресом и маской подсети l IP адрес в 32 разрядном виде 11000000 10101000 00000101 11001000; l маска подсети - 11111111 0000; l идентификатор сети - 11000000 10101000 00000101 0000 Т. е. 192. 168. 5. 0 идентификатор собственной сети!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-21.jpg" alt = "(! LANG:> Example Task: Send an IP packet to 192.168. 5. 15.l the computer performs"> Пример Задача: отправить IP-пакет по адресу 192. 168. 5. 15. l компьютер выполняет операцию логического «И» с IP адресом компьютера назначения и собственной маской подсети. l полученный в результате идентификатор сети назначения будет совпадать с идентификатором собственной сети компьютера отправителя.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-22.jpg" alt = "(! LANG:> Example This will tell our computer that the destination computer is in the same him"> Пример Так наш компьютер определит, что компьютер назначения находится в одной с ним сети, и выполнит следующие операции: l с помощью протокола ARP будет определен физический МАС адрес, соответствующий IP адресу компьютера назначения; l с помощью протоколов канального и физического уровня по этому МАС адресу будет послана нужная информация.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-23.jpg" alt = "(! LANG:> Example 2 Task: send an IP packet to 192.168 10. 20. l The computer will execute"> Пример 2 Задача: отправить IP-пакет по адресу 192. 168. 10. 20. l Компьютер выполнит аналогичную процедуру определения идентификатора сети назначения. l В результате будет получен адрес 192. 168. 10. 0, не совпадающий с идентификатором сети компьютера отправителя. l Так будет установлено, что компьютер назначения находится в удаленной сети, и алгоритм действий компьютера отправителя изменится: 1. будет определен МАС адрес не компьютера назначения, а маршрутизатора; 2. с помощью протоколов канального и физического уровня по этому МАС адресу на маршрутизатор будет послана нужная информация. Дальнейшая судьба IP пакета зависит от правильной настройки маршрутизаторов, объединя ющих сети 192. 168. 5. 0 и 192. 168. 10. 0. важна правильная настройка маски подсети в параметрах IP адресации!!!!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-24.jpg" alt = "(! LANG:> Ways to configure IP parameters and health check 1. assign manually (easy make a mistake when"> Способами настройки параметров IP и проверка работоспособности 1. назначить вручную (легко ошибиться, при изменении надо перенастраивать, сетевые администраторы полностью контролируют все IP адреса, невозможно работать в крупных корпоративных сетях с мобильными устройствами типа ноутбуков или КПК, которые часто перемещаются из одного сегмента сети в другой) 2. автоматическое получение IP адреса. Специальные серверы, поддерживающие протокол динамической конфигурации узлов (Dynamic Host Con iguration Protocol, DHCP), задача которых состоит f в обслуживании запросов клиентов на получение IP адреса и другой информации, необходимой для правильной работы в сети. Если сервер DHCP недоступен (отсутствует или не работает), то начиная с версии Windows 98 компьютеры самостоятельно назначают себе IP адрес. При этом используется механизм автоматической личной IP адресации (Automatic Private IP Addressing, АРIPA), для которого корпорацией Microsoft в IANA был зарегистрирован диапазон адресов 169. 254. 0. 0 - 169. 254. 255.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-25.jpg" alt = "(! LANG:> Verify IP 1. IPCONFIG / ALL. 2 . PING 127."> Проверка параметров и работоспособности протокола IP 1. IPCONFIG /ALL. 2. PING 127. 0. 0. 1 3. PING w. x. y. z, где w. x. y. z - IP адрес соседнего компьютера. 4. PING w. x. y. z, где w. x. y. z - IP адрес основного шлюза. 5. PING w. x. y. z, гдеw. x. y. z - IP адрес любого удаленного компьютера.!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-26.jpg" alt = "(! LANG:> Questions 1. What parameters and settings are required for the TCP protocol stack to work / IP? 2."> Вопросы 1. Какие параметры и настройки обязательны дляобеспечения работы стека протоколов TCP/IP? 2. Что такое IP адрес? Какова его структура? Какиевозможны способы представления IP адресов? 3. Чем отличаются версии 4 и 6 протокола IP? Какие преимущества обеспечит версия 6 протокола IP? Почему возникла необходимость в переходе на версию 6 протокола IP? 4. Что такое маска подсети? Для чего она нужна? 5. В чем заключается смысл разделения IP адреса на идентификаторы сети и узла? Для чего это требуется? 6. Какие IP адреса и маски являются допустимыми, а какие - нет? Почему? 7. В чем различие между классовой и бесклассовой IP адресациями? Каковы их преимущества и недостатки?!}

Src = "https://present5.com/presentation/3/159928527_437552731.pdf-img/159928527_437552731.pdf-27.jpg" alt = "(! LANG:> Questions 1. What are IP address classes? What rules are they are determined by? 2."> Вопросы 1. Что такое классы IP адресов? По каким правилам они определяются? 2. Как назначить IP адреса в локальной сети (без выхода в Интернет)? 3. Каковы основные принципы маршрутизации пакетов в локальных и удаленных сетях? 4. Что такое таблица маршрутов (таблица маршрутизации)? Объясните смысл каждой из ее колонок. 5. Как «прописать» в таблице маршрутизации отсутствующий в ней новый маршрут? 6. Что такое динамическая конфигурация узлов? Для чего она нужна? 7. В чем заключается технология автоматической личной IP адресации? 8. Каков типовой алгоритм проверки работоспособности протокола IP?!}

Protocol RIP (Routing Information Protocol) is one of the oldest protocols for exchanging routing information, but it is still extremely common in computer networks. In addition to the RIP version for TCP / IP networks, there is also a version of RIP for IPX / SPX networks from Novell.

In this protocol, all networks have numbers (the way the numbers are formed depends on the network layer protocol used in the network), and all routers have identifiers. RIP makes extensive use of the concept of distance vector. The distance vector is a set of pairs of numbers that are the numbers of the networks and the distances to them in hops.

Distance vectors are iteratively propagated by routers over the network, and after a few steps each router has information about the networks reachable for it and about the distances to them. If the connection with any network is interrupted, the router marks this fact by assigning the maximum possible value to the vector element corresponding to the distance to this network, which has a special meaning - "no connection". This value in the RIP protocol is the number 16.

Figure 8.1 shows an example of a network made up of six routers with IDs 1 through 6 and six networks A through F with point-to-point direct links.

Rice. 8.1. Routing Information Exchange via RIP

The figure shows the initial information contained in the topological base of router 2, as well as information in the same base after two iterations of the exchange of RIP routing packets. After a certain number of iterations, Router 2 will know about the distances to all networks on the Internet, and it may have several alternative options for sending the packet to the destination network. In our example, suppose the destination network is network D.

When it needs to send a packet to network D, Router looks at its route database and selects the port that has the shortest distance to the destination network (in this case, the port that connects it to Router 3).

To adapt to changes in the state of communications and equipment, a timer is associated with each entry in the routing table. If during the timeout a new message confirming this route is not received, then it is removed from the routing table.

When using the RIP protocol, the Bellman-Ford dynamic programming heuristic algorithm works, and the solution found with its help is not optimal, but close to optimal. The advantage of the RIP protocol is its computational simplicity, and the disadvantages are the increase in traffic during the periodic sending of broadcast packets and the suboptimality of the route found.

Figure 8.2 shows the case of unstable network operation via RIP when the configuration is changed - the link between router M1 and network 1 fails. When this link is healthy, the route table of each router contains an entry about network number 1 and the corresponding distance to it.

Rice. 8.2. An example of an unstable network when using RIP

When the connection to network 1 is broken, router M1 notes that the distance to this network has become 16. However, after a while, after receiving a route message from router M2 that the distance from it to network 1 is 2 hops, router M1 increases this distance by 1 and notes that network 1 is reachable through router 2. As a result, a packet destined for network 1 will circulate between routers M1 and M2 until the storage time of the record about network 1 in router 2 expires, and it does not transmit this information router M1.

To avoid such situations, routing information about the network known to the router is not transmitted to the router from which it came.

There are other, more complex cases of unstable behavior of networks using the RIP protocol, when changes in the state of links or network routers.