11-20-2013 03:19 AM - edited 03-04-2019 09:37 PM
I want to know what subnet masks do routers apply when receiving updates and forwarding packets to destination network.
How router calculate the destination network when many of the same class network address is present but with different subnet masks.
And why router behaves differently when they have two different interfaces configured with two subnet mask but of same major network.
Case is like this
Router-A
Int fa0/0 172.16.0.0/16
Int fa0/1 172.17.0.0/17
int fa0/2 172.18.0.0/24
int s0/0 172.15.0.1/16
Router-B (Connected to Router-A)
int s0/0 172.15.0.2/16
int fa0/0
int fa0/1
and so on
When we enable RIP v1 on Router-A, what are the routers behavior when they get other RIP updates from other routers
What subnet mask they apply to forward the packets to destination network
What does it mean that.
If the router has a directly connected interface belonging to the same
If the router does not have any interfaces belonging to the same major network, it will apply the classful
subnet mask to the route.
Refer to attachment with this post to get the Bold point above
11-20-2013 03:56 AM
Hello Vishal,
a classful routing protocol like RIPv1 does not carry subnet mask in routing updates, so the receiving router has to make some assumptions on received routes.
If the update is sent to a router that has no interface connected to the same major network (Class A,B,C) it will consider the received route as representing the whole major network and will use the corresponding major network mask to build its own routing entry to be put in the IP routing table.
If instead the router has an interface connected to the same major network with a subnet mask for example of /24 that subnet mask will be applied to received update.
In your example RB will install networks
172.16.0.0/16
172.17.0.0/16
172.18.0.0/16
if RB other interfaces are in different major networks.
if RB fas0/1 has ip address 172.18.25.0/24, the routing update will lead to route 172.18.0.0/24 in RB routing table.
note: RIPV1 supports only fixed length subnet mask within a single major network.= a single subnet mask must be used everywhere including WAN links
Another aspect is classless behaviour versus classful in the routing table as explained in the paper you have attached.
Hope to help
Giuseppe
11-20-2013 11:42 PM
Giuseppe
Good explanation.
And what if router has two or more interface but with different subnet mask, then what mask it will apply to the received route
Can you provide detailed example using packet tracer or so.
I need one practical explanation for all these.
Help me
11-20-2013 04:23 AM
Vishal
I'm not sure whch bit of the attached document you are not understanding. Let me try and rephrase it -
Before classless IP addressing networks were broken down into major networks and subnets of major networks. So the major networks were -
class A networks - 0.0.0.0/8 to 127.0.0.0/8
class B networks - 128.0.0.0/16 to 191.255.0.0/16
class C networks - 192.0.0.0/24 to 223.255.255.0/24
/8 = 255.0.0.0 = the classful mask for a class A network
/16 = 255.255.0.0 = classful for class B network
/24 = 255.255.255.0 - classful for class C network
as an example lets use 172.16.10.10 as the IP. Now without the subnet mask can you tell me what is the network portion and what is the host portion ?
The answer is you can't know because it could be -
172.16.10.10 255.255.0.0 in which case the network is 172.16 and the host is 10.10
or
172.16.10.10 255.255.255.0 in which case the network is 172.16.10 and the host is .10
or any number of other variations. This is the problem a RIPv1 router has. Because it does not receive a subnet mask with the routing update how does it know what the network is. So it has to work out the network part without a subnet mask. So the router receives the above routing update for 172.16.10.0 -
1) If the router has interface configured for the same major network it uses that subnet mask. So if it has an interface configured with 172.16.12.1 and the subnet mask is 255.255.255.0 then it assumes the subnet mask for 172.16.10.0 is also 255.255.255.0 because they both have the same major network ie. 172.16.0.0/16. In fact any routing update containing a 172.16.x.x update will be assumed to have a 255.255.255.0 subnet mask. This is why it is very important in classful networks to have consistent subnets.
2) If the router does not have an interface in the same major network then as you can hopefully see from the above it has no way of knowing which is the network part and which is the host so it simply uses the major network mask. So if it received a routing update for 172.17.10.0 it simply applies the classful mask for the major network which is /16 or 255.255.0.0
So RIPv1 and IGRP are both classful routing protocols and will behave as described above. Classless routing protocols do send the subnet mask in their updates and so the above is not an issue and you do not need to use a consistent mask throughout your network which has big advantages when designing an IP addressing scheme.
Also worth mentioning is that when talking about classful and classless there are 2 separate issues -
1) The routing protocol in terms of whether it is classful or classless and how it behaves - covered above
2) Forwarding of the packets by the router can either be classful or classless - not covered.
Jon
11-20-2013 09:22 AM
Jon
If you don't mind frankly speaking I know the theory behind that, but I did not know why I am making myself so confused that despite knowing the rule I can't figure out the reason.
Can you provide a demonstration of that either through Packet tracer or other way you find better.
Really I am well Ok with theory but lacking practical of that since I am alone in this field without any help from others.
Please help as I want to be confident of routing portion.
Also can you please explain with example
Why router need the longest matching rules for locating networks and forwarding packets
Any help is always appreciated
Thanks
11-20-2013 09:43 AM
Vishal
I don't have PT so it's a bit difficult to do. I did have GNS3 but not anymore. Can you explain exactly where the problem is with your understanding. When you say you can't figure out the reason what do you mean exactly ?
As for your other question - why does a router use the longest match. Lets say a packet comes int a router with a destination IP address of 172.16.10.x
In the routers table are the following route entries -
172.16.0.0 255.255.0.0 192.168.10.1 <--- covers all 172.16.x.x network so it matches
172.16.0.0 255.255.240.0 192.169.5.1 <--- covers subnets 172.16.0.0/24 -> 172.16.15.0/24 so again it matches
172.16.10.0 255.255.248.0 192.170.6.1 <--- matches the actual subnet
as you can see each route in the table has a different next hop ie. they point to different routers. So which should the router use because all 3 entries match the packet. It uses the longest match because this the most precise information. If it used either of the other entries it would be sent to a different next hop and it may or may not get to the correct destination.
Note that i am not saying the above is good network/IP design, it is purely used as an example
Jon
11-20-2013 10:06 AM
Hi Jon
Well perfect try by you to help me.
Can you be more elaborate.
What does it mean by <-- and -> in following line.
172.16.0.0 255.255.240.0 192.169.5.1 <--- covers subnets 172.16.0.0/24 -> 172.16.15.0/24 so again it matches
in your example.
Mask shown above as of 255.255.240.0 which equates to /20 mask can cover 172.16.15.0/24. Bit confusing your example now.
As again I know the theory but need one example from you people. Theory explains that a mask can overlap other networks, for example, by means of route summarization. If you create wrong route summarization you can account for other network which actually is not pointed by your router indeed..Thus wrong reachability to destination. Any how?
Please rescue me.
Can you provide router output from GNS or bit simple example. Even simple example can do for me.
11-20-2013 10:21 AM
I can't provide outputs because i don't have GNS3 anymore. Perhaps someone else could help with that but i recommend trying to get it yourself. You seem to understand the theory and even if someone did provide outputs that is still only something else for you to read. A lot of these things only make sense when you try them out yourself with a lab setup and then you see the theory work in practice.
172.16.0.0 255.255.240.0 is a way of representing a number of subnets with the one mask. So
172.16.0.0 255.255.240.0 actually represents -
172.16.0.0 255.255.255.0
172.16.1.0 255.255.255.0
172.16.2.0 255.255.255.0
.....
172.16.15.0 255.255.255.0
Does the above make sense ? If not then you need to look into subnetting as well.
Jon
11-20-2013 11:11 PM
Hi Jon
Thanks for so much of support
Your answer's part
Also worth mentioning is that when talking about classful and classless there are 2 separate issues -
1) The routing protocol in terms of whether it is classful or classless and how it behaves - covered above
2) Forwarding of the packets by the router can either be classful or classless - not covered.
I got the 1) point and
Out of which point 2) is not explained by you.
I am getting thing with auto-summarization as you explained.
Can you elaborate point 2)
11-21-2013 03:18 AM
Vishal
When a any router receives a packet it first checks to see if the destination IP is for one of it's own interfaces. If it isn't then a classful router would use the following process is -
1) First check the destination against the major network. If there is a match and there are no subnets for that major network in the routing table use that route entry.
2) If there is no match for the major network and you have a default then use that.
3) If there is no match and no default send an ICMP unreachable back to the source.
4) If there is a match and there are subnets of the major network see if any of those entries match. If there is a match then use that.
5) If there is no match of any subnets of the major network then send an ICMP unreachable back the source. This is important because even if there is a default it won't be used because the router assumes it knows about all the subnets of the major network.
An example might help. The following is a route table on a RIP router. The first 2 routes are learnt from RIP neighbors. The 3rd is for a directly connected interface and the 4th is static default route. Note the table wouldn't look exactly like a RIP routing table but this is just an example -
R 172.17.0.0 255.255.0.0 192.168.5.1
R 172.16.4.0 255.255.255.0 192.168.6.1
C 172.16.5.0 255.255.255.0 192.168.7.1
S 0.0.0.0 0.0.0.0 192.168.8.1
172.17.10.1 <-- this matches 1) ie. the major network 172.17.0.0 matches and there are no subnets configured so it is sent to 192.168.5.1
172.20.11.1 <- matches 2) -> 192.168.8.1 - the major network here being 172.20.0.0/16
172.16.4.1 <-- matches 4) -> 192.168.6.1
172.16.3.1 <-- matches 5) - remember that first the major network is checked. Here it is 172.16.0.0 255.255.0.0. There are subnets in the table for this major network ie. 172.16.4.0/24 and 172.16.5.0/24. Because of this the router assumes it knows all subnets for 172.16.0.0/16 and because it can't find a match it sends an ICMP unreachable back to the source ie. it does not use the default.
When a classless router does a route lookup it simply looks for the longest match with no regard to major networks. If it can't find a more specific it will happily use the default route.
Note that a router using a classful routing protocol such as RIPv1 can still use classless forwarding. The two things are separate. Classless forwarding is the default on L3 devices but on older IOS versions you needed to explicitly enable classless forwarding with commmand
ip classless
Jon
11-21-2013 06:10 AM
Jon
I have one problem with whatever facts you have stated in the very first reply to me
In that you specified two points
1) If the router has interface configured for the same major network it uses that subnet mask. So if it has an interface configured with 172.16.12.1 and the subnet mask is 255.255.255.0 then it assumes the subnet mask for 172.16.10.0 is also 255.255.255.0 because they both have the same major network ie. 172.16.0.0/16. In fact any routing update containing a 172.16.x.x update will be assumed to have a 255.255.255.0 subnet mask. This is why it is very important in classful networks to have consistent subnets.
2) If the router does not have an interface in the same major network then as you can hopefully see from the above it has no way of knowing which is the network part and which is the host so it simply uses the major network mask. So if it received a routing update for 172.17.10.0 it simply applies the classful mask for the major network which is /16 or 255.255.0.0
Now please tell me when the router has already configured interface for some class of network and it receives the update from neighboring routers of the same major class.
As per the rule the router will ignore the update of the same major class in which it has interface and
when there is no interface of that class it will accept the route and apply default subnet mask of that particular class.
The point, when routers ignores update when received update matches the class of address bind in its one interface
and
when will it actually update its route table considering the fact that "when it doesn't have any particular class of network, it apply default subnet mask of that respective network"
has made me totally confused.
Despite so many attempt by you to make me understand seems like I am fool.
But really sometimes those simple things I usually make so complex that it depresses me.
Please help me out of this situation.
11-21-2013 11:44 AM
As per the rule the router will ignore the update of the same major class in which it has interface and
when there is no interface of that class it will accept the route and apply default subnet mask of that particular class
You may be getting confused between classful routing and classful forwarding.
If a router has an interface with an IP of 172.16.5.1 255.255.255.0 then it assumes that any updates it receives with the same major network are also subnetted using a 255.255.255.0 subnet mask. The major network here is 172.16.0.0 255.255.0.0 so any update with the first two octets of 172.16. are assumed to have a subnet mask of 255.255.255.0. These will be entered into the routing table using that subnet mask.
If the router receives a route for which is has no subnets of the major network then it simply enters the major network into the routing table and applies the classful subnet mask.
Jon
11-21-2013 07:25 PM
Jon
Problem is that I am familiar with the rules but I am unable to implement. As I am trying but the result makes me confused.
For example I am writing the router's show ip route commands as shown below
Router-A show ip route
------------------------------------------------------------------------------------
10.0.0.0/16 is subnetted, 4 subnets
C 10.1.0.0 is directly connected, FastEthernet0/0
R 10.2.0.0 [120/2] via 10.3.5.2, 00:00:19, Serial0/0
C 10.3.0.0 is directly connected, Serial0/0
R 10.4.0.0 [120/1] via 10.3.5.2, 00:00:19, Serial0/0
Router-B show ip route
------------------------------------------------------------------------------------
10.0.0.0/16 is subnetted, 4 subnets
R 10.1.0.0 [120/1] via 10.3.5.1, 00:00:00, Serial0/0
R 10.2.0.0 [120/1] via 10.4.5.1, 00:00:09, Serial0/1
C 10.3.0.0 is directly connected, Serial0/0
C 10.4.0.0 is directly connected, Serial0/1
Router-C show ip route
------------------------------------------------------------------------------------
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
R 10.1.0.0/16 [120/2] via 10.4.5.2, 00:00:19, Serial0/0
C 10.2.0.0/16 is directly connected, FastEthernet0/0
R 10.3.0.0/16 [120/1] via 10.4.5.2, 00:00:19, Serial0/0
C 10.4.0.0/16 is directly connected, Serial0/0
C 10.6.6.0/24 is directly connected, FastEthernet0/1
Router-B debug ip rip
**********************************************************************
Router#debug ip rip
RIP protocol debugging is on
Router#RIP: received v1 update from 10.3.5.1 on Serial0/0
10.1.0.0 in 1 hops
RIP: received v1 update from 10.4.5.1 on Serial0/1
10.2.0.0 in 1 hops
RIP: sending v1 update to 255.255.255.255 via Serial0/1 (10.4.5.2)
RIP: build update entries
network 10.1.0.0 metric 2
network 10.3.0.0 metric 1
RIP: sending v1 update to 255.255.255.255 via Serial0/0 (10.3.5.2)
RIP: build update entries
network 10.2.0.0 metric 2
network 10.4.0.0 metric 1
RIP: received v1 update from 10.3.5.1 on Serial0/0
10.1.0.0 in 1 hops
RIP: received v1 update from 10.4.5.1 on Serial0/1
10.2.0.0 in 1 hops
RIP: sending v1 update to 255.255.255.255 via Serial0/1 (10.4.5.2)
RIP: build update entries
network 10.1.0.0 metric 2
network 10.3.0.0 metric 1
RIP: sending v1 update to 255.255.255.255 via Serial0/0 (10.3.5.2)
RIP: build update entries
network 10.2.0.0 metric 2
network 10.4.0.0 metric 1
RIP: received v1 update from 10.3.5.1 on Serial0/0
10.1.0.0 in 1 hops
**********************************************************************
When I checked the Router-B's DEBUG IP RIP output
It doesn't shows off route in debug ip rip output, when I am using /24 mask in 10.6.6.0 for Router-Cs int fa0/1
But when I used /16 mask with 10.6.6.0 then debug ip rip command output on Router-B shows the advertisement.
I could not understand why with /24 mask the route is not advertised and with /16 mask it shows and possible to ping that 10.6.6.1 address
Now tell me since flat network design is implemented with /16 mask all over the network but for my understanding I am using /24 in Router-C's int fa0/1.
to see the effect of with what mask the 10.6.6.0 network is advertised or not advertised.
And as per rule either is should be displayed with /16 mask since other routers has /16 mask configured
and
secondly if other router has not any interface in that 10 network it should show with /8 mask that is Classful network boundary
As per the rule the 10.6.6.0 should be advertised with /16 mask but what confusing me is that it is not been shown anywhere in the network except Router-C where it is configured.
Message was edited by: Vishal Singh
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide