Parameter name Meaning
Article topic: Introduction to IP Routing
Rubric (thematic category) Computers

It’s worth saying that first let’s clarify some concepts:

  • network node (node) - any network device with TCP/IP protocol;
  • host (host) - a network node that does not have packet routing capabilities;
  • router - a network node with packet routing capabilities

IP routing is a forwarding process unicast-traffic from the sending node to the recipient node in an IP network with an arbitrary topology.

When one node on an IP network sends a packet to another node, the IP packet header contains the IP address of the sending node and the IP address of the receiving node. The packet is sent as follows:

  1. The sending node determines whether the receiving node is on the same IP network as the sender (local network) or on a different IP network (remote network). To do this, the sending node performs a bitwise logical multiplication of its IP address by its subnet mask, then a bitwise logical multiplication of the IP address of the recipient node also by its subnet mask. If the results match, it means that both nodes are on the same subnet. If the results are different, then the nodes are in different subnets.
  2. If both network nodes are located on the same IP network, the sending node first checks the ARP cache for the presence of the recipient node's MAC address in the ARP table. If the required entry is available in the table, then the packets are then sent directly to the recipient node at the link level. If the ARP table does not contain the required entry, the sending node sends an ARP request for the IP address of the recipient host, the response is placed in the ARP table and after that the packet is also transmitted at the data link level (between network adapters of computers).
  3. If the sending node and the receiving node are located in different IP networks, then the sending node sends this packet to the network node, which is specified in the sender’s configuration as the “Main Gateway” ( default gateway). The main gateway is always located on the same IP network as the sending node, and therefore interaction occurs at the data link level (after an ARP request is completed). The default gateway is the router that is responsible for sending packets to other subnets (either directly or through other routers).

Consider the example shown in rice. 4.5.

Rice. 4.5.

IN in this example 2 subnets: 192.168.0.0/24 and 192.168.1.0/24. The subnets are combined into one network by the router. The router interface in the first subnet has an IP address of 192.168.0.1, in the second subnet - 192.168.1.1. The first subnet has 2 nodes: node A (192.168.0.5) and node B (192.168.0.7). The second subnet has host C with the IP address 192.168.1.10.

If node A sends a packet to node B, it will first calculate that node B is in the same subnet as node A (ᴛ.ᴇ. in the local subnet), then node A will perform an ARP request for the IP address 192.168.0.7. After this, the contents of the IP packet will be transferred to the data link layer, and the information will be transferred from the network adapter of host A to the network adapter of host B. This is an example of direct data delivery (or direct routing, direct delivery).

If node A sends a packet to node C, it will first calculate that node C is in a different subnet (ᴛ.ᴇ. in a remote subnet). Host A will then send the packet to the host that is specified in its configuration as the default gateway (in this case, the router interface with IP address 192.168.0.1). Next, the router from interface 192.168.1.1 will perform direct delivery to host C. This is an example of indirect delivery (or indirect delivery) of a packet from host A to host C. In this case, the indirect routing process consists of two direct routing operations.

In general, the IP routing process is a series of individual operations that directly or indirectly route packets.

Each network node makes a decision about packet routing based on the routing table, which is stored in random access memory of this node. Routing tables exist not only for routers with multiple interfaces, but also for workstations connected to the network via a network adapter.
Posted on ref.rf
The routing table in Windows can be viewed using the route print command. Each routing table contains a set of entries. Records can be generated different ways:

  • records created automatically by the system based on the TCP/IP protocol configuration on each network adapter;
  • static entries created by the route add command or in the service console Routing and Remote Access Service ;
  • dynamic entries created by different routing protocols (RIP or OSPF).

Let's consider two examples: the routing table of a typical workstation located on a company's local network, and the routing table of a server that has several network interfaces.

Work station.

In this example, there is a workstation with Windows system XP, with one network adapter and the following TCP/IP protocol settings: IP address -192.168.1.10, subnet mask - 255.255.255.0, default gateway - 192.168.1.1.

Let's enter in command line systems Windows command route print, the result of the command will be the following screen ( rice. 4.6; The text for the English version of the system is given in brackets):

Rice. 4.6.

List of interfaces- a list of network adapters installed on the computer. Interface MS TCP Loopback interface is always present and is intended to turn the node to itself. Interface Realtek RTL8139 Family PCI Fast Ethernet NIC- LAN card.

Network address- the range of IP addresses that are reachable using this route.

Network mask- subnet mask to which the packet is sent using this route.

Gateway address- IP address of the node to which packets corresponding to this route are forwarded.

Interface- network interface designation of this computer, to which packets corresponding to the route are forwarded.

