📜 ⬆️ ⬇️

Network for the smallest. Micro issue №5. Networking FAQ

While the whole world is waiting for the 11th edition of the SDSM devoted to MPLS BGP L3VPN, I decided to make a free translation of a good article by Jeremy Stretch from Packetlife.net.

This is a selection of small FAQ for beginners.

# At what level of OSI does the H protocol work?
# What is the difference between a router and a multi-layer switch?
# What is the difference between forwarding and control planes?
# What is the difference between MTU and MSS?
# What is the difference between VLAN and BVI interfaces?
# How does the tunnel interface work?
What are the four types of addresses in NAT?
# Can I use the network address and the broadcast address in the NAT pool?
# Why do we need IP addresses? Isn't there enough MAC addressing for everything?
# Does QoS allow for increased bandwidth?

# At what level of OSI does the H protocol work?


The first thing that anyone who studies networks faces is the Open Systems Interconnection OSI model. This is a seven-level reference model, officially defined in IOS / IEC 7498-1. You will find it in any educational literature that has ever been published. It is quite common to refer to OSI when discussing the interaction between protocols. For example, TCP is a protocol of the fourth level, and it sits on the neck of an IP - protocol of the third level.
')
But what does this really mean? Who decides what level the protocol belongs to? The OSI model was conceived back in the 70s, as part of the OSI protocol family, which quite seriously positioned itself as an opponent to the TCP / IP stack (spoiler: TCP / IP did win). If you exclude a handful of survivors (surely, you heard about the IS-IS dynamic routing protocol), then OSI protocols are in fact not being used. However, the OSI reference model, which describes how they were supposed to interact, is more alive than all living things. Which, however, makes us tie the protocols of one family to the levels defined for another.

For the most part, everything works fine: TCP and UDP ride astride IP, which in turn travels on Ethernet, PPP or whatever. But a forty-year-old model cannot always satisfy the needs of modern protocols. Take for example MPLS . It is often referred to as level 2.5, because it works on top of the channel, but lower than the network level, without doing frame building or end-to-end addressing (unlike IP addresses, MPLS labels change on each node as the packet moves to destination). Of course, adding a new level between the other two destroys the standard model.

Strictly speaking, no protocol from the TCP / IP stack is officially assigned to any OSI layer for the very reason that these are different families. Apples and oranges. The reference model is a reference ( Note: the Russian name still doesn’t slightly correspond to the Reference Model, the reference assumes its ideality and the desire to conform to it ). OSI helps illustrate the dependence of some protocols on others, and who drives whom, but it cannot dictate how they function.

But if someone asks, answer that MPLS is a third-level protocol.


# What is the difference between a router and a multi-layer switch?


In ancient times, routers served to transmit packets based on IP addresses and provided a wide range of interfaces: Ethernet, E1, Serial, OC-3, and so on. At the same time, the switch sent packets (frames, note for the league of nerds), based on MAC addresses, and had only Ethernet ports.

But in the early 2000s, our clear understanding of this difference came to an end - two important trends emerged. First, multi-layer switches appeared, which not only gained the right to transmit packets based on IP addresses, but also participate in dynamic routing protocols, like real routers. Secondly, operators have begun an irreversible migration process from circuit-switched technologies to modern Ethernet, providing high speeds for a low fee. Today, it is perfectly in the order of things if the router has only Ethernet interfaces, as if it were a switch.

Where is the boundary between the router and the multi-layer switch? Does this boundary still exist?
The actual difference between the two comes down to the following several points:


Be that as it may, the modern world is based on equipment made for specific needs. However, if you look into tomorrow with virtual eplinses, NFV and SDN, we come to the conclusion that the same box can perform completely different roles depending on its position in the network.


# What is the difference between forwarding and control planes?


For beginners, this is undoubtedly a source of confusion.

Forwarding plane is often called Data Plane, and in Russian the most successful option is the switching plane. Its task is to deliver a packet from point A to point B. The switching plane commutes .

The Control plane - the control plane - serves the functions prescribing how the switching plane should work. The control plane controls .

