Types of Ip Addresses – Computer Networks
Before discussing the types of Ip Addresses, let us understand the IP address in the computer networks. Every computer on computer networks has an address to reach the computer for incoming packets. For outgoing, each packet has the source address, of the sending computer. The address is called an IP address. Types of IP addresses have been classified, based on communication with each other in computer networks. Communication can ne one to one, one to many and one to all. In the following, we will describe each type od 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 address, communication is one to one. Means, if a packet is sent with unicast ip address in destination, only one host on the computer network will process, as a unicast address is unique across the LAN. An ip interface is associated with a Unicast IP address.
The 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 which 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 sent to a group of machines, the network uses a multicast address type in the destination address of the message. If a machine needs to get the multicast messages, it 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.
Broadcast Ip Address:
In Broadcast ip address type, all host receives the same message. This is one to all types 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 use 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 to 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)
In above 192.168.1.155 is the unicast address and 192.168.1.255 is Broadcast address. In the fourth line (UP BROADCAST RUNNING MULTICAST), we can see that multicasting is enabled.
Check what is multicast address:
[root@CentOS_6_64-155 ~]# ip maddr show 1: lo inet 18.104.22.168 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 22.214.171.124 inet6 ff02::202 inet6 ff02::1:fff4:9aea inet6 ff02::1
Above the multicast address is it 126.96.36.199. 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 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)