Routers normally don’t forward any broadcast traffic that they receive on an interface on any other interfaces. There are however some exceptions to this rule.
When it comes to IP broadcasting, there are two types:
- The special “this network” broadcast address 255.255.255.255. This can be used to reach all devices within the subnet.
- The subnet broadcast address. For example 192.168.1.255/24 (last IP address in the subnet).
The subnet broadcast address is also called the IP directed broadcast. It’s the broadcast address of a specific subnet. When you try to send something to the broadcast address of another subnet, the router will drop it. This is however something we can change…
Let’s look at an example:
Above we have three routers, R1 is sending an IP packet with its own address as the source and the destination address is the broadcast address of subnet 192.168.23.255. When R2 receives this packet, it will not broadcast it on its FastEthernet0/1 interface.
Let’s configure these routers so we can debug this IP packet. I’ll also show you how to configure R2 so that it will forward the broadcast.
R1 and R3 have a default route so they can reach each other:
R1(config-if)#ip route 0.0.0.0 0.0.0.0 192.168.12.2
R3(config-if)#ip route 0.0.0.0 0.0.0.0 192.168.23.2
Before we send any packets, let’s enable IP packet debugging on all routers:
R1, R2 & R3
#debug ip packet
IP packet debugging is on
Let’s send that packet from R1:
R1#ping 192.168.23.255
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.23.255, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms
It seems R1 is receiving a reply to its packet. Here’s the packet that R1 sent:
R1#
IP: s=192.168.12.1 (local), d=192.168.23.255 (FastEthernet0/0), len 100, sending
And here’s the reply that it receives:
R1#
s=192.168.12.2 (FastEthernet0/0), d=192.168.12.1 (FastEthernet0/0), len 100, rcvd 3
As you can see above, R2 is replying to this packet that R1 sent. We are not getting a reply from R3 however. This is because R2 is not forwarding the broadcast which we can verify with the following command:
R2#show ip interface FastEthernet 0/1 | include broadcast
Directed broadcast forwarding is disabled
Directed broadcast forwarding is disabled by default on all interfaces. Let’s enable it:
R2(config)#interface FastEthernet 0/1
R2(config-if)#ip directed-broadcast
Let’s send another ping from R1:
R1#ping 192.168.23.255 repeat 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 192.168.23.255, timeout is 2 seconds:
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 8/8/8 ms
Here’s the packet again that is sent by R1:
R1#
IP: s=192.168.12.1 (local), d=192.168.23.255 (FastEthernet0/0), len 100, sending
Here’s what R2 will do once it receives the packet:
R2#
IP: tableid=0, s=192.168.12.1 (FastEthernet0/0), d=192.168.23.255 (FastEthernet0/1), routed via RIB
IP: s=192.168.12.1 (FastEthernet0/0), d=192.168.23.255 (FastEthernet0/1), g=255.255.255.255, len 100, forward directed broadcast
IP: s=192.168.12.1 (FastEthernet0/0), d=255.255.255.255 (FastEthernet0/1), len 100, sending full packet
Once R2 receives the IP packet from R1, it forwards it as a broadcast on its FastEthernet0/1 interface. The destination address is changed to 255.255.255.255.
Here’s what happens when R3 receives it:
R3#
IP: s=192.168.12.1 (FastEthernet0/0), d=255.255.255.255, len 100, rcvd 2
IP: s=192.168.23.3 (local), d=192.168.12.1 (FastEthernet0/0), len 100, sending
R3 receives the packet and decides to reply to it. R1 now receives two replies:
R1#
IP: s=192.168.12.2 (FastEthernet0/0), d=192.168.12.1 (FastEthernet0/0), len 100, rcvd 3
IP: s=192.168.23.3 (FastEthernet0/0), d=192.168.12.1 (FastEthernet0/0), len 100, rcvd 3
Excellent, our broadcast IP packet is now forwarded. If we want, we could change the broadcast address however. Right now R2 is changing the destination to 255.255.255.255 but we can also use the subnet broadcast address. Let’s try it:
Great video! in which scenario would you ever use this feature?
Hi Tae Wo K,
Perhaps for some old legacy application that only uses broadcast traffic. It’s unlikely that you would need this nowadays.
Rene
Hi,
Just to double check, but the
no ip directed-broadcast
only applies to the subnet on the interface the command is used, and it does not stop directed broadcasts for subnets on down stream routers that are in the routing table - correct?Thanks,
Sam
Hello Samir
By default, a router will not forward any directed-broadcast packets out of any of its interfaces. Take a look at this diagram once again:
https://cdn-forum.networklessons.com/uploads/default/original/2X/9/9d2caca51951cc3781c2e72a445fedd7b2dc9327.png
Imagine there is another router R4 connected to R3, with a subnet of 192.168.34.0/24. If R1 sends a ping to 192.168.34.255, R2 will not let it pass but will respond itself. In other words, it would behave in exactly the same way as with a ping to 192.168.23.0/24.
Now remember that the
... Continue reading in our forumno ip directed-
Hi Lazaros,
Thanks for the response.
In that case, what if the subnet between R3-R4 were 10.0.0.0/24 and R2 contained only a default route. How would R2 know that 10.0.0.255 was an ip directed broadcast?
Basically, I’m trying to understand the criteria the router uses to determine when a destination IP is a directed broadcast if the network is not directly connected.
Thanks,
Sam