09-03-2019 03:27 AM
topology:
R3---R2---R4
R3 and left interface of R2 in 10.10.10.0/24;
R4 and right interface of R2 in 10.10.20.0/24 subnet.
when R3 ping 10.10.20.255,it receives a reply from 10.10.10.1 which is R2's interface in 10.10.10.0/24 subnet. why?
In my opinion,10.10.20.255 is another subnet's broadcast address and R2 will either drop it or route it(when ip directed broadcast is enabled),but 10.10.10.1 should not respond it because dest address is 10.10.20.255.
09-03-2019 10:48 AM
09-03-2019 06:47 PM
I think interfaces in a router are seperate.if a packet is for you,you accept it,if it isn't for you,you ignore it,there is no need for choosing the "cloest" interface.this is so weird.
09-04-2019 09:38 AM
09-04-2019 06:44 PM
Sorry for the indeterminate point I made,I think I should insert a picture here:
In my opinion:
1.As an interface on router,the interface should either route the packet it receives or ignore it.
2.When an interface receives a broadcast of another subnet,if "ip directed-broadcast" is enabled on the out interface,then the router should route the broadcast packet,if directed-broadcast is disabled,the router should ignore the broadcast.
So here,R3(10.10.10.2) sends a directed broadcast to R2 F0/0,the broadcast address is 10.10.20.255,not 10.10.10.255!
When R2 receives the broadcast packet,it should route it to F0/1,however "ip directed-broadcast" is disabled on F0/1,so R2 should discard the broadcast packet.
BUT now,when R3 ping 10.10.20.255,it receives a reply from 10.10.10.1.This is what confuses me:the broadcast is 10.10.20.255,it belongs to another subnet,why R2 F0/0 replies it?
09-05-2019 09:27 AM
09-05-2019 06:54 PM
em...I think I get the point "A router can have many interfaces,when the router receives a packet,if the packet is for one of this router's interfaces,then the router should choose a closer interface to reply the packet",right?
But how to explain what happend when "R3 ping R2's F0/1, 10.10.20.1 reply the ping,not the closer interface 10.10.10.1 reply the ping".the only difference is in this scenario R3 uses a unicast,not broadcast.
The so-called "closer interface choosing" only happens when the packet is a broadcast?
09-06-2019 07:37 AM
09-05-2019 10:13 AM
There are several aspects of this which deserve some comment. First your point 2 is not correct. The router forwarding the original packet and all routers along the path do not know whether the packet they are forwarding is a directed broadcast or not. So it does not make any difference whether directed broadcast is enabled on them or not. The only router where it matters whether directed broadcast is enabled or not is the router where that subnet is connected.
Also it is not possible to look at an address and know whether it is a directed broadcast. 10.10.20.255 might or might not be a directed broadcast. To determine that you need to know the mask of the subnet and only the router where it is connected knows the mask. For example if the address on the router was ip address 10.10.20.1 255.2.55.254.0 then 10.10.20.255 is not a directed broadcast but is a host address in that subnet.
So in your original post the left side router sends the ping to the directed broadcast address. The middle router receives the ping to the directed broadcast address and since it has an interface in that subnet it processes the ping request and prepares a ping response. In preparing the ping response it must choose which interface it will use to send the response and it chooses its left side interface. Having chosen the left side interface it will then use the IP address of that interface as the source address of the ping response.
HTH
Rick
09-05-2019 06:59 PM
"In preparing the ping response it must choose which interface it will use to send the response and it chooses its left side interface. ",the "interface choosing" only happens when the packet is a broadcast?
if the destination address is 10.10.20.1,not 10.10.20.255,then R2 F0/1 will be the chosen one to reply.how a router decide which interface to use?
09-06-2019 06:41 AM
It is not correct that this interface choosing is used only when the packet is a broadcast. This interface choosing (and using the IP address of the interface as the source address of the packet) is used for any IP packet generated from the router itself (and is not used for packets being forwarded by the router).
I do not understand the later part of your response. The same choice would be made no matter whether the destination was 10.10.20.1 or was 10.10.20.255 (assuming that we are not dealing with subnets smaller than /24). Essentially the router makes its choice by considering the routing table and choosing the best route to reach that destination. Part of that best routing entry will identify which interface to use (as well as identifying the next hop address).
HTH
Rick
09-06-2019 09:09 AM
"The same choice would be made no matter whether the destination was 10.10.20.1 or was 10.10.20.255 . Essentially the router makes its choice by considering the routing table" This is the confusing point,there are two ways available:
1.use ping echo packet's destination address to reply the ping.if we consider this way:
1)when ping 10.10.20.1,then router2 use 10.10.20.1 as the reply's source address;
2)when ping 10.10.20.255,then every hosts(or every interface card) in 10.10.20.0/24 subnet reply the ping using its own address,router2's f0/1 is one of 10.10.20.0/24,so router2 should still use 10.10.20.1 to reply.
2.use the interface that in the routing table which is closer to ping echo packet's source address to reply the ping.if we consider this way:
1)when ping 10.10.20.255,then use 10.10.10.1 to reply because router2's f0/0 is closer to router3.
2)when ping 10.10.20.1,then router2 should still use 10.10.10.1 to reply because it's also closer.
However the expriment output shows that router2 treat 10.10.20.1 and 10.10.20.255 differently.
09-06-2019 07:31 AM
09-06-2019 08:00 AM
@Joseph W. Doherty makes an interesting point that routers along the path do have routing table entries with associated masks. And it might seem reasonable that this would allow the routers along the path to determine whether a packet was a directed broadcast or not. But we do not know whether the mask in the routing table entry really matches the destination subnet mask or not. So routers along the path do not try to determine whether a packet is a directed broadcast or not. The only router that cares about determining whether a packet is a directed broadcast or not is the router where the destination subnet is a connected subnet.
HTH
Rick
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