18 Network Layer: Services
Prof. Bhushan Trivedi
Introduction
We have seen that the network layer needs to do routing and forwarding. The routing process generates the map of the network while the forwarding process moves packet around based on the map and the policy of moving packets around. We will study other services that the network layer should provide in this module.
Services provided by network layer
Apart from routing and forwarding, a few other duties that a network layer should provide is listed below. Figure 20.1 summarizes this details.
1. Identify each machine uniquely. This is the prerequisite for all services including routing and forwarding. Addressing mechanism should be able to handle an increase in a number of machines and should help faster routing.
2. Account the usage of network layer services by every user, for reporting and billing. The volume of data and duration for which the services used are two common parameters considered.
3. Implement forwarding process in fastest possible manner. Considering the amount of data modern routers are used to process, this is the most critical function of most routers.
4. Multiplex TCP and UDP data (sometimes even SCTP data) and also manage multiple cards (which contain data link and physical layers)
Routing
We have introduced routing earlier and discussed that at length. We have also seen that we need to route based on two different cases. Routing within autonomous systems (Intra-autonomous routing) and routing between autonomous systems (Inter-autonomous systems). An autonomous system or AS is a collection of networks owned by a single party. When a packet needs to be routed between two divisions of the same company or between two departments of the University, the communicating networks, and the interconnecting infrastructure belongs to the single party, i.e. the routing is to be performed within the AS. In that case, the routing is called intra-AS or interior routing. All company networks together and all university departmental networks together are examples of AS. Sometimes, the packet starts from one AS needs to be delivered to another AS. For example, a packet from network-1 of company 1 to be delivered to network -7 of company-2. In that case, in addition to intra-AS routing, the packet also needs to find a path from AS of company-1 to AS of company-2. This is another type of routing, called exterior routing or inter-AS routing. The internal and external traffic need different types of routing because they need different treatment. The point will be clear when we study them in the next module1. Routing algorithms are quite close to the type of network we are using, therefore, wired and wireless networks need different types of routing. Smaller IoT devices need their own process of routing. We will look at an algorithm used for wireless routing in MANets in next module and module 36 will throw some light on IoT routing. Figure 20.2 depicts a case where four Autonomous Systems are communicating with each other. You can see internal communication, as well as Inter-AS communication, is carried out by those connecting lines.
Accounting
Accounting is a critical function of the network layer when the user is charged for the volume of the traffic. Two reasons demand an accounting by network layer.
1. How many packets users have sent and received, counting the amount of data he has consumed for billing him or checking if he has exceeded the limit imposed by the package he has paid for.
2. Checking if the packet volume shows some sign of abnormal activity, to check if there is a security breach of some sort or policy imposed is violated.
Receive services from the Data Link Layer
Once the network layer decides the destination address, it must pass that information to data link layer to construct the frame with that destination address and place the content (the packet), it has generated in that frame. The data link layer provides the service of delivering the frame to the next immediate recipient. The process is not as simple as it seems, the network layer has an IP address while the frame must contain a MAC address. There has to be a process for finding the MAC address for an IP address. This is performed by a process called Address Resolution. We will not stress this point further. Many references, Reference-2 especially, deals with the topic in more detail.
Provide service to the Transport layer
On one hand the network layer takes services of data link layer to send data across to the next immediate recipient, it also provides services to the transport layer by taking a segment from it,
1 Administrators always demand much finer control over routing and that is provided using a mechanism called SDN (Software defined networks) which we will look at in module 31 to 33. decide the next immediate recipient from the routing table as well as the destination address, and ask data link layer to deliver that to the next immediate recipient.
An IP address identifies a machine and a port number identifies an application running within. For example, a pair of values 128.66.203.37,80 indicates a machine with given IP address and a process (a web server) running within. This pair is called an end point. When we talk about a network connection, it is between two such endpoints, for example, 128.66.203.37,80 and 128.66.203.7,1234 indicate two endpoints, one server and another is a client, communicating with each other, and forming a connection. That means, two endpoints identify a connection. IP provides machine-to-machine and not process to process communication. We, that is why need a pair of IP address and port number to identify a process running on a machine.
Global Machine Level Addressing
Unless every machine is uniquely identified, it is impossible for the network layer to do the routing process correctly. The Internet has begun with classful addressing mechanism, now getting obsolete and another mechanism based on classless addressing is increasingly used. Let us brief about both.
Classful addressing
The classful addressing mechanism identifies each network as either class A, B or C. Class A are small in number but contain very large number of hosts (nodes), Class B are moderately large networks and their quantity also belongs to that range. Class C network is much smaller (in a number of nodes) but very large in number.
The network address is 32 bits in IPv4 and classful addresses are designed according to dividing that 32-bit number into four divisions and manipulating them as per the type of address. The numbers are represented in dotted decimal notation; a typical scheme of representing each byte as its decimal equivalent, separated by a dot (.). For example, 10000000 00010100 00000000 00000000 is represented as 128.20.0.0. In fact, this is an address of a network of type B. A type B network has first two bytes reserved for a network address. Every address in a classful mechanism is denoted as Network Address + Node Address. For example, a node 128.20.5.6 is a node belongs to a network 128.20 with node id as 5.6. Another node belongs to the same network may be 128.20 6.7. Here the first two bytes are same, which is not a coincidence. All nodes of the same network share the same prefix. i.e. all nodes of network 128.20.0.0 have first two bytes as 128.20 only.
Classless addressing
Classful addresses are not in vogue today. A mechanism which provides a more optimized way of assignment of the network addresses is used here. In classful addresses, the network and node addresses are byte level addresses, thus a network address is one byte and node address can be of 3 bytes (class A) or network address of two bytes and node address of two bytes (class B), and network address of 3 bytes and node address of one byte (class C) are the only three varieties possible. That resulted in huge waste of addresses. The classless mechanism allows the users to choose the network as well as the host address size. For example, if a user wants to get a network address for two computers, he can get an address of the network with 30 bit size with node address of two bits2. If the classful addressing mechanism is used, the user must get a minimum class C address which has 254 host addresses and thus would waste 252 addresses. The uniqueness of every address is a must, even in classless addressing case. When we allow arbitrarily long network addresses, a slash notation is used to indicate a number of bits used for network id. For example, 128.20.0.0/24 indicates that this address has first 24 bits as the network address and last 8 bits are host address.
When a host is connected to multiple networks, it will have multiple network addresses, as every address contains both networks as well as host ids. The figure 20.3 indicates the addressing issue. A router R1 and a node which is connected to two networks (called a multi-homed host) have two addresses.
The routers, interestingly, do not store complete addresses in the routing table but try to provide aggregated entries. Figure 20.4 depicts a typical setup and 20.5 showcases a typical routing table one may think a router should have. 20.6 showcases an aggregated table a router will normally provide.
The ISPs usually have limited addresses so they deploy a method known as Network Address Translation (NAT), which allows them to share addresses among multiple subscribers at the same point in time. You can get more information on NAT in from reference-2.
Both of above solutions are useful for IPv4 addresses. The Internet is moving towards using IPv6 everywhere and provide a (seemingly) final solution to addressing issues. An IPv6 has total 2128 addresses which are sufficient for almost all atoms on earth. The world is going towards billions of interconnected very small devices networks (IoT), IPv6 is most suitable option for addressing nodes of such networks. We will study about IoT and related networking solutions in modules 34,35 and 36. IPv6 provides a much more hierarchical way of addressing. Both geographical and ISP based hierarchy is possible to be provided in IPv6.
2 You may argue that one bit node address is enough but addresses with all zeros and all ones have special meaning and cannot be allocated to individual nodes.
Multiplexing and managing multiple transport layer and data link layer connections
TCP and UDP data is both runs multiple connections together and the single network layer provides their multiplexing and demultiplexing. Multiple data link layers are to be managed under a single network layer. We have learned about those processes in module 6 so we won’t discuss them here.
Forwarding approaches at network layer
Network layer, before communicating to the next immediate network layer, might establish a connection or otherwise. When a connection is established between two network layers before sending it is called virtual circuit while when a connection is not established, the approach is called datagram based. The TCP/IP model which is prevalent on the Internet uses a datagram based approach. A method normally chosen by high-level ISPs is called MPLS (Multiprotocol Label Switching) MPLS uses a connection-oriented approach. We will study MPLS in module 23. In fact, the current mantra is forwarding based on service. When we look at SDN later, we will throw more light on the issue.
Connectionless forwarding
The IP uses connectionless forwarding. This process works like this. The sender just sends the packet and forget about it. Whether that packet reaches the receiver or not, it is not IP’s concern. The connectionless forwarding acts like sending postcards or SMS, sent and forgotten. The receiver usually gets one, but might not get in sequence, might get is after a variable delay and might just be lost and not delivered. The sender won’t even get the feedback.
A better mechanism may be based on connection-oriented delivery where the receiver gets the feedback about delivery and the receiver gets the data in right sequence. This seemingly inferior approach is chosen to provide autonomy of routers. The connectionless delivery mechanism just pumps the packets into the network, without establishing the connection. That means the packet can take any path the intermediary routers deem fit. The routers get the power to send the packet in any direction they prefer. That helps routers to avoid paths which are closed, dynamically, for each packet that they forward.
If a connection-oriented approach for packet delivery was chosen instead, a router or a line failure would cost all connections passing through it. In a case of this connectionless forwarding process, the previous router can decide to avoid a dead router or line. The most important thing, the process of forwarding continues despite line or router start malfunctioning or stop working.
Closely observe the figure 20.7. Sender and Receiver are nodes which want to communicate. The network layer has multiple options possible out of which it chooses a typical path. Case number-1 shows the normal path including lines from A to B and B to Receiver. If a router B runs into a snag and A learns about it3, the router A learns about that and chooses an alternate path via D for subsequent packets. Even when the communication line B-Receiver goes down, B can choose another path via D to reach to the receiver for remaining packets. Thus, such a scheme, based on connectionless delivery is quite tolerant to line and node failures and thus chosen for network layer delivery at Internet.
Another question may arise; how many packets are lost if a snag is suddenly introduced in the network? In above case, for example, if A realizes that B has run into a snag, and diverts the remaining traffic through D, the packets that it sent and not forwarded by B may be lost. However, if B has not acked those packets, we know that the sender (A here) keeps a copy of
3 How A learned about it? There are ways all routers communicate with all their neighbors and learn if they are still alive or not. All routing protocols have elaborate mechanisms to learn about dynamisms of the network and find if a network node or line fails.
such packets and thus those packets are still with A. In that case, when A decides to change path, it will also send those packets along the new path and thus they are also not lost. Only those packets which acked by B and not forwarded are lost.
Here A and B are said to autonomous routers, they can choose the paths of incoming packets on their own, in the best interest of the network. This is a great freedom, enabling them to choose lightly loaded or faster paths etc. When we study SDN later, we will see that SDN extends this functionality to administrator’s policy based forwarding. That means the routers (called forwarding devices in the context of SDN), choose paths which best suits the policies designed by administrators. One can choose different paths for 2G and 3G subscriber’s packets, for example, or even a VOIP packet or a data download packet between the same pair of nodes can be routed differently.
You can also see that even during congestion (traffic jam), where a typical line or router has more packets than it can handle, previous routers can choose alternate paths to relieve that ailing router and thus help in controlling the congestion process.
The networks, in the modern era, are getting more and more reliable as interconnections by FO cables and technical conditions of routers are getting better and better. There are many solutions not allowing such autonomy are used, one of the most common methods is to use MPLS which we look at in module 23.
The process of connectionless forwarding
Let us recap the earlier example. When a sender wants to send, it won’t decide the path beforehand but rely on intermediate routers to eventually find the receiver. Each intermediary routers find the best path on their own, based on their local circumstances. Thus there is no connection establishment process preceding the data transmission.
When the sends the first packet, the path has no snag and the packet passes through A and B to the receiver. How do they find the path to the receiver? All routers of the network, including A and B, periodically review their surrounding and exchange information so they are aware of the best paths to all other nodes of the network. When A gets the packet from Sender, it looks into his routing table and finds that B is the best next router for destination Receiver. So it sends it across to B. Once B receive that packet, it also finds the direct entry in the routing table indicating that the Receiver is on the direct path. B sends the packet over that path and the packet reached its final destination! It is also important to note that the routing tables are not fixed. Periodically, routing algorithms run, take the stock of the nodes of the network, decide the current best neighbor for every other network as a destination in a given AS, and update the routing table accordingly.
For the second packet, though, the problem is there at B, so when it reaches at A, and A looks for paths to Receiver, it finds the B is not reachable and found another path through D. So A forwards the second packet to D.
Before the third packet arrives, the B is up and running and informs all neighbors including A that it is available now. So A forwards the third packet to B. Now when B updates itself, it finds that the response from Receiver arrives from D and not the direct link. Thus it learns that the direct link is down and forwards the third packet to D.
What if the line between B and D starts working now? Both B and D periodically poke at all their outgoing lines and if they get a response back, they conclude that the line is working. So if the line is working, they will soon learn about it and the fourth packet again travels through the original path.
Sound simple! Isn’t it? There are a few things we have overlooked in the entire process. First, we have assumed that the routing tables are already there and we will be using them straight away. That may not be the case, when the router is newly added or gone down and come up again, it loses everything it has learned including the routing table.
Second, the periodic updates are what they are, periodic. When a routing table is updated they remain as it is for a while and again updated. Between two updates, they continue with the same details they have updated in the previous cycle. That means, what they use is not exactly current status of the network but a snapshot taken a few moments back. It is quite possible that some late changes are not reflected in the routing table entries and a packet may be misdirected. The packet may also be misdirected if the information is updated but not reached to the router which is taking a decision. The point is, the routing table may not direct the packet to optimum path always.
Third, each router decides its own path based on the local information. In our example, we are fortunate to have the complete topology of the network at our disposal and thus we can confirm that the decisions taken by A and B are correct. The network administrators cannot see the topology like our academic image enables us and thus it is not easy for them to determine the decisions being right or otherwise. When the router’s decision is wrong, the packet sometimes roams around in the network. Special mechanisms need to be devised for informing the sender about problems associated with incorrect routing. A protocol called ICMP (Internet Control and Message Protocol) is used to report routing related errors back. An IP packet contains a field ‘time to live’4. When the packet roams around long enough, this field helps the router to drop the packet rather than forwarding it.
Pros and Cons of connectionless approach
Connectionless approach forgoes connection establishment and close. Thus the sender can start sending anytime it wants and without really knowing if the path to the receiver is intact or receiver is up and running. There are two disadvantages of this approach. First, the exercise may be fruitless if the path is broken or the receiver is out of order. Second, if one needs to have guaranteed delivery process, for example, a video transmission demands minimum delay for every packet. The connectionless approach has no way of providing it. If some connection-oriented mechanism would have been used instead, it would have been possible to ask for and get those service from intermediary routers. As the path does not change during the complete connection, once the quality is guaranteed, it is likely to be provided throughout the
4 The better name is “number of hops’. This field does not count time but the hops the node crosses. The packet is initialized with maximum possible value for that network and reduced at each hop. If the value is found to be zero by any router along the path, that router drops that packet and send an ICMP packet back to the sender.
connection. Both, discussion on MPLS in module 23 and later modules on SDN showcases alternative methods in vogue today as connectionless delivery is losing its sheen.
The routing process invites every router to make a decision. The routers have local information and different than the global view. A better solution demands a global view. Discussion of SDN also throws more light on this issue and a typical solution that it provides. The conventional routing process slowed down due to two things, first, every router deliberates on the packet and second, routing table size is dauntingly huge in most cases. Many techniques are devised to reduce routing table entries as well as faster decision making.
The connectionless design is really good in dealing with congestion as the routers can redirect traffic away from congested area. However, some type of traffic also demands process of admission control. Let us try to understand. In a connectionless architecture, any sender can send the packet whenever he wishes to. He won’t check network condition or readiness of the receiver. When other users are downloading files, they experience additional delay and that is fine with most of us. Unfortunately, if others are video conferencing or audio conferencing, they experience jitter and none of us likes it. What we need is a solution of connection-oriented type, known as admission control. When a new user wants to have a connection to send data, it is allowed only if the network can handle it and not otherwise.
Figure 20.8 shows how a congested area of the network is possible to be avoided in connectionless forwarding mechanism. The network topology is redrawn assuming the congested part does not exist. For example, C wants to send something to S. A normal path is through Q-G-M but the encircled path is congested right now. The routing tables are updated in a way that the nodes of the congested part are omitted from the entries. That means C can only find one way to send anything to S, via U-V-W path and thus only forwards to U. When all others follow this mechanism, the congestion resolves much faster. This is one of the biggest advantages of connectionless forwarding.
Connectionless forwarding demands complete receiver address in the packet. This is so because whenever a router needs to forward a packet, it looks at the complete address and then decides. When we do not have any special purpose routers along the path (in a case of MANets or IoT networks), processing longer addresses may take inordinate time. MPLS-like mechanisms use much shorter tags and thus are more useful.
Connecting networks at network layer
We looked at the problems of connecting networks at MAC layer. The network layer is a better candidate for interconnection. When a packet moves from an Ethernet network to a wireless network, for example, we won’t find any problems, if connected at the network layer. An entirely new frame, based in the recipient network is just created. The IP packet remains the same.
Sometimes one more problem needs to be addressed. Not all networks support the same maximum size of packets. A packet entering a network may be larger than the maximum size the network can handle. Unlike Ethernet or 802.11 type of networks, IP has an elaborate mechanism to fragment incoming packets to the required size when they enter such network. The fragments travel to the recipient as they are and the receiver defragments them. IP also provides that facility.
Another problem is of different types of network layers along the path. For example, we may find a sender sending IPv6 packet which travels through a network consisting only IPv4 routers. In that case, the network layer provides another solution. An IP packet can embed another IP packet inside. Thus when an IPv6 packet enters an IPv4 network, a new IPv4 packet header is generated and IPv6 packet is embedded within as data. When it crosses IPv4 network, the outer IPv4 packet header is removed and IPv6 packet starts traveling like before.
A final problem that a network layer may encounter is, the incoming packet may be of IPv4 or IPv6. The network layer must be able to handle such case. The solution to this problem is called dual stack. The network layer runs both IPv4 and IPv6 processes together. The Ethernet TYPE field will tell the packet belongs to which process and the required network layer is roped in for handling that packet.
That means, the process of interconnection can be easily managed at the network layer, unlike MAC layer. That is why most of the interconnecting solutions work at the network layer. The Internet is also designed as a network layer transit system. The sender machine and the routers communicate at the network layer and the routers communicate to each other using the network layer. Routing processes concentrate on network layer packet exchanges and also information each router share at the network layer. We will look at the routing process in the subsequent modules and will also see how these routing algorithms exchange packets and how they learn about network topology and act accordingly.
Summary
This module describes the Network layer services. We began with routing and forwarding and then accounting process. We have seen how it provides services to the Transport layer and how it takes services from the data link layer. We looked at classful and classless addressing mechanism and learned about slash notations. We spend a lot of time evaluating the connectionless forwarding approach used at the network layer. Though it is chosen as the default mode, some of the current situations demand other methods which we looked at later. Finally, we have seen why the network layer is considered better for interconnecting networks.
you can view video on Network Layer: Services |
References
- Computer Networks by Bhushan Trivedi, Oxford University Press
- Data Communication and Networking, Bhushan Trivedi, Oxford University Press