Metrics- conditional cost of the route. If there are several routes for the same network, then the route with the minimum cost is selected. Typically, the metric is the number of routers a packet must go through to get to the desired network.

Let's analyze some rows of the table.

The first row of the table corresponds to the default gateway value in the TCP/IP configuration of this station. The network with address "0.0.0.0" denotes "all other networks that do not match other rows in this routing table."

The second line is the route for sending packets from the node to itself.

The third line (network 192.168.1.0 with mask 255.255.255.0) is the route for sending packets on the local IP network (ᴛ.ᴇ. the network in which this workstation is located).

The last line is the broadcast address for all nodes on the local IP network.

Last line on rice. 4.6- list of permanent workstation routes. These are static routes that are created with the route add command. In this example there is no such static route.

Now consider a server running Windows 2003 Server, with three network adapters:

  • Adapter 1 - located in the company’s internal network (IP address - 192.168.1.10, subnet mask - 255.255.255.0);
  • Adapter 2 - located in the external network of the Internet provider ISP-1 (IP address - 213.10.11.2, subnet mask - 255.255.255.248, closest interface in the provider's network - 213.10.11.1);
  • Adapter 3 - located in the external network of the Internet provider ISP-2 (IP address - 217.1.1.34, subnet mask - 255.255.255.248, closest interface in the provider's network - 217.1.1.33).

IP networks of providers are conditional, IP addresses are chosen for illustration purposes only (although a coincidence with any existing network is quite possible).

At the same time, the Routing Service is installed on the server and remote access For routing control packets between IP networks and access to the company network through a modem pool.

In this case, the route print command will produce the routing table shown in rice. 4.7.

Rice. 4.7.

The table shows three interfaces in the list network adapter different models, adapter feedback(MS TCP Loopback interface) And WAN (PPP/SLIP) Interface- interface for accessing the network via a modem pool.

Let us note the features of the route table of a server with several network interfaces.

The first row is similar to the first row in the workstation table. It also corresponds to the default gateway value in the TCP/IP configuration of this station. Note that you can set the "Default Gateway" parameter on only one interface. In this case, this parameter was set on one of external interfaces(the same value is reflected at the end of the table in the line “Main gateway”).

Like a workstation, each interface has routes for both unicast-packets, and for broadcast (broadcast) for each subnet.

The second line contains the static route configured in the console , to forward packets to the network196.15.20.16/24.

Support for routing tables.

There are two ways to maintain the current state of routing tables: manual and automatic.

The manual method is suitable for small networks. In this case, static entries for routes are manually entered into the routing tables. Entries are created either with the route add command or in the console Routing and Remote Access Services.

In large networks manual method becomes too labor-intensive and prone to errors. Automatic construction and modification of routing tables is carried out by the so-called "dynamic routers". Dynamic routers monitor changes in the network topology, make necessary changes to the routing tables, and exchange this information with other routers running the same routing protocols. IN Windows Server implemented dynamic routing in Routing and Remote Access Service. This service implements the most common routing protocols - RIP versions 1 and 2 and OSPF.

Introduction to IP routing - concept and types. Classification and features of the category "Introduction to IP Routing" 2017, 2018.

Routing refers to the process of delivering a message from one subnet to another. Let us now consider the principles on the basis of which in IP networks the route for transmitting a packet between networks is selected.

First, you need to pay attention to the fact that not only routers, but also end nodes - computers - must take part in choosing a route. The example shown in the figure demonstrates this need. Here, there are several routers on the local network, and the computer must choose which one to send the packet to.

The length of the route can change significantly depending on which router the computer chooses to forward its packet to a server located in Germany, for example, if Router 1 is connected by a leased line to a router in Copenhagen, and Router 2 has satellite channel, connecting it to Tokyo.

In the TCP/IP stack, routers and end nodes make decisions about who to pass a packet to in order to successfully deliver it to the destination node, based on so-called routing tables. The following table is a typical example of a route table using network IP addresses:

Destination network address Next router address Output port number Distance to destination network
56.0.0.0 198.21.17.7
56.0.0.0 213.34.12.4.
116.0.0.0 213.34.12.4
129.13.0.0 198.21.17.6
198.21.17.0 -
213. 34.12.0 -
Default 198.21.17.7 -

In this table, the "Destination Network Address" column indicates the addresses of all networks to which this router can transmit packets. The TCP/IP stack adopts the so-called one-hop approach to optimizing the packet forwarding route (next-hop routing) - each router and end node takes part in choosing only one packet transmission step. Therefore, each line of the routing table does not indicate the entire route as a sequence of IP addresses of the 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, responsibility for choosing is transferred to the next router next step routing The one-hop approach to routing means a distributed solution to the route selection problem. This removes the restriction on the maximum number of transit routers along the packet's path.

If there is more than one row in the route table corresponding to the same destination network address, then when deciding whether to transmit a packet, the row that contains the smallest value in the “Distance to destination network” field is used.

In this case, distance is understood as any metric used in accordance with the class of service specified in the network packet. This may be the number of transit routers in a given route (the number of hops from a hop), the time it takes for a packet to travel along communication lines, the reliability of communication lines, or another value that reflects the quality of a given route in relation to a specific class of service. If a router supports several classes of packet service, then a route table is compiled and applied separately for each type of service (route selection criteria).

To forward a packet to the next router, knowledge of its local address is required, but in the TCP/IP stack it is common practice to use only IP addresses in routing tables to store them universal format, independent of the type of networks included in the Internet. To find a local address from a known IP address, you must use the ARP protocol.

The end node, like the router, has at its disposal a route table of a unified format and, based on its data, makes a decision which router needs to transmit the packet for network N. The computer makes the decision that this packet needs to be routed at all when he sees that the destination network address of the packet differs from the address of his own network (when configuring each computer, the administrator assigns its IP address or several IP addresses if the computer is simultaneously connected to several networks). When the computer selects the next router, it looks through its ARP address cache table and perhaps finds a match between the next router's IP address and its MAC address. If not, an ARP request is broadcast over the local network and the local address is extracted from the ARP response.

The computer then generates a frame for the protocol used on the selected port, for example, Ethernet frame, which contains the router's MAC address. The router receives the Ethernet frame, extracts the IP packet from it, and looks up its routing table to find the next router. In doing so, it performs the same actions as the end node.

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

End nodes are especially likely to use the default routing technique. Although they also generally have a routing table at their disposal, its size is usually insignificant, since routing is not the main activity for the computer. the main role packet routing in the IP protocol concept is naturally assigned to routers, which must have much more complete routing tables than end nodes. The end node often operates without a routing table at all, having only knowledge of the default router's IP address. If there is one router on the local network, this option is the only one possible for all end nodes. But even if there are several routers on the local network, when the problem of choosing them is faced by the end node, setting a default route is often used in computers to reduce the size of their routing table.

Another way to relieve your computer of the burden of maintaining large routing tables is to obtain information from the router about a reasonable route for a specific network using the ICMP protocol.

In addition to the default route, there may be two types of special entries in the routing table - an entry about a host-specific route and an entry about the addresses of networks directly connected to the router ports.

A host-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 host number field. It is assumed that for such an end node the route should be chosen differently from all other nodes in the network to which it belongs. In the case when the table contains different records about the progress of packets for the entire network N and its individual node, which has address N,D, upon arrival of a packet addressed to node N,D, the router will give preference to the entry for N,D.

Entries in the routing table for networks directly connected to the router contain zeros in the Distance to Destination Network field.

Another difference between how a router and an end node work when choosing a route is the way the routing table is built. If routers usually automatically create routing tables by exchanging service information, then for end nodes routing tables are created, as a rule, manually by administrators and stored as permanent files on disks.

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

  • fixed routing algorithms,
  • simple routing algorithms,
  • adaptive routing algorithms.

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

The packet includes a “time to live” field, which occupies 1 byte and specifies the time limit during which the packet can travel through the network. The lifetime of this packet is measured in seconds and is set by the transmission source using the IP protocol. At gateways and other network nodes, after each second, one is subtracted from the current lifetime; one is also subtracted for each transit transmission (even if a second has not passed). When the lifetime expires, the package is canceled.

Routing in TCP/IP networks has 2 meanings:

    Search procedure network address in a special table for transmitting the packet to the destination node.

    The process of constructing such a table

Routing exists as IP packet forwarding and routing exists as routing table management.

Hosts only send packets to gateways that are physically connected to the same network.

Local hosts can only move packets 1 hop towards the destination host.

Each gateway through which a packet passes makes a decision about its movement by analyzing its own routing table.

Routing tables are maintained in static, dynamic and combined ways.

A static route is fixed in the routing table and does not change during the entire operation of the host. A static route is used on a relatively stable local network. It is easy to manage and reliable to use, but requires staff to know the network topology at the time the routing table is created.

In networks with more complex topologies, when additional gateways appear, when additional communication channels between hosts appear, the throughput between channels is high.

In the case of dynamic routing, a special process (daemon) is constantly running on the corresponding gateways. The process maintains and modifies the routing table. In addition, it constantly interacts with other daemon processes of other gateways in order to determine the network topology and make decisions about delivering packets to the gateway hosts.

Combined Routing. For simple routers - static routing, for complex ones - dynamic routing.

There are 4 levels of complexity that characterize the process of managing routing in a network:

    Level 0. No routing as such

    Static routing only

    Primarily static routing with periodic route updates that modify static routing tables (done using RIP)

    Dynamic routing

Fixed routing

is one of the dynamic routing methods and is used in networks with a simple communication topology. Fixed routing has single-path tables in which there is one path for each destination. in multipath tables for each destination there are several alternative paths and there must be a path selection rule.

Simple routing algorithm

    Random routing, where packets are forwarded in any random (one) direction other than the original direction.

    Flood routing - packets are transmitted in all directions except the original one

    Routing based on previous experience. This dynamic routing method works based on the packets that pass through that route.

Adaptive Routing

Based on??????????7

The main type of routing algorithms is used in modern networks with complex topologies. Algorithms of this type are based on periodic exchange of information about networks available on the Internet. And also about connections between routers. In addition, the algorithms take into account not only the communication topology of the gateways, but also the performance and state of these connections. Adaptive routing algorithms include:

    Distance vector algorithms

    Link state algorithms

Distance vector algorithms

Each router transmits and broadcasts over the network a vector of distances from itself to all networks known to it. Distance here refers to the number of routes a packet must go through before it reaches the corresponding network. Having received such a vector, another router adds its information about the networks known to it and also sends this vector to everyone else.

The second algorithm is associated with providing each router with information on the basis of which an accurate graph of the network state is constructed. All routers operate based on the same graphs.

Switching in networks

In the process of development of network computer technologies, 3 main methods emerged:

1. Circuit switching

2. Message switching

3. Packet switching

Circuit switching implies the formation of a composite physical channel from sequentially connected individual sections for data transmission between nodes. Individual channels are connected to each other by special equipment (switches), which can establish connections between any end nodes of the network. In a circuit-switched network, it is always necessary to perform a connection setup procedure before transmitting data and, in the process, create a composite (switched) circuit.

Message switching

When using this method, equipment (called switches and made on the basis of universal PCs) allows you to accumulate (buffer) messages and send them in accordance with a given priority system and routing principles to other network nodes.

Packet switching

It is carried out by dividing the message into packets, i.e. message elements equipped with a header and having a fixed maximum length, and subsequent transmission of packets along a route determined by network nodes.

Packet switching computer networks- This is the main method of data transfer.

The predominance of packet switching as the main method in the implementation of computer networks is due to the following circumstances:

    Packet switching results in low delays in data transmission.

    Unlike channel switching, which requires that all communication lines from which the channel is formed have the same throughput. Message and packet switching methods allow data to be transmitted over communication lines with any bandwidth.

    Presenting data in packets creates conditions for multiplexing data streams (dividing the channel operating time for simultaneous multiple data streams).

    The short length of data packets makes it possible to allocate transmitted data for intermediate storage (buffering) smaller capacity memory.

Packet switching methods

In packet switching, transmitted messages are broken up into smaller pieces called packets, each of which has a specified maximum length. Packets are supplied with service information necessary for packet delivery and transmitted. Each package is supplied with the following information:

    Packet start and end code;

    Sender and recipient addresses;

    Number of message packages;

    Information for reliability control at intermediate nodes and at the destination node.

Typically, many packets of the same message are transmitted simultaneously. The receiver, in accordance with the packet headers, assembles the packets into the original message and sends an acknowledgment to the recipient. In the process of transmitting packets across network nodes, due to the fact that packets in intermediate nodes do not accumulate entirely in the form of messages (hardware requirements for intermediate nodes).

The hardware requirements for intermediate nodes are dramatically reduced. If the RAM is full, switches use various mechanisms to delay transmitted packets at the places where they are generated.

Packet switching imposes 2 conflicting requirements:

    Reducing packet latency in the network due to the short packet length;

    Increasing the efficiency of information transmission by increasing the packet length.

To solve these problems, the maximum packet size is set based on 3 factors:

    Packet length distribution;

    Characteristics of the transmission medium

    Transfer cost.

The process of data transmission in a packet switching network is represented as the following sequence of operations:

    The message entered into the network is divided into packets containing the address of a specific point of the recipient node, in the intermediate node the packet is stored in RAM and the address of this packet is used to determine the transmission line channel over which the packet must be transmitted.

    If this communication channel is free (not busy transmitting other packets), then the packet is immediately transmitted to the corresponding node.

    If that node is also an intermediate node, then the same operation is also repeated there.

    If the communication channel with a neighboring node is busy, then the packet may be stored in the switch RAM for some time until the channel is released.

    Stored packets are queued in the direction of transmission. As a rule, the queue length does not exceed 3-4 packets; if the queue length is exceeded, the packets are erased.

There are 2 packet switching methods:

    Datagram.

    Method of virtual connections.

The term datagram is used to describe a self-contained packet that travels across a network independently of other packets. That is, packets can be delivered to the recipient via different routes. Routes, in turn, are determined by the current dynamic situation in the network at the current moment. Having received the datagram, the switching node forwards it towards the next node, getting as close as possible to the recipient. When an adjacent node confirms receipt of the packet, the switching node erases it from its memory; if confirmation is not received, the switching node sends the packet to another adjacent node and so on until the packet is delivered with an acknowledgment.

All nodes surrounding the switching node are ranked according to their proximity to the switch. First, the packet is sent to nodes of the first rank, if unsuccessful, to nodes of the second rank, etc.

The procedure for distributing packets is called a routing algorithm. There are algorithms when adjacent nodes to which the packet will be sent are selected randomly. Accordingly, each datagram travels along a random route.

Virtual method - this method involves establishing a transmission route for the entire message from the sender to the recipient using a special request packet service. For such a message, a route is allocated, which, if the recipient agrees to the connection, is assigned for the passage of the entire set of packets.

When implementing this method, a special service packet called a call request is first sent.

This packet, as it were, lays out the entire route along which all packets related to this call will go.

The method is called virtual because in this case the real physical path is not switched, but a logical connection is established between the sender and the recipient, i.e. a virtual imaginary path is simulated.

The advantage of the virtual method over the datagram is the ordering of the packages. The disadvantage is that as soon as something happens to the intermediate node, the message is not delivered.

IP routing

IP Routing– the process of selecting a path for transmitting a packet in a network. A path (route) is a sequence of routers through which a packet passes on its way to the destination node. An IP router is a special device designed to connect networks and determine the path of packets in a composite network. The router must have several IP addresses with network numbers corresponding to the numbers of the networks being connected.

Connecting networks using an IP router

Routing is carried out at the sending node at the time the IP packet is sent, and then at IP routers.

The principle of routing at the sending node looks quite simple. When you need to send a packet to a node with a specific IP address, the sending node uses a subnet mask to select network numbers from its own IP address and the recipient's IP address. Next, the network numbers are compared and if they match, the packet is sent directly to the recipient, otherwise - to the router whose address is specified in the IP protocol settings.

Path selection on the router is based on the information provided in routing table. A routing table is a special table that maps IP addresses of networks to the addresses of the following routers to which packets should be sent in order to deliver them to these networks. A required entry in the routing table is the so-called default route, containing information about how to route packets to networks whose addresses are not present in the table, so there is no need to describe the routes for all networks in the table. Routing tables can be built “manually” by the administrator or dynamically, based on the exchange of information carried out by routers using special protocols.

Routing process network layer, defining the best way delivery of the information package to the recipient. The paths for transmitting information packets are called routes. The best identified routes to "familiar" recipients are recorded and stored in the routing table.

There are two types of routing:

  • Static routing
  • Dynamic routing

The division occurs depending on the method of entry into the routing table.

Routing is carried out by special devices - routers or regular computers with multiple network cards.

Routing in connectionless service-based networks

We will consider the routing process using a conditional example.

According to the example, Host 1 needs to transmit a message to Host 2 (Fig. 1).

In this case, the length of the message is 4 times longer than what is allowed for transmission. Because of this, the message must be split into 4 parts (packets) and sent sequentially to router A.

Router A is connected only to Routers B and C. Accordingly, all packets from Host A can only be transmitted to Routers B and C.

All possible paths of information packets are recorded in the internal routing table. Entries in the routing table correspond to actual connections.

So, 4 packets need to be transmitted through router A. According to the routing table valid for this moment time, packets 1-3 are transmitted to router C. Then, according to the routing table of router C, the packets are transmitted to E - router, which is connected directly to hosting B. All packets 1-3 are delivered.

At the next moment in time, the routing table on router A changed, suppose due to a “traffic jam” in the area paths A-C-E. According to the new routing table, Router A forwards packet 4 along the path A-B-D routing, then E and to Khost B.

I note that routing tables are designed according to routing algorithms.

This example was for networks with an unestablished connection. How is routing carried out when a connection is already established?

Routing in Connection-Based Services Networks

In connection-oriented networks, all information packets are transmitted along a single route. This is ensured by establishing a reliable virtual channel for the entire communication session.

The task is to transfer information from Host 1 to Host 2.