Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have,

Class   Range      NetMask         Bits    Bits   hosts#
A        0-127         8      24     16777216   (i.e.

B      128-191      16      16        65536   (i.e.

C      192-254    24       8          256   (i.e.


$cat /proc/version

Linux version 2.6.32-amd64 (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #1 SMP Tue Jul 1 18:36:07 UTC 2011

$ip route show dev eth1 scope link dev eth1 scope link dev eth1 scope link dev eth1 scope link dev eth1 scope link

default via dev eth0

default via dev eth1

default via dev eth1

default via dev eth1

default via dev eth1

default via dev eth1

Question1. As per the above display, using iproute 2009 version I am getting IPv4 class A address holding class C or B netamsk and vice-versa. is it a valid configuration ?

Question2. As per the above display, if iproute allow to add multiple default routes, then what would be the behavior of packet flow when packet need to be routed using only one default route (where many default routes exist) ? also how the iproute filter multiple default routes ? also, is it a valid feature that iproute should allow multiple default routes in a server setup ?

share|improve this question
up vote 2 down vote accepted

Classes, netmasks, and /## are all about grouping addresses into blocks. I don't like to use classes because the concept is outdated--they insist on putting the border (of what part of the address can change and still be in the block) where one of the dots is when that restriction no longer exists because of CIDR (Classless InterDomain Routing). I prefer /## format over netmasks even though the dictate the same thing because with the /## format is easier when the border is not on the boundary.

In your list above, you have three blocks. (You call them class A, B, and C). You could represent them in slash notation like this:,, and The number after the slash simply specifies how many of the bits at the start of the address have to be the same for the address to be in the specified block. Each chunk of numbers between the dots is worth 8 bits. If you want to put the bondary of what can change somewhere between the dots, you have to convert the number between the dots to binary first. As a side note, most of these addresses are already assigned to someone and using them on a private network behind NAT could cause problems. You should only need to deal with routes for addresses like these if you are running some backbone router. Also, some addresses like are reserved for special purposes and using them will also result in problems.

Routes tell your computer what to do with traffic depending on its destination. A route that says, for example, dev eth0 it means send all traffic that has a destination address that starts with 192.168 out the interface eth0. If the route says dev eth0 via it means send all traffic that has a destination address that starts with 192.168 to (hoping that will know what to do with it. A default route is what the computer uses when it has no specific rule for the traffic. A default route will say what computer to send it to. Your computer will send all traffic it doesn't have a routing rule for to the address specified in hopes that computer will know what to do with it.

Your questions don't make a lot of sense to me, but hopefully you might be able to figure it out if you understand it. I'll try to do my best to answer the questions, but some of them are a little confusing.

I think the answer to question 1 is that it is valid because of CIDR. CIDR pretty much does away with classes.

As far as question 2 & default routes, my computer only picks one of them to use. If it isn't correct (the rule doesn't point to a valid router), the traffic is lost. If you want to balance connections, then you need to use bonding.

share|improve this answer
Thanks a lot Azendale :-) – mav_2k Sep 4 '11 at 5:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.