RIP, EIGRP, OSPF, IS-IS, BGP, MPLS, VTP, STP.
User avatar
Carlitos_30
Post Whore
Posts:
1222
Joined:
Mon Feb 08, 2010 9:30 am
Certs:
CCENT, CCNA,CCNP R&S

Ip directed-broadcast

Wed Sep 22, 2010 8:54 pm

I am confused with this command. At first, I thought that this command is used to propagate a broadcast, encapsulated as unicast with the "ip helper-address command", to a layer 2 domain. But I read this:

An IP directed broadcast is an IP packet whose destination address is a valid broadcast address for some IP subnet, but which originates from a node that is not itself part of that destination subnet.

A router that is not directly connected to its destination subnet forwards an IP directed broadcast in the same way it would forward unicast IP packets destined to a host on that subnet. When a directed broadcast packet reaches a router that is directly connected to its destination subnet, that packet is "exploded" as a broadcast on the destination subnet. The destination address in the IP header of the packet is rewritten to the configured IP broadcast address for the subnet, and the packet is sent as a link-layer broadcast.

The ip directed-broadcast interface command controls the explosion of directed broadcasts when they reach their target subnets. The command affects only the final transmission of the directed broadcast on its ultimate destination subnet. It does not affect the transit unicast routing of IP directed broadcasts.

If directed broadcast is enabled for an interface, incoming IP packets whose addresses identify them as directed broadcasts intended for the subnet to which that interface is attached will be exploded as broadcasts on that subnet. If an access list has been configured with the ip directed-broadcast command, only directed broadcasts that are permitted by the access list in question will be forwarded; all other directed broadcasts destined for the interface subnet will be dropped.

If the no ip directed-broadcast command has been configured for an interface, directed broadcasts destined for the subnet to which that interface is attached will be dropped, rather than being broadcast.


It says something about an explosion. What I understand from the text is that without "ip directed-broadcast" command still the broadcast is forwarded to layer 2. The text says that the command controls the explosion, but the explanation to this is very confusing to me. Anyone can explain this please?

Thanks.

User avatar
wirerat
Post Whore
Posts:
5340
Joined:
Tue Mar 31, 2009 4:15 pm
Certs:
More than none

Re: Ip directed-broadcast

Thu Sep 23, 2010 4:53 am

If you have a router with subnet A and subnet B and a workstation on subnet A sends a broadcast out, the router will not route the broadcast onto subnet B. If you want to route that broadcast to subnet B then you put the ip directed-broadcast cmd on the routers subnet B facing interface. It will route the subnet A broadcast packets as if they were unicast packets to subnet B.
Last edited by wirerat on Thu Sep 23, 2010 5:06 am, edited 1 time in total.
"See packet, be packet, you are packet. Ignore all else!" -The Networker
packetsdropped.wordpress.com

User avatar
HighFreak1c
Ultimate Member
Posts:
673
Joined:
Wed Sep 01, 2010 7:14 am
Certs:
CCNA, CCNA Voice, CCNA Security

Re: Ip directed-broadcast

Thu Sep 23, 2010 5:04 am

Study, study, study...
Believe yourself~
Do more than say!
At proper time, try some dumps!
Then succeed belongs to you!!

User avatar
Carlitos_30
Post Whore
Posts:
1222
Joined:
Mon Feb 08, 2010 9:30 am
Certs:
CCENT, CCNA,CCNP R&S

Re: Ip directed-broadcast

Thu Sep 23, 2010 6:59 pm

Thanks. I'm going to make some testing with dynamips and find that explosion that the Cisco document talks.

User avatar
jdsilva
Post Whore
Posts:
5347
Joined:
Mon Jan 17, 2005 11:01 pm
Certs:
CCNP

Re: Ip directed-broadcast

Thu Sep 23, 2010 7:50 pm

Carlitos_30 wrote:Thanks. I'm going to make some testing with dynamips and find that explosion that the Cisco document talks.



The "explosion" that is referred to is a figurative term and not a literal one. You may be let down when you go looking for it.

A directed broadcast is any packet sent to a broadcast address from a remote subnet. However, the thing to keep in mind here is that in terms of the path from the remote subnet to the target subnet only the local router interface on the target subnet knows that it's a broadcast. All other router interfaces in the path do not know, or care, that the packet is a broadcast.

To illustrate:

host A-----router A-----router B------router C-----router D-----host B


Let's say host B is on subnet 192.168.2.0/24.

It doesn't matter what the other subnets are.

