A QUARTERLY PUBLICATION OF ACCS
Experiential Learning of Networking Technologies: Understanding Network Layer & IP Addressing

Ram P. Rustagi, Department Of CSE, KSIT Bengaluru

Introduction

So far in our articles [1], we have discussed a) Internet and network in general, such as, its functioning, network delays and performance, diagnostic tools to use etc. b) Application layer with detailed focus on HTTP protocol, its message structure, and use of HTTP headers in designing web applications, and c) Transport layer with focus on end to end delivery i.e. delivery of data from a process on one machine to a process on another machine. At the core, all of these require network communication between two computer systems. In this article, we will explore basics of communication mechanisms at network layer i.e. data exchange between two computers systems.

IP Address: Network and Host Part

During the early days, networks were envisaged to belong to three categories: a) Large networks, b) Medium size networks, and c) Small size networks. These three networks were correspondingly classified as Class A, Class B and Class C networks [2], and respective number of bits in the network part of the address were fixed to distinguish between these classes. First 8 bits were assigned for class A; first 16 bits were assigned for class B, and for class C networks first 24 bits were assigned. The classification is depicted in Figure 1. Two more classes were defined as well, namely class D and class E. Class D is used for multicast addresses and have first 4 bits as 1110. Class E is reserved for future use, even today it continues to remain reserved.

Figure 1: Initial classification of IP addresses

Since these first few bits are overlapping among these 3 classes, these classes are identified by setting specific value for initial few bits in network part. Class A network has its first bit set as 0, and the value 01111111 of first 8 bits in the network part is reserved for local loopback interface. Thus, total possible number of values for class A network would range from 00000001 to 01111110, a total of 126 (=28-2) values. Similarly, class B network is identified with value of first two bits as 10. Thus, total number of possible class B networks are 214=16392 (first 16 bits would range from 10000000 00000000 to 10111111 11111111). Class C network is identified with first 3 bits as 110, and thus have 221 possible values for network addresses. For any of these 3 network classes, there is no classification in the host part. However, two values corresponding to all bits set as 0 and 1 in host part are meant for specific use and can’t be assigned to any computer system. Thus, number of bits in host part for class A network is 24 (32-8), and thus number of possible hosts in a class A is 224-2=1,67,77,214. This class A network was meant for a large corporation having very large number of computer systems. Similarly, the number of hosts in class B network is 216-2=65534, and number of hosts in class C network are 28-2=254. This class C network was typically meant for catering to most of small home/office networks.

This classification served the initial purpose, but could not cater to requirements of growing number of networks needed by many entities. For example, consider a small office having just 10 computers. At best, it will be allocated a class C address and this means 244 (254-10) addresses cannot be assigned to anyone else and would be wasted. Similarly, if a medium size company has 1000 computers, it will be allotted a class B address which again will result in non-usage of 64534 (65534-1000) addresses. Thus, this fixed classification resulted in under-utilization or wastage of network addresses. Considering this wastage, this classification with fixed size of network was done away with and instead varying size of network part was introduced. This is described in details in RFC 4632 [10]. A network needs to have a minimum of two computers for them to communicate, and hence, host part should provide for at least 2 addresses. Since for any network, 2 more values need to be used (all 0s and all 1s), thus we need a total of 4 values in host part i.e. 2 bits. Thus, network portion can have maximum of 30 (=32-2) bit. Thus, for all practical purposes, netmask can be maximum /30. Similarly, the network portion can have minimum of 1 bit, though most unlikely to be used as it would leave 31 bits for host part implying 231-2 systems in a single network (a hypothetical case).

Representing IPv4 address in binary form with 32 bits is cumbersome to read and understand. Representing it as an integer value would be a shorter form but difficult to differentiate between the network and host part. For an easy understanding and interpretation, 32 bits are divided into 4 octets (8 bits) and these are written using decimal value separated by ‘.’ (Dot). Though there is no formal specification for this representation, these were first time described in RFC 790 [2]. The IP address is written as a.b.c.d/n, where a, b, c, d correspond to decimal value of each octet and n represents the number of bits in the network part. Typically, any computer system or a smartphone connected to a Wi-Fi hotspot will have its IP address as 192.168.x.y/24 (x value would range between 0 and 255, and y value would range between 1 and 254), implying that network portion is 24 bits. Similarly, another IP Address in the same network would be 192.168.x.z/24. Please note that /24 is used to identify the network portion of the IP Address. Thus, these two IP addresses 192.168.x.y and 192.168.x.z belongs to same network with /24 as netmask (24 bits of network portion).

As each system connected to a network need to have an IP address (more precise would be the IP address of connected interface), as a first step towards our experiential learning, we would like to find the IP address of the computer one uses in day to day life. IP address of a Linux system can be identified by using the command ‘ip address show’ on the command terminal of the system as shown in Table 1. In older versions of Linux, the command ‘ifconfig’ was generally used. This old command is still supported in current versions but has been deprecated and it is recommended that user should avoid using this ifconfig command. Similarly, to find IP address of Android phone (when connected to a hotspot), typical set of steps would be Settings → About → Status, and it will display IP address and other information related to the Android phone. For a Windows system, one needs to explore its settings via Network → interface → properties → TCP/IP address. The set of steps for experiential exercise to know the IP address of a system is given in Exercise 1.

Table 1: Finding IP address of a Linux machine

Summary

We have discussed IP address assignment, and its representation using Dotted Decimal Notation (DDN). Using this DDN notation, 32 bits of IP address are written as a.b.c.d where each of a, b, c, and d is a decimal number between 0 and 255. We also discussed the role of netmask and network number and understood that two machines in same network can communicate with each other directly i.e. without needing any intermediate router device. We also explored assigning of multiple IP addresses to a single network interface. Lastly, we discussed Network Address Translation (NAT) mechanism to enable users to access Internet in view of depletion of IPv4 address space and use of publicly usable private IP addresses i.e. 192.168.0.0/16, 172.16.0.0/12, and 10.0.0/8.

Continuing in this series, in the next article, we will explore basics of IP routing, Variable Length Subnet Masking (VLSM) and use of ICMP to diagnose network.

Exercise 1

2. Open terminal window and identify network interface, IP Address and netmask.

1. On Linux,

2. On Macbook

1. ifconfig

3. On Windows

1. ipconfig/all

3. Identify any other device (such as smartphones, iPads, desktops etc.) in the same network and discover its IP address. Using netmask verify that all such devices have same network number as your laptop/desktop.

4. Determine if it is public IP address or private IP address. If private IP address, discover your public IP address i.e. IP address which is used by your Internet gateway. This can be obtained by visiting any URL providing public IP address e.g. https://www.whatismyip.comhttps://www.apnic.net. Open the browser, enter the above-mentioned URL and public IP address of your Internet gateway will be displayed in browser webpage.

5. Use nc (netcat) to chat few messages between two connected devices within your local network using the discovered IP addresses.

Learning: Identifying the IP address of a network connected device.

Exercise 2

Topic: Assigning Multiple IP Addresses to an interface

1. If you don’t have VM software, then install VirtualBox[11] and install Ubuntu Linux as the guest operating system under VirtualBox or your existing VM platform. To install VirtualBox and guest OS Ubuntu, follow the instructions as given in [11].

3. Identify the IP address of virtual interface on host system e.g. Windows/Mac etc.

4. Open a terminal window on host machine and ping the IP address of guest OS (Ubuntu). This ping should be successful.

5. On the guest OS (Ubuntu), assign a new additional IP address within the same subnet as that of existing IP address. For example, if existing IP address is 192.168.43.11/24 and corresponding network interface is eth0, then assign 192.168.43.21 to this IP address (replace 192.168.43.21 and eth0 with appropriate values as needed).

6. From the host machine (Windows or Mac), ping this new assigned IP address. Ping should be successful.

7. Assign a 2nd new IP address but belonging to a different network e.g. 192.168.44.11/24. This network number would be 192.168.44.0/24 which is different existing network number 192.168.43.0/24. Ping to this new IP address (e.g. 192.168.44.11 or whatever you have configured) from host OS terminal windows. The ping should fail.

Learning: Assigning of multiple IP addresses to a network interface reachability within same network and non-reachability in different network.

Exercise 3

1. If you have access to an office or home network which have multiple devices connected to a network e.g. multiple smartphone to a hotspot use that setup.

2. Identify IP address of your laptop as discussed in Exercise 1.

4. Windows based system by default have their firewall enabled and thus to receive response from these systems, firewall should be disabled for ping request.

6. You should see multiple responses. The same can be verified by using the command ‘arp -a’ which will output all the IP Addresses discovered.

Learning: Understanding usage of broadcast address e.g. using a single ping command to identify all live machines within the network.

References

1. Ram Rustagi, Viraj Kumar, “Articles on Experiential Learning of Networking Technologies”, journal of Computing and Communications, Vol 1:issue 01 – Vol 04: Issue 1, June 2017 – Mar 2020, http://rprustagi.com/ELNT/Experiential-Learning.html, Last accessed June 2020.

2. RFC 790, “Assigned Numbers”, Jon Postel, September 1981, https://tools.ietf.org/html/rfc790. Last accessed June 2020.

3. RFC 791, “Internet Protocol: DARPA Internet Program Protocol Specification”, September 1981, https://tools.ietf.org/html/rfc791.

4. RFC 793, “Transmission Control Protocol: DARPA Internet Program Protocol Specification”, September 1981, https://tools.ietf.org/html/rfc793.

5. RFC 1631, “The IP Address Network Translator (NAT)”, Egevang, Franic et al, https://tools.ietf.org/html/rfc791 https://tools.ietf.org/html/rfc1631, last accessed June 2020.

6. RFC 1918, “Address Allocation for Private Internet”, Rekhtr, Moscowitz et al., Feb 1996, https://tools.ietf.org/html/rfc1918, Last accessed June 2020.

7. RFC 2131, “Dynamic Host Configuration Protocol”, Droms, March 1997, https://tools.ietf.org/html/rfc2131, last accessed June 2020.

8. RFC 2460, “Internet Protocol, Version 6 (IPv6) Specification”; Deering, Hinden; December 1998, https://tools.ietf.org/html/rfc2460.

9. RFC 2764, “A framework for IP based Virtual Private Networks”, Gleeson, Lin et al., Feb 2000, https://tools.ietf.org/html/rfc2764, Last accessed June 2020.

10. RFC 4632, “Classless Inter Domain Routing: The Internet Address Assignment and Aggregation Plan”, Fuller, Li, Aug 2006. https://tools.ietf.org/html/rfc4632, Last accessed Jun 2020.

11. “VirtualBox: Welcome to VirtualBox.org!”, https://www.virtualbox.org, last accessed June 2020.

12. “Internet Assigned Numbers Authority (IANA) , https://www.iana.org, last accessed June 2020.

13. “Indian Registry for Internet Names and Numbers”, https://www.irinn.in, last accessed June 2020.

14. “Regional Internet Registry Administering IP addresses for Asia Pacific”, https://www.apnic.net, last accessed June 2020.

Current Issue

Issue 3
03 December, 2022
Browse by Categories