Types of IP Addresses – Computer Networks
Before discussing the types of Ip Addresses, let first us understand the role of an IP address in a computer network. Every computer on a computer network has an address. The address is the IP address. A remote machine should use the IP address to reach the machine or computer.
For outgoing, each packet has the IP address in the source address, of the sending computer. Types of IP addresses have been classified, based on communication with each other in a computer network. Communication can be one to one, one to many, and one to all. In the following, we will describe each type of IP address in detail with an example.
Unicast Ip address:
This is the most common type of address. We all have the experience to work with the unicast IP address type in our daily life. In unicast IP addresses, communication is one-to-one. This means, that if a packet is sent with a unicast IP address in the destination, only one host on the computer network will process it, as a unicast address is unique across the LAN. An IP interface is associated with a Unicast IP address.
An example of a unicast address type is any address of the public webserver. When you type a URL, after DNS lookup, an HTTP request will be processed by the webserver IP address only.
Another example can be a LAN computer. If an IP packet needs to send from a LAN machine to another machine (e.g from 192.168.1.20 to 192.168.1.30). The packet is broadcast to all computers on LAN. The computer has the destination IP (192.168.1.30) configured. The others will discard the packet.
Multicast Ip Address:
As the name suggests, in multicast IP address type. There can be one-to-many, communication. In a scenario, where a packet needs to send to a group of remote machines. The network uses a multicast address type in the destination address of the message. If a remote machine wants to receive a multicast message. The machine has to subscribe to the multicast address.
For example, if there are a total of 10 machines on the LAN. Only five machines have been subscribed to a multicast IP. When a host sends the message to the multicast IP address, only 5 machines will process the message. Others will silently discard it.
Broadcast Ip Address:
In a Broadcast IP address type, all host receives the same message. This is a one-to-all type of communication. A single host sends the message and all other hosts on LAN processes. A broadcast IP has all 1’s in the Host part. For example, if we have a class C type of LAN 192.168.1.1/24, then the broadcast IP will be 192.168.1.255. The broadcast address can also be 255.255.255.255.255. When a machine on a network uses to send the packet to all, it uses 255.255.255.255 in the destination IP address of a message header.
Check Unicast, Multicast, and Broadcast IP addresses:
Till now we have studied the various types of IP addresses. This section will demonstrate how we can check the various IP addresses of a Linux machine. How we can add/remove the Linux machine to a broadcast IP address.
After login into the machine, we can see the ethernet configuration.
[root@CentOS_6_64-155 ~]# ifconfig -a eth8 Link encap:Ethernet HWaddr 08:00:27:F4:9A:EA inet addr:192.168.1.155 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fef4:9aea/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:852793 errors:0 dropped:0 overruns:0 frame:0 TX packets:3536016 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:355151285 (338.6 MiB) TX bytes:5076597166 (4.7 GiB)
Above 192.168.1.155 is the unicast address and 192.168.1.255 is a Broadcast address. In the fourth line (UP BROADCAST RUNNING MULTICAST), we can see that multicasting is enabled.
Check what is the multicast address?
[root@CentOS_6_64-155 ~]# ip maddr show 1: lo inet 184.108.40.206 inet6 ff02::1 2: eth8 link 33:33:00:00:02:02 link 33:33:ff:f4:9a:ea link 01:00:5e:00:00:01 link 33:33:00:00:00:01 inet 220.127.116.11 inet6 ff02::202 inet6 ff02::1:fff4:9aea inet6 ff02::1
Above the multicast address is 18.104.22.168. If we want to disable the multicasting following is the sequence.
[root@CentOS_6_64-155 ~]# ifconfig eth8 -multicast [root@CentOS_6_64-155 ~]# ifconfig -a eth7 Link encap:Ethernet HWaddr 08:00:27:FB:B8:D2 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) eth8 Link encap:Ethernet HWaddr 08:00:27:F4:9A:EA inet addr:192.168.1.155 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fef4:9aea/64 Scope:Link UP BROADCAST RUNNING MTU:1500 Metric:1 <--- NO MULTICAST RX packets:853912 errors:0 dropped:0 overruns:0 frame:0 TX packets:3537004 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:355260161 (338.8 MiB) TX bytes:5076705082 (4.7 GiB)
After disabling multicast this machine will not process a packet having a multicast address as destination IP.
To enable again multicasting.
[root@CentOS_6_64-155 ~]# ifconfig eth8 multicast [root@CentOS_6_64-155 ~]# ifconfig -a eth7 Link encap:Ethernet HWaddr 08:00:27:FB:B8:D2 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)