For example, you have a router with OSPF. It communicates routing information with neighboring OSPF routers, compiles a graph of the entire network, and calculates routes. When the routing table (RIB) is built, the router installs the best route to each known destination point in the switching table (FIB). These are functions of the control plane.

When the same router receives an IP packet, it searches for the destination address in its switch table to determine the interface to which the packet needs to be sent. Next, the packet is transferred to the output interface buffer and then to the cable. This is the function of the forwarding plane.

Feel the difference? The switching plane is responsible for receiving and transmitting packets, while the control plane is responsible for how the decision to transmit the packet is made.

The switching plane is implemented, as a rule, in hardware, in other words, performed by special chipsets (for example, the Network Processor accesses the TCAM to quickly extract the output interface from the FIB), without requiring access to the CPU.

The control plane also works on the CPU and in conventional memory, which is very similar to the work of a personal computer. The point is that the management level performs very complex functions that, on the one hand, are not needed in real time, but on the other hand, they are problematic to implement in hardware. For example, a delay of a few milliseconds is completely unimportant when the router installs a route to a switching table, while for a switching level this can be a serious degradation of performance.


# What is the difference between MTU and MSS?


Maximum transmission unit (MTU) says the maximum amount of data that can carry one package. We usually talk about MTU for Etherner (although other protocols, of course, also have their own MTU). The default MTU on most platforms is 1500 bytes. This means that a node can transmit a frame carrying 1500 bytes of payload. This does not include 14 bytes of the Ethernet header (18 in the case of 802.1q) and 4 bytes of the FSC field. The total frame size is 1518 bytes (1522 in the case of 802.1q). Many nodes now support jumbo frames (jumbo), for this the standard MTU is increased to 9000+ bytes.

Maximum segment size (MSS) is a characteristic value for TCP that shows the maximum TCP payload in the packet, in fact, this is the MTU for TCP. TCP MSS is calculated based on the Ethernet MTU value (or maybe not Ethernet) on the interface. Since TCP must fit into the Ethernet frame, the MSS must be smaller than the MTU. Ideally, the MSS should be as high as possible: MTU-size header IP-size TCP header.

Suppose MTU is 1500 bytes, subtract 20 bytes of IPv4 address and 20 bytes of TCP from it and get MSS of 1460 bytes. IPv6 with its extended header will leave only 1,440 bytes for the MSS.

TCP MSS is determined once during the connection. Each node includes its MSS in the TCP option in the first packet (the one with the SYN flag), and both nodes choose the smallest value of the two as an MSS session. Once established, the MSS does not change during the life of the session.


# What is the difference between VLAN and BVI interfaces?


A VLAN interface , also known as SVI (Switch Virtual Interface) or RVI (Routed VLAN Interface), is a virtual interface on a multi-layer switch. It provides routing and often serves as the default gateway for the local network segment. The VLAN interface usually behaves and is configured as a physical interface of the router: you can assign an IP to it, it participates in VRRP, it can have an ACL, and so on. You can imagine that this is a physical interface inside the switch, but you can, on the contrary, imagine that this is a routing interface outside the switch on which this VLAN is terminated.

Bridge group Virtual Interface (BVI) serves similar purposes, but exists on a router that does not have a VLAN concept, because all its ports usually work on L3 ( Note: translator: the router concept may well be present on routers ). The bridge group forces two or more ports to operate on L2, dividing the broadcast domain between them. BVI connects the interfaces in the Bridge Group and serves as a virtual L3 interface for all segments connected to it. When the router runs simultaneously on L2 and L3, it is called Integrated Routing and Bridging (IRB).

While the VLAN interface is a vital need for a multi-layer switch, IRB is a niche thing that can be used, for example, on WiFi access points.


# How does the tunnel interface work?


Many people have difficulty understanding the concept of tunnel interfaces ( Approx. Translator: really? ). Tunneling is simply the encapsulation of some packets inwards while passing between two points. The tunnel interface is used to achieve this encapsulation for routable VPNs, which allow you to protect yourself and abstract away from the underlying network topology. There are many encapsulation methods, including IPSec, GRE, MPLS, and so on.