Host A send a directed broadcast packet, say a WoL magic packet, to the subnet that host B is on. The destination is 192.168.2.255.

router A receives the packet. Router A routes the packet. Router A has no idea it is a broadcast. This is important. Router a might have a route to 192.168.2.0/24, or it may have a route to 192.168.2.0/23 or it may have a route to 192.0.0.0/8 that it uses to route the packet, but Router A has no way to know for sure that the destination of 192.168.2.255 is a broadcast address. It merely forwards the packet the way it would any other packet. It forwards it as a unicast.

Same for router B. Same for router C.

But... When that packet reach Router D... Router D has a directly connected interface in that subnet. Router D know what the subnet mask is. Router D knows that it's a broadcast. Now, instead of sending the packet on as a unicast, it sends it out on the segment as a broadcast. The biggest implication here is that it's using a layer 2 broadcast address as the destination so that every host will listen to the packet.

This is the "explosion". Routers A, B and C are sending unicast frames while router D sends a broadcast frame.

Not very exciting eh?

By default Cisco routers have directed broadcast disabled. What this means in this example is that by default the packet sent by Host A will still get all the way to router D, but router D will discard the packet because the source of the broadcast is not the same interface as the destination network.

User avatar
Carlitos_30
Post Whore
Posts:
1222
Joined:
Mon Feb 08, 2010 9:30 am
Certs:
CCENT, CCNA,CCNP R&S

Re: Ip directed-broadcast

Thu Sep 23, 2010 8:41 pm

Ohh. I thought that if a broadcast arrives to a router like 192.168.2.255/24, it wouldnt forward if there is not ip helper-address configured. So the router dont use subnet masks when checks the routing table so it routes the packet because it doesnt know that is a broadcast. The router knows a layer 2 broadcast only, unless the packet is directed to one of it interfaces(is this right?).

Broadcasts like this 192.168.2.255/24 are called directed broadcasts?

If the Ip helper-address comand is configured in the router interface, and if for example a DHCP broadcast arrives, the router send the packet to the destination helper-address(a router interface), how the destination router knows that the packet is a DHCP broadcast and must propagate to layer 2? I thought that you should configure the ip directed-broadcast command in that interface.

Wait a moment, if a host send a packet with destination address 192.168.2.255/24, the switch automatically propagate a layer 2 broadcast,right? So the broadcast arrives to the router and this device stop the broadcast by default, so how can route that IP address?
Last edited by Carlitos_30 on Thu Sep 23, 2010 8:52 pm, edited 1 time in total.

User avatar
jdsilva
Post Whore
Posts:
5347
Joined:
Mon Jan 17, 2005 11:01 pm
Certs:
CCNP

Re: Ip directed-broadcast

Thu Sep 23, 2010 8:51 pm

Carlitos_30 wrote:Ohh. I thought that if a broadcast arrives to a router like 192.168.2.255/24, it wouldnt forward if there is not ip helper-address configured. So the router dont use subnet masks when checks the routing table so it routes the packet because it doesnt know that is a broadcast.


Right. Subnet masks are not sent in the IP headers. Only source and destination addresses are sent.

Carlitos_30 wrote:The router knows a layer 2 broadcast only, unless the packet is directed to one of it interfaces(is this right?).


Which router are you referring to? I'm not sure I understand where you went here...

Carlitos_30 wrote:Broadcasts like this 192.168.2.255/24 are called directed broadcasts?


Remember first that a router will not forward a broadcast. Routers create broadcast domains. But, that is only true when the router knows it's a broadcast. There's 2 situations here:

A router has two interfaces:
f0/0 - 10.0.0.1/24
f0/1 - 192.168.2.1/24

situation 1 -- this router receives a packet with a destination address of 192.168.2.255 on interface f0/0. This is a directed broadcast because the broadcast came from a remote subnet. This packet is dropped by default. If ip directed-broadcast is enabled on f0/1 then the router will forward the packet.

situation 2 -- this router receives a packet with a destination address of 192.168.2.255 on interface f0/1. This is a regular broadcast because the broadcast came from the same subnet it is destined for. This packet is processed by the router, but not forwarded under any circumstances.

User avatar
Carlitos_30
Post Whore
Posts:
1222
Joined:
Mon Feb 08, 2010 9:30 am
Certs:
CCENT, CCNA,CCNP R&S

Re: Ip directed-broadcast

Thu Sep 23, 2010 8:53 pm

I edited the last post with a new doubt.

