CIDR (Classless Inter-Domain Routing)

From this information, the Operating System can determine the most useful router to choose for a particular destination. On Solaris, the /etc/netmasks file tells the OS about particular netmasks for given networks; otherwise, the old, pre-CIDR standard is followed, whereby the IP address itself suggests its netmask:

From To Class / Comments Netmask
0.0.0.0 9.255.255.255 Class A 255.0.0.0
10.0.0.0 10.255.255.255 Class A Private 255.0.0.0
11.0.0.0 126.255.255.255 Class A 255.0.0.0
127.0.0.0 127.255.255.255 Loopback 255.0.0.0
128.0.0.0 172.15.255.255 Class B 255.255.0.0
172.16.0.0 172.31.255.255 Class B Private 255.255.0.0
172.32.0.0 191.255.255.255 Class B 255.255.0.0
192.0.0.0 192.167.255.255 Class C 255.255.255.0
192.168.0.0 192.168.255.255 Class C Private 255.255.255.0
192.169.0.0 223.255.255.255 Class C 255.255.255.0
224.0.0.0 239.255.255.255 Multicast ...
240.0.0.0 255.255.255.255 Reserved ...

You can see that each class (A,B,C) has a "Private" segment in the middle, which is non-routable. Other than that, their netmasks are 255.0.0.0, 255.255.0.0. and 255.255.255.0 (ff000000, ffff0000, ffffff00 respectively, in Hex). That turned out to be a little too simplistic as internet usage grew, so we now have Classless Inter-Domain Routing (CIDR), which forgets about classes, and just says that a network can have any netmask. The closer you get to such a network, the more likely you are to need to know about how it is configured (hence /etc/netmasks, and CIDR in DNS, etc).

Networking Tutorial
Share on Twitter Share on Facebook Share on LinkedIn Share on Identi.ca Share on StumbleUpon

Want to take the tutorial with you?

My Shell Scripting Book:
    Shell Scripting, Expert Recipes for Linux, Bash and more
is available online and from all good booksellers.

Buy my 600-page Shell Scripting Book...

From Amazon USA:

From Amazon UK:

For Kindle:

Or From other retailers

You can also find the book, and join a shell scripting community, on Facebook:


Option Two: Buy the 70-page PDF (£4.99/$9.99/€6.99)
(Free Sample)

And you can always Download my Free Shell Scripting Cheatsheet PDF