Although the tunnel interface is of a virtual nature, it behaves like any other when it comes to routing, with the only difference being that when a packet goes through the tunnel interface, it is packaged into a new packet, for which it is again decided to routing. A new pregnant package is sent on Wednesday and eventually reaches the destination point. At the other end of the tunnel, the outer headers are removed, and the original packet comes out, above which the routing decision is made again.


What are the four types of addresses in NAT?


There are four classes of IP addresses in the context of NAT:

Unfortunately, these terms are rarely explained in documentation.
Each of them describes two attributes: location ( location ) and point of view ( perspective ).
Location reports which node is in question. Inside the network (before NAT) - Inside; in the external network (after NAT) - Outside.
The view tells us where we are looking at this node. From within our network - Local; from the external network - Global.

Take, for example, the case when you want to log in via telnet to the Internet address 94.142.241.111 from a computer with a private address 192.168.0.10. From the NAT pool, you are allocated the IP address 192.0.2.10.
This is how the translation table will look like:

R2# show ip nat translations Pro Inside global Inside local Outside local Outside global tcp 192.0.2.10:32978 192.168.0.10:32978 94.142.241.111:23 94.142.241.111:23 

Let's figure it out?

Inside Global - how the internal node looks from the outside. A server on the Internet really sees the address from your NAT pool.
Inside Local - how the internal address looks from the inside - the private address of the computer
Outside Local - how the external address looks like inside - we see its public address and port 23.
Outside Global - there should be what the external address looks like from the outside, but your NAT does not know such broadcasts, so the address is the same as Outside Local.


# Can I use the network address and the broadcast address in the NAT pool?


Yes.

First, in the context of the NAT pool, there are no concepts of a mask for the network address and the broadcast address.
Next approx. translator.

Secondly, the network address and the broadcast address are determined by the subnet mask - without it, they lose their meaning. Therefore, whether the address is 192.168.0.255 as a broadcast address, and 192.168.1.0 the network address depends entirely on the mask: for / 23 the answer is no, for / 24 or more the answer is yes, and for / 32 again it does not.

Therefore, you can not only specify the address 192.168.0.255 in the pool, but even configure it on the interface with the / 23 mask.



# Why do we need IP addresses? Isn't there enough MAC addressing for everything?


When a novice begins learning MAC addresses, he sees that they must be unique globally. And a natural question arises, why not use MAC addresses for end-to-end addressing across the entire Internet, without resorting to IP at all? However, there are several good reasons for attracting IP.

First, not all networks are MAC-addressed. In general, this type is peculiar only to the family 802. It is very easy to forget about it in a world where almost everything is Ethernet or its variations (for example, IEEE 802.11 WiFi). But during the youth of Ethernet a few decades ago, lawlessness abounded in the field of protocols: Token Ring, Ethernet, Frame Relay, ATM fought for a place in the router. And to ensure the interaction of nodes from Token Ring with nodes from ATMs via MAC addresses was problematic - a network layer protocol was needed.

Secondly, IP addresses are mobile - they can be assigned by administrators or even issued automatically, while MAC addresses are sewn into the network adapter for all eternity. Technically, the MAC address, of course, can also be changed, but this was not intended initially and now there are no means for convenient management of them.

But the main reason is the third - IP is scalable and can connect huge networks, and Ethernet is the lot of small segments. The IP address space is hierarchical, the MAC address is flat. 254 nodes of one local network can be aggregated into one / 24 subnet. 8 subnets / 24 can be aggregated into one / 21. This is possible because address blocks are usually located nearby on the Internet. All that you need to take care of in this case is the router - how to get to the subnet.

MAC addresses are each on their own, as they are assigned in a pseudo-random manner in production, and two addresses that differ only in the last bit may end up in the diametrical ends of the planet. If suddenly someone would like to use MAC-addresses for end-to-end addressing on the Internet, he will be faced with the fact that routers will need to know the address of each individual node in the global network. Hello, the Internet of things.