User avatar
Carlitos_30
Post Whore
Posts:
1222
Joined:
Mon Feb 08, 2010 9:30 am
Certs:
CCENT, CCNA,CCNP R&S

Re: Ip directed-broadcast

Thu Sep 23, 2010 9:05 pm

Finally the doubt is when is going to arrive a packet like 192.168.2.255/24 to the router with no layer 2 broadcast. I think if you connect directly a PC to the router it will happen, but with a switch in the middle it won't.

It will happen with the ip helper-address command too.

User avatar
jdsilva
Post Whore
Posts:
5347
Joined:
Mon Jan 17, 2005 11:01 pm
Certs:
CCNP

Re: Ip directed-broadcast

Thu Sep 23, 2010 9:11 pm

Carlitos_30 wrote:Finally the doubt is when is going to arrive a packet like 192.168.2.255/24 to the router with no layer 2 broadcast. I think if you connect directly a PC to the router it will happen, but with a switch in the middle it won't.

It will happen with the ip helper-address command too.


You are confusing things. A router is never going to see "a packet like 192.168.2.255/24" because subnet masks are not sent in an IP packet.

You must understand that part. It's very important to what we are talking about.

And you also need to start thinking along the lines of an interface receiving a packet, not a router. A router can have many interfaces, and which interface a packet arrives on is almost always important to any discussion about routers.

User avatar
Carlitos_30
Post Whore
Posts:
1222
Joined:
Mon Feb 08, 2010 9:30 am
Certs:
CCENT, CCNA,CCNP R&S

Re: Ip directed-broadcast

Thu Sep 23, 2010 9:30 pm

You are confusing things. A router is never going to see "a packet like 192.168.2.255/24" because subnet masks are not sent in an IP packet.


You are right. But suppose that a packet with IP 192.168.2.255 arrives to a switch(there will be no mac entry for this IP, no host will have a source address like that), it will forward the frame to all ports (no the port receiving the frame) and this forwarding will be a broadcast, so the frame arrives to the router interface and the router will stop it and wont look the routing table. I say how that kind of destination address will arrive to a router interface and the router will look the ip routing table to forward the packet. I said it can be possible with the IP helper address command and connecting the PC directly to he router interface. This is the doubt now.


I wrote something wrong above. If the host send a packet with the IP 192.168.2.255 it will need a destination MAC address. But this is a broadcast so I guess that the host puts only Fs as destination MAC, right?

situation 1 -- this router receives a packet with a destination address of 192.168.2.255 on interface f0/0. This is a directed broadcast because the broadcast came from a remote subnet. This packet is dropped by default. If ip directed-broadcast is enabled on f0/1 then the router will forward the packet.


But you just said that the router cant know that is a broadcast with no subnet mask! In this example how the router knows that the IP 192.168.2.255 is a broadcast?

User avatar
jdsilva
Post Whore
Posts:
5347
Joined:
Mon Jan 17, 2005 11:01 pm
Certs:
CCNP

Re: Ip directed-broadcast

Thu Sep 23, 2010 9:58 pm

A switch has absolutely no impact on this discussion. it doesn't matter if there's zero switches, one switch, of 500 million switches. It is of no consequence to this discussion.

However, to alleviate your doubt (question) I'll include the actions a switch takes in my next explanation.

To help out here I just created this diagram to help. Hopefully some pictures will help us out here. I like pictures :)

ip-directed-broadcast.png
ip-directed-broadcast.png (23.55 KiB) Viewed 12033 times


So, let's take what I said before as examples and expand on that.

Infinite wrote:situation 1 -- this router receives a packet with a destination address of 192.168.2.255 on interface f0/0. This is a directed broadcast because the broadcast came from a remote subnet. This packet is dropped by default. If ip directed-broadcast is enabled on f0/1 then the router will forward the packet.


Let's assume that this packet was sent from Host A. Host A's TCP/IP stack doesn't know this is a broadcast. The only thing that Host A knows is that it's an address not on its local subnet. When Host A sends this packet it'll look like:

Source MAC: Host A
Source IP: 10.1.1.2
Destination MAC: Router A F0/0
Destination IP: 192.168.2.255

Router A will receive the packet. Router A does not know 192.168.2.255 is a broadcast (because it does not have an interface in that subnet) so it forwards it as a regular unicast.

Source MAC: Router A f0/1
Source IP: 10.1.1.2
Destination MAC: Router B F0/0
Destination IP: 192.168.2.255

