Internet Protocol or IP addressing protocol and routing are the core elements of computer networking. In order to establish a reliable computer network one must have complete understanding about IP addressing and routing. IP addressing is the core aspect of TCP/IP, Transmission Control Protocol/Internet protocol is the most widely used internet protocol and many complex networks are running successfully on it. Getting back to IP addressing, we are going to discuss fundamentals of IP addressing which prominently include, how IP addressing works in IPv4 and IPv6?
What is IP Addressing?
IP addressing is required to communicate over a network using TCP/IP; every computer system connected to a network must have unique IP address. The IP address indicates the number of network and node on that network, in simple words it acts just like a street address and a house number.
All the devices on the same logical network segment must have same network address but they must have unique node address. Another important element in IP addressing is ‘Subnet mask’, which specify the portion of network address and node address of the IP address. The IP addressing works differently in IPv4 and IPv6 so are going to discuss them in detail below.
How IP addressing Works in IPv4?
IPv4 address consists of four set of 8 binary bits called octet, which indicates that IP addresses contain 32 bits and each bit has its decimal value. The left most bit start from 128, 64, 32 and so on. Each bit in the octet has value 0 or 1, if the value is 1 will consider its decimal value but if its value is 0, it will be ignored. If all the bits are 0, the octet value is 0 as well but if all the bits are 1, its value is 255. By using set of 8 bits and changing the value using 0s and 1s you can have any value ranges from 0 to 255 for each octet. The Table-1 shows Decimal to Binary conversion:
IP Address Classes
IP addresses are divided in to logical groups called classes. The IPv4 address has five classes starting from ‘A’ to ‘E’ but only three classes A, B, C assign addresses to clients whereas class D is reserved for multicast broadcasting and class E is reserved for future progress.
All the three classes A,B,C have fixed portion of subnet mask which is used to identify the network and node address. Class ‘A’ only use first octet for network address, class ‘B’ uses two octets and class ‘C’ uses three octets for network addresses. This indicated that class A provide small number of network address but a large number of host addresses, as compare to that class b offer large number of network address but small number of host addresses and class C provides even larger network address and smaller host addresses. The exact values are shown in table given below:
Subnet Mask Assignment
Similar to IP address, Subnet Mask is commonly expressed as 32-bit dotted decimal format but it has a limited functionality as compare to IP address. Each assignment class has its own subnet mask; the purpose of subnet mask is to differentiate between the network address and node address. The standard subnet masks of all the three classes are shown in the table below:
In order to learn how IP addresses are used, you need to learn subnetting. Subnetting is process using which the node portion of an IP address you can create more networks then you already have. For instance, consider that you have been assigned Class B IP address 184.108.40.206. This address indicates that you have a single network (150.150) and several node addresses which are not that much useful. With the help of subnetting you can use some bits of node portion addresses and create more network addresses. This way you can have more network addresses than node addresses.
The two major reasons to use subnetting are:
- It allows you to utilize IP address ranges more effectively.
- It makes IP networking more secure and easily manageable, also you can have more than one networks instead of having one.
- And Multiple networks limit traffic to the network that it should be on, which provide more efficient traffic control.
- Multiple subnets create multiple broadcast domains which reduces the networkwide broadcast traffic.
Difference between IPv4 Public and Private Networks
IP addressing in IPv4 involved many considerations such as Public and Private Network.
- A public network could be defined as to which anyone can connect such as internet.
- A private network is a closed network with restrictions on such as corporate network or school network.
The major difference between private and public network other than access, is that one really has to configure IP addresses more carefully in public network whereas in private network you have more freedom. As we have already discussed that hosts on a network must have unique IP addresses in order to communicate via TCP/IP. This number indicates the logical network to which each host belongs to and host address on that network. In private network let suppose you have three networks and 100 nodes on each network, in this scenario IP addressing is not that much difficult whereas if you consider public network like internet than IP addressing is way too complex.
If you want to connect to the internet than you must have valid registered IP address, mostly it is provided by you Internet Service Provider (ISP). On the other hand if you are running an organization and willing to acquire more IP addresses than you have to contact your area’s regional number authority, you can figure your regional number authority by visiting IANA website. Sometimes ISPs also provide group of IP addresses in order to meet corporate clients’ needs but if you disconnect you ISP you might have to lose all the IP addresses as well.
Private Address Ranges
In order to enhance flexibility and reliability in terms of IP addressing a Private Address Range is defined. For instance if a network is configured incorrectly it might pollute the internet, a private address range is defined and reserved for private networks. Let suppose if there is a leak in private network and it routes the data to public network, the public network instantly reject the packets at first router despite of forwarding it. The public networks are configured to ignore any data that contains private address.
Three ranges from all the Classes A, B and C are defined in RFC 1918, you can choose any of these but the class A and B offer more addressing options than Class C. The table given below provides address ranges from Class A, B, C.
Classless Interdomain Routing (CIDR)
Classless Interdomain Routing (CIDR) is a method to allocate IP addresses other than Class A, B and C structure which is used by IPv6. By defining the number of bits in subnet mask one can have more flexibility than three classes.
In CIDR method addresses are allocated with the value of known as slash. The slash indicates how many bits of subnet mask represents the network portion of the address. For instance, if a subnet mask obtain 8 bits from the first octet and 4 from the second octet it would be represented as /12. You must be thinking why ‘/’, well the CIDR value is written after IP address such as 192.168.1.1/24, in this the IP address is 192.168.1.1 whereas subnet mask is 255.255.255.0.
Default gateway is a medium using which device can communicate with the hosts on other network and one doesn’t have to configure static routes. This way workstation can communicate with other remote networks such as internet. A default gateway could be a router or any other computer having network interfaces, these interfaces have local IP addresses but if the system is not configured with any static route or a default gateway than it won’t be able to communicate on its own network segment. The figure given below indicates how default gateway works.
IPv4 Address Types
IPv4 has three address types, Unicast, Broadcast and Multicast. The difference between all these types is given below:
- Unicast Address: In unicast address a single address is defined, which means the data will be sent to a specific address, also called as point-to-point address link.
- Broadcast Address: The broadcast address is totally opposite to unicast address. Using broadcast IP address you can send message to the entire network, every node present on that network will receive that message.
- Multicast Address: Multicast address is defined to establish communication between specific groups of people. A multicast IP address is assigned to all the devices in the group so that they can all send/receive messages instantly..
You must be thinking why we need IPv6 addressing; well IPv4 has served us more than 30 years and it provides 4,294,967,296 unique IP addresses, it’s a huge number but out of this some IP addresses are reserved for private addressing and are not available over the internet. IPv6 project is in progress since 1990s and now devices are ready to work with it. The improvement in IPv6 addressing is the capability to handle countless networks as it offers 340,282,366,920,938,463,463,374,607,431,768,211,456 unique IP addresses based on 8 bit addressing scheme.
How to Identify IPv6 Addresses?
IPv4 address is based on dotted-decimal format; 8 bits are converted to decimal number and separated by dot, like 192.168.1.1. As compare to that IPv6 is based on 128 bits structure and are divided into 16-bits blocks and each block is than converted to four digit hexadecimal numbers, separated by colon. As shown in the figure below, the IPv6 addressing format (2001:0:4137:9e50:2811:34ff:3f57:febc) is a bit different than IPv4 addressing.
The IPv6 address can be simplified by removing the leading 0s from each 16-bit block but you can’t remove all the 0s as each block must have single digit at least. By removing the censorship the IPv6 address looks like this 2001:0000:4137:9e50:2811:34ff:3f57:febc.
Furthermore, you might have to work with IPv6 addresses having 0s sequence which can be simplified in order to make it easily readable. In the previous example 0 represents set of hexadecimal number, so in order to simplify consistent 0s sequence in to colon hexadecimal format you can used ::, double colon as shown below:
Can be simplified and written as
Well, there are certain limitations to simply the address as you cannot reduce all the 0s in the IPv6 address unless it’s the first in the number in the sequence for instance, 2001:4000:0000:0000:0000:0000:0000:0003 this IP address cannot be written as 2001:4::3, it can be represented as 2001:4000::3 and it uses 3 blocks, 2001, 4000 and 3. You can calculate this by using the formula given below:
(8 – 3) * 16 = 80
So the total number of bits represented by double-colon is 80.
IPv6 Address Types
The IPv6 address types are different then IPv4 address, we have already discussed the IPv4 addressing types now IPv6 addressing types are discussed below:
- Unicast IPv6 Addresses: The unicast IPv6 address establish communication over single interface, with unicast IPv6 address data can be sent and receive between two parties, sending host and destination host. It’s a direct communication line between two parties.
- Global Unicast IPv6 Addresses: The global unicast address is similar to IPv4 public addresses, these addresses can travel all over the network.
- Link-Local Addresses: Link-local addresses are used to communicate within the local network and are automatically configured on all the interfaces. This configuration is quite similar to 169.254.0.0/16 APIPA automatically allocated by IPv4 addressing format. In IPv6 addressing the prefix for link-local address is fe80::/64, on single link IPv6 addressing network link-local address is used to communicate between devices.
- Site-Local Addresses: Site-local addresses are similar to IPv4 private addressing such as (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16). The private addressing scheme in IPv4 is used to establish private communication link between the users and they cannot interfere the global unicast, same is the case with IPv6 site-local addressing. Unlike link-local addresses, site-local addresses are not automatically configured; you have to allocate addresses by using either stateful or stateless address configuration processes, the prefix used for site-local addressing is FEC0::/10.
- Multicast Addresses: Likewise IPv4 multicast addressing, it sends and receive data between group of nodes instead of sending it to all the nodes in the network or LAN (broadcast).
- Anycast Addresses: Anycast addresses works between unicast and multicast, using anycast address you can send data to any one node in multicast group.
Comparison between IPv4 and IPv6 Addressing
How to Assign IP Addresses?
As we have discussed in detail various types of IP addressing scheme, the next phase is to learn how each system in the network gets its IP address and each system must have unique IP in order to function properly.
Static IP addressing is refers to manual IP allocation, you have to configure each system’s IP address manually. This system has two major drawbacks:
- In order to assign IP address to a single system is not a problem but when it comes to configure hundreds of system manually, it going to take a lot of time and in case of any error the system won’t be able to communicate with other systems over the network and you have to check all the IP addresses again which is quite exhausting.
- At organizational level if you have to change you IP addressing scheme, you have to change all the systems IP manually which is again not recommended or you can say not considered as a best practice to do so. That’s why most of the networks are now moving toward dynamic IP addressing.
Dynamic addressing is refers to automatic IP addresses allocation, these days networks use Dynamic Host Configuration Protocol (DHCP) system to automatically assign IP addresses to the client systems. The DHCP is a part of TCP/IP suite and it’s proven to be effective and efficient in terms of IP assignment as you don’t have to configure each system manually.
The basic functionality of DHCP service is to automatically allocate the IP address to client system but in order to do so you have to define IP addresses range known as Scopes. Scopes are defined on the system running DHCP server application, whenever the new client system added to network, it will ask for IP address and if all the things are in order, it will automatically assign an IP address to the new client system for predefined time period known as lease.
The DHCP server can be utilized more smartly as you can configure it to assign subnet mask, Domain Name Service (DNS) information and default gateway.
Network administrators prefer to use DHCP service as it has resolved many issues which they have to face in static addressing. First of all, there is no chance of human error as you don’t have to configure each system manually and it prevents IP duplication as well. On the other hand if you want to reconfigure your entire system on new subnet or interested in changing whole network structure, you don’t have to perform things manually.
In order to establish a TCP/IP network has to define IP address, subnet mask, default gateway and DNS server address.
- IP Address: Each system must have unique IP address in order communicate over the network.
- Subnet Network: It is used to identify which portion of IP address represents network address and which portion is host address.
- Default Gateway: Enable system to communicate with remote network without specifying explicit routes.
- DNS Server Address: It is required to perform dynamic hostname resolution, its common to have two DNS server configured so that in case one went down the other should be available.
Identifying MAC Addresses
Most people don’t have idea about Media Access Control (MAC) address and why it actually exists? How devices use them and how they are assigned? Well, in simple word MAC address could be called as physical address as it is physically embedded in the device interface.
MAC address is a fundamental element of network communication which is essential to establish a network regardless of the protocol that is required to form a network connection. It’s a 6 byte (48 bits) hexadecimal address which allows NIC to be uniquely identified over the network and each device connected to a network must have unique MAC address.
In order to cope up with the problem of duplicate MAC address assignment, the Institute of Electrical and Electronics Engineering has defined a specific method. They have assigned a unique ID to all the manufacturers and allow them to allocate further IDs. In MAC address the first bytes represent manufacturer ID and the rest are assigned by manufacturer.
For instance, let us consider a MAC address of a device 00:D0:59:09:07:51, in this the initial bytes (00:D0:59) indicates manufacturer’s ID also known as Organizational Unique Identifier (OUI) whereas the last three bytes (09:07:51) are called Universal LAN MAC address which make this interface unique. You can check OUI MAC address list here: http://standards.ieee.org/regauth/oui/oui.txt.
You can easily identify NIC’s MAC address using different ways according to the system you work on. Some common methods to identify MAC addresses are given below:
What is Network Address Translation (NAT)?
NAT is a method to use single IPv4 address for several computers, this used because of the unavailability of IPv4 addresses. For instance you have a small private network and you want to establish an internet connection using single IPv4 address, the NAT take the request from any system in the network and forward the request to the internet via single IP address that is configured on the external interface. While performing the NAT operation, NAT keeps the track of requested computer so that when the information returned, it should be sent to the right computer.
What is Port Address Translation (PAT)?
PAT works a bit differently then NAT, it translate all the system connected to the LAN into the same IP address but with different port number assignment, so whenever it routes the data over the internet it exposes single IP address to the network and when the information returns PAT route it to the destination client on the basis of table which contain public and private port numbers.
Understanding TCP/UDP Port Functions
How to Identify Common TCP and UDP Ports?
Every TCP/IP or application has port associated with it, whenever the data is received, it check its port number in order to identify destined protocol or service and forward it to the specific protocol or service. For instance, let us consider HTTP whose port number it 80 if web browser initiate a request for a access a web page, the request will be sent to targeted system and it will then examine the port number, the port number is 80 so it will route it to the web application server.
TCP/IP has 65,535 ports labeled from 0 to 1023. There are some common port numbers which are required to configure application and services, so being a network administrator you should learn them. List of some common ports number is given below:
These are the fundamentals of IP addressing one must understand in order to establish a network. To learn further about IP addressing and network configurations one must take Network+ certification offered by CompTIA. Network+ certification is designed for professionals who are interested in becoming network administrators so if you are willing to become one then you have to take CompTIA N10-005 exam which is formed to test networking skills.