Next approx. translator.
The question illuminated in the original article is actually simple - the lack of scaling alone is enough to abandon this idea.

Much more interesting is the reverse question: Why do we need MAC addresses? Isn't there enough IP addressing for everything? It's all not so simple. Why really in the modern world, where soon the stack name can be changed to TCP / IP / Ethernet, not to completely abandon addressing to L2 and allow the nodes in the segment to communicate over IP?

ARP is no longer needed - the packet is switched over IP (by the way, there are already switches that can actually produce IP Learning instead of MAC Learning). Broadcasting is also available through the address 255.255.255.255.

At the same time, I do not propose to abandon Ethernet or L2 at all, no - the level of abstraction is necessary at a doth - the network should not work directly with the physical, engage in framing, verify integrity, etc.; we just remove addressing from L2.

The difficulty actually begins when a packet is transferred from one subnet to another through a series of routers. Here the broadcast nature of Ethernet makes itself felt. In the IP header, the destination address is fixed and does not change as the packet moves. Therefore, the question arises how to forward the packet between the routers. Now it is for this that the Next-Hop MAC addresses are used. The fact is that behind the router's Ethernet interface there can be not one neighboring router, but two, three, a dozen, and here you will have to add another Next-hop identifier.

In the real world at 99.9%, we use P2P lines between routers and there is no need to add the Next-hop address to the packet - there is no one to send more - just send the frame to the cable. Here we can recall the PPP, where at least formally the "address" field is, but it is not actually used.

But the concept of Ethernet, which was originally planned only for local segments with user machines, does not provide a P2P script separately.

As a result, we cannot remove addressing from the Ethernet layer. However, there is still the question - why MAC-addresses, because in the Ethernet header, we could specify the Next-Hop IP address, which would also change on each node.

In general, this is true, but this approach breaks the ideology of the protocol stack, which implies that the layers are independent of each other. Now, for example, you can easily throw out Ethernet and use xDSL or PON instead, or, forgive Leibniz, Frame Relay - administrative and financial difficulties only. Also, technically, you can put IPCh’s own network protocol on top of Ethernet - and this will all work with minimal changes (add a new Ethertype).

I note that this issue can not be discussed in isolation from the historical and administrative context. Even if we take the liberty to assume that we have found the perfect combination of ideal IP + Ethernet protocols, and the next 300 years we are not threatened by global changes, we must remember that 20 years ago the world was different, as we said above, and Ethernet was only one of. We could not tightly link the network and channel levels. And now the networks that are already working, and for this we usually do not need to make a titanic effort, no one will redo it simply because it seems redundant to use IP and MAC addressing simultaneously.

By the way, you may be somewhat surprised, but some of the ideas described will enter our life in the face of IPv6 with its concept of Link-Local addresses.



# Does QoS allow for increased bandwidth?


Among newbies, there is sometimes a misconception that QoS is a magical technology that allows you to push more packages through a line than it can. This is not true. For example, if your Internet channel is limited to 10 Mb / s, you can never send more to it. The QoS task is to give preference to certain types of traffic over others. Thus, during the overload on the line (if you try to send more than 10 Mb / s), less important traffic will be discarded in favor of the free transfer of a higher priority.

Typically, QoS is used to protect real-time traffic, such as voice or video conferencing, from traffic that is tolerant of delays and losses - WEB, mail, FTP, Torrent, etc. In addition, QoS will help to avoid occupying the entire band by transferring a large amount of traffic, such as backing up servers.

Consider a situation where you have an office connected via two E1 channels with a total bandwidth of 4 Mb / s. Voice and data are transmitted along this line. To ensure that voice traffic does not experience degradation during congestion, a guaranteed bandwidth can be distinguished using QoS. The rest will be available for data. However, if after that the traffic with data is noticeably worse, then QoS will not help any more - in this case you will have to expand the channel.

The translator allowed himself some liberties in Russian-language terms that would allow, as it seems to him, to better understand the meaning.

Source: https://habr.com/ru/post/268019/


All Articles