cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
309
Views
10
Helpful
13
Replies
Beginner

how a router route a directed broadcast packet to another subnet

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.

13 REPLIES 13
VIP Expert

Re: how a router route a directed broadcast packet to another subnet

I suspect the ping reply from R2 is 10.10.10.1 because it's the "closest" (router) host's interface IP to the (R3) destination (even though it was a 10.10.20.x IP that received the ping request).

I'm not 100% sure, but if you also telnet to R2's R4 side interface IP from R3, you might find the reply packets also coming from R2's R3 side interface IP.

Since R3 as a host is multi-homed, unsure there's any IP requirement that requires the host to respond from the interface that received a packet when another host interface appears to be a better path to the destination.
Beginner

Re: how a router route a directed broadcast packet to another subnet

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.

VIP Expert

Re: how a router route a directed broadcast packet to another subnet

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 . . ."

Yes, but unclear what point you're trying to make.

". . . there is no need for choosing the "cloest" interface.this is so weird."

Sure, for one, it's a bit more efficient.
Beginner

Re: how a router route a directed broadcast packet to another subnet

Sorry for the indeterminate point I made,I think I should insert a picture here:

 

无标题.jpg

 

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?

VIP Expert

Re: how a router route a directed broadcast packet to another subnet

Because R2 is both a router and a host!

Since R2's f0/0 accepts directed broadcasts, it forwards the ping to 10.10.20.0/24 network.

Since R2, as a host, has an IP on the 10.10.20.0/24 network, it replies to the ping. Since R2's f0/0 is "closer" to the reply destination, it replies using that interface's IP.

What I'm curious about is how is R4's f0/0 configured, as it too should respond to the broadcast ping.

You mention R2's f0/1 has disabled directed broadcast, that's fine because that interface didn't receive a directed broadcast to forward (again, logically, the host at 10.10.20.1 received the broadcast ping).
Beginner

Re: how a router route a directed broadcast packet to another subnet

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?

VIP Expert

Re: how a router route a directed broadcast packet to another subnet

Probably a Cisco implementation quirk. With unicast, since you ping a specific IP, the multi-homed host responds using that IP. For the broadcast, the router responds with the "closer" interface IP. (It would probably be "better" if the router responded with an IP of the interface that "logically" received the broadcast, like it does for unicast.")
Hall of Fame Master

Re: how a router route a directed broadcast packet to another subnet

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

Beginner

Re: how a router route a directed broadcast packet to another subnet

"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?

Hall of Fame Master

Re: how a router route a directed broadcast packet to another subnet

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

Beginner

Re: how a router route a directed broadcast packet to another subnet

"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.

VIP Expert

Re: how a router route a directed broadcast packet to another subnet

"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."

To expand on Rick's statement, technically if the router has the prefix length of the destination network, in theory, the router should be able to recognize whether the destination IP is a network broadcast. However, that assumes the router knows the network prefix and its length is the actual network address for the destination network and not some form of summary. So, since kind of prefix is unknown, except by the (end/terminal) router with the actual network connection, routers would forward the packet.
Highlighted
Hall of Fame Master

Re: how a router route a directed broadcast packet to another subnet

@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

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards