[Ilugc] IP address and netmask

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Sat, 9 Jun 2012 14:22:07 +0530

An IP address is composed of 32 bits which is 4 bytes usually written in the
 form a.b.c.d.

Using a tiny sample space of 2^32 possibilities we have been able to
successfully networking
 all electronic items.

I wonder what is going to be the timeline for IPv6 rollout.

An IP address is composed of 4 octets or 4 bytes written in a human
readable form with dots
 in between.

But computers see it differently. It sees it as a hexadecimal
quantity, an unsigned long integer.

It is also represented differently and written differently if the
machine is little endian or big endian.

The network byte order or the alignment for networking by convention
is always big endian.

That way people talk a common language on the wire.

Anyway an IP address looks like this internally(0xC0A80103 or
3232235779) which is what we
 write as 192.168.1.3.

$ sipcalc 192.168.1.3/24
-[ipv4 : 192.168.1.3/24] - 0

[CIDR]
Host address            - 192.168.1.3
Host address (decimal)  - 3232235779
Host address (hex)      - C0A80103
Network address         - 192.168.1.0
Network mask            - 255.255.255.0
Network mask (bits)     - 24
Network mask (hex)      - FFFFFF00
Broadcast address       - 192.168.1.255
Cisco wildcard          - 0.0.0.255
Addresses in network    - 256
Network range           - 192.168.1.0 - 192.168.1.255
Usable range            - 192.168.1.1 - 192.168.1.254

Using IP addresses we can do a lot of things.

In fact everything in networking and Internet is actually IP addresses.

We should learn 3 special network blocks , 10.0.0.0/8, 172.16.0.0/12
and 192.168.0.0/16 which
 are not globally unique.

You use them for computers in a local LAN and they never go out to the
Internet that way.

Only possibility is either NAT them with a globally unique IP address
which rewrites the packet header
 or you should use a VPN to talk to another LAN that is remote.

In which case the IP address should be unique across all the LANs
connected by VPN.

Certain IP addresses are used for broadcast purposes. I have never had
to worry about them
 so far.

The concept of netmask is closely linked with the idea of network and
host ranges.

An IP address always starts with a network part and then a host part.

This is very simple. All names in a family end with a certain surname.
Similarly all IP addresses in
 a network start with a certain pattern, say 10. or 192.168. or
172.16... or some such thing.

The host part can change to identify each machine like we identify
each family member by a name.

The netmask is nothing but a simple electronics concept of applying
bitmask over the IP address
 written in binary which does not change for all computers in a network.

You specify a network in many ways.

Like this usually called CIDR, 192.168.1.0/24 which means that 24 bits
of the IP addresses do not change.

Or you say, 192.168.1.0 255.255.255.0

which means that the mask is of length 8 + 8 + 8 = 24 bits

You can also say 255.240.0.0 which is same as 8+4 = 12 bits

It is not very hard.

Only networks have masks. IP addresses don't have them.

Which means that you cannot have two different IP addresses just by
changing the mask.

That won't work. Mask is a feature of the IP address space.

-Girish



-- 
Gayatri Hitech
http://gayatri-hitech.com

Other related posts: