Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

We have,

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

B      128-191    255.255.0.0      16      16        65536   (i.e. 150.0.0.0)

C      192-254    255.255.255.0    24       8          256   (i.e. 199.0.0.0)

Also,

$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

114.0.0.0/24 dev eth1 scope link

114.0.0.0/16 dev eth1 scope link

114.0.0.0/8 dev eth1 scope link

199.0.0.0/8 dev eth1 scope link

122.0.0.0/8 dev eth1 scope link

default via 16.107.200.1 dev eth0

default via 16.107.200.1 dev eth1

default via 16.107.200.20 dev eth1

default via 16.107.200.21 dev eth1

default via 16.107.200.22 dev eth1

default via 16.107.200.23 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

1 Answer 1

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: 127.0.0.1/1, 128.0.0.1/2, and 192.0.0.1/2. 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 127.0.0.1/8 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, 198.168.0.1/16 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 198.168.0.1/16 dev eth0 via 10.2.3.45 it means send all traffic that has a destination address that starts with 192.168 to 10.2.3.45 (hoping that 10.2.3.45 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

 
discard

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.