When router B receives the packet it DOES know it's a broadcast because it has an interface in that subnet. If Router B has ip directed-broadcast configured on its F0/1 then it will forward the frame:

Source MAC: Router B F0/1
Source IP: 10.1.1.1
Destination MAC: FFFF:FFFF:FFFF
Destnaion IP: 192.168.2.255

Voila! Directed Broadcast!

If Router B does not have ip directed-broadcast configured on F0/1 then it drops the packet.


Infinite wrote:situation 2 -- this router receives a packet with a destination address of 192.168.2.255 on interface f0/1. This is a regular broadcast because the broadcast came from the same subnet it is destined for. This packet is processed by the router, but not forwarded under any circumstances.


Here let's assume that host D is sending the packet. In this case host D sends:

Source MAC: Host D
Source IP: 192.168.2.2
Destination MAC: FFFF:FFFF:FFFF
Destination IP: 192.168.2.255

Here's where we'll look at your switch question. A switch cannot ever learn what interface MAC FFFF:FFFF:FFFF is connected on so it will always forward this MAC out every port. That's it. Nothing else to say here. It doesn't convert anything, It doesn't change anything. It just forwards it out every interface.

Now, when this packet hits Router B F0/1 it looks at the destination MAC and sees it's a broadcast. It then looks at the destination IP and sees it's a broadcast for that local subnet. Here the router drops the packet. Period. This packet will never be forwarded.

Hopefully that helps!

Quickly, to address your helper-address question... That only works on certain UDP broadcasts. An technically it does not forward those broadcasts, it converts them to a unicast and sends them to a specific host. Helper-addresses ONLY matter in situation 2. Helper addresses have no effect in situation 1.

:)

User avatar
Carlitos_30
Post Whore
Posts:
1222
Joined:
Mon Feb 08, 2010 9:30 am
Certs:
CCENT, CCNA,CCNP R&S

Re: Ip directed-broadcast

Thu Sep 23, 2010 10:09 pm

Ohh. A diagram included.

Source MAC: Host A
Source IP: 10.1.1.2
Destination MAC: Router A F0/0
Destination IP: 192.168.2.255


That cleared the thing.

Thanks for your time.

:thankyou:

PD: I don't want bother you more, but do you know an application that sends that kind of broadcasts(I mean with a broadcast address belonging to another subnet)?

User avatar
jdsilva
Post Whore
Posts:
5347
Joined:
Mon Jan 17, 2005 11:01 pm
Certs:
CCNP

Re: Ip directed-broadcast

Thu Sep 23, 2010 10:31 pm

No problem :)

One example is Wake-on-LAN. Microsoft SCCM server will send a directed broadcast to wake all the hosts up on a target subnet so it can roll out patches or security updates in the middle of the night when users are not working.

User avatar
Carlitos_30
Post Whore
Posts:
1222
Joined:
Mon Feb 08, 2010 9:30 am
Certs:
CCENT, CCNA,CCNP R&S

Re: Ip directed-broadcast

Fri Sep 24, 2010 8:15 am

Thanks!!

:thankyou:

szejiekoh
New Member
Posts:
5
Joined:
Mon Apr 27, 2015 1:32 pm

Re: Ip directed-broadcast

Mon Apr 27, 2015 1:48 pm

jdsilva wrote:Source MAC: Router B F0/1
Source IP: 10.1.1.1
Destination MAC: FFFF:FFFF:FFFF
Destnaion IP: 192.168.2.255


Hi, sorry to revive this thread. I hope jd is still around.

q1) source ip suppose to be 10.1.1.2 ? is it a typo ?
q2) when the remote network receive the broadcast, does/can it reply back to to 10.1.1.2 ? lets say the broadcast is a ping.

Regards,
Noob

szejiekoh
New Member
Posts:
5
Joined:
Mon Apr 27, 2015 1:32 pm

Re: Ip directed-broadcast

Mon Apr 27, 2015 1:56 pm

jdsilva wrote:Source MAC: Router B F0/1
Source IP: 10.1.1.1
Destination MAC: FFFF:FFFF:FFFF
Destnaion IP: 192.168.2.255


Hi, sorry to revive this thread. I hope jd is still around.

q1) source ip suppose to be 10.1.1.2 ? is it a typo ?
q2) when the remote network receive the broadcast, does/can it reply back to to 10.1.1.2 ? lets say the broadcast is a ping.

Regards,
Noob

'

Return to Cisco Routing and Switching

Who is online

Users browsing this forum: Yahoo [Bot] and 106 guests