Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Just out of curiosity, let's say I have a forwarding table in an IP router that looks like this:

134.50.56.0/22    Interface 4
134.50.60.0/22    Interface 3
192.53.40.0/23    Interface 2
default           Interface 1

The router have the following incomming datagrams to deal with:

1) 134.50.63.9
2) 134.50.57.13
3) 134.50.52.3
4) 192.53.40.6
5) 192.53.56.7

Does the forwarding plane use the longest prefix matching rule here to determine on which interface the datagram should be forwarded?

Then datagram 1 should be sent to interface 3, 2->4, 3->4, 4->2 and 5->2...? Right?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

No, datagrams 3 and 5 will be send to the default gateway through interface 1, because there is no subnet route to these destinations.

Check out the output of sipcalc:

$ sipcalc 134.50.56.0/22
-[ipv4 : 134.50.56.0/22] - 0

[CIDR]
Host address            - 134.50.56.0
Host address (decimal)  - 2251438080
Host address (hex)      - 86323800
Network address         - 134.50.56.0
Network mask            - 255.255.252.0
Network mask (bits)     - 22
Network mask (hex)      - FFFFFC00
Broadcast address       - 134.50.59.255
Cisco wildcard          - 0.0.3.255
Addresses in network    - 1024
Network range           - 134.50.56.0 - 134.50.59.255
Usable range            - 134.50.56.1 - 134.50.59.254

The 3rd datagram, with IP address 134.50.52.3, is not within the range of this network, and this is the same for packet n°5.

An interesting reading is Evan answer at How does ipv4 subnetting works.

share|improve this answer
    
Petrus: is there a quick way to calculate the network range? –  Lasse A Karlsen Nov 27 '12 at 21:53
1  
@LasseAKarlsen: it's just a logical AND between address and netmask. Do it manually or with an ip calculator. –  petrus Nov 27 '12 at 22:26

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.