简体   繁体   中英

CIDR entries and routing tables

I have a question which asks the following:

Suppose a router has the following CIDR entries in its routing table:

 Net/Prefix Next Hop 128.96.39.0/24 Interface 0 128.96.39.128/25 Interface 1 128.96.40.0/25 Router 2 192.4.153.0/26 Router 3 default Router 4 

For each of the following IP addresses, what does the router do if a packet with that address arrives?

  1. 128.96.39.10;
  2. 128.96.40.12;
  3. 128.96.39.151;
  4. 192.4.153.17;
  5. 192.4.153.90.

I know that /24 means that 24 bits are assigned to the network address meaning that 8 bits are assigned to hosts. How do I get the subnet mask from the IP address represented in decimal and then from there determine where the IP would go?

Well, the most specific subnet is always used first:

/25 is more specific then /24. In your example, this would mean:

  1. interface 0
  2. Router 2
  3. interface 1
  4. Router 3
  5. Router 4

The Router takes the route with the longest fitting subnet mask.

(i) interface 0 (ii) Router 2 (iii) interface 1 (iv) Router 3 (v) Router 4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM