Question: I’ve been playing around with Linux desktop distro for a while. But, I’m very new to networking. Can you explain me in simple terms about what is an ip address and give me an example?
Answer: When someone mails you a postal letter, you get it. How? Because it has an address that uniquely identifies your home. Pretty basic. Right? Just like your home, every system in the Internet need to have an unique address for someone to find it. That is called an ip address.
Even when the servers are not on the internet, within your own private network, every system need to have a unique ip-address, if you like the machines in your network to talk to each other.
Every system can be accessed using both ip-address and their domain name. For example, when you ping yahoo.com, you’ll see the public ip-address it is using. So, both http://yahoo.com and http://22.214.171.124 will take you to the same website.
# ping yahoo.com PING yahoo.com (126.96.36.199) 56(84) bytes of data.
IPv4 Address Example
An example ip-address:
The above ip-address is in the dotted decimal number format. An ip address is in the format of 4 sets of decimal numbers separated by dots. The decimal number in each and every set is in the range 0 to 255. Each and every set is called octet. So, there are 4 octets in an ip address.
However systems understands ip-address only in the binary format. So, when you configure your system with an ip-address in a dotted decimal number format, it is converted to a binary number format internally by the system as shown below.
01000101010110010001111111100010 (or) 01000101.01011001.00011111.11100010
IPv4 IP address are 32 bit numbers. In the above binary format, there are total of 32 binary numbers. Each and every binary number that are separated by the dot is converted to its corresponding binary number. There are total of 4 bytes here.
Each and every octet can have a value from 0 to 255. Since there are 4 octets in an ip-address, the total possible combination of unique ipv4 ip addresses are 4,294,967,296.
IPv6 Address Example
IPv4 stands for Internet Protocol Version 4. Most of the networks and systems in the internet is currently configured for IPv4. Since IPv4 ip address has only 32 bits (a total of 4,294,967,296 unique ip-addresses), the ip addresses in the internet are running out quickly. Please note that there is a big block of these ip addresses are reserved for special purposes (for example, private network and multicast addresses).
IPv6 stands for Internet Protocol Version 6. Since there is a possibility that we might run out of ip address in the internet, IPv6 was developed. IPv6 ip address has 128 bits. This is a huge improvement from the 32 bit ipv4 ip address. While lot of networks are getting configured for both IPv4 and IPv6, there is still a huge number of networks and systems in the internet that works only for IPv4. But eventually all these systems might go towards the IPv6 route.
IPv6 ip address is typically written in hexadecimal separated by colon. A colon separates 16 bit. The following is an example of IPv6 address:
Leading zeros can be truncated. For example “0000” can be be just written as empty. In the above example :: indicates that it has multiple 0’s in that location. Typically the IPv6 format can be written down in three ways 1) compressed, 2) uncompressed and 3) fully uncompressed as shown below. All of the following are the same:
- IPv6 Compressed (0000 is not displayed) – 2002:4559:1FE2::4559:1FE2
- IPv6 Uncompressed (0000 is displayed as 0) – 2002:4559:1FE2:0:0:0:4559:1FE2
- IPv6 Fully Uncompressed (0000 is fully displayed) – 2002:4559:1FE2:0000:0000:0000:4559:1FE2
Execute “ifconfig -a” which will display both ipv4 and ipv6 ip-addresss (if it is configured appropriately):
# ifconfig -a | egrep 'inet|inet6' inet addr:188.8.131.52 inet6 addr: 2002:4559:1fe2::4559:1fe2