The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Where do packets sent to 255.255.255.255 go?
@ 2005-08-25  1:02 Daniel Brockman
  2005-08-25  8:17 ` Eric Piel
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Brockman @ 2005-08-25  1:02 UTC (permalink / raw)
  To: linux-kernel

Hi list,

If I understand correctly, packets sent to the all-ones
broadcast address only go out through a single interface.

My question is threefold:

 1. Why doesn't Linux send 255.255.255.255 packages through
    all network interfaces?  (I realize that this is
    probably not a Linux-specific question.)

 2. How does it choose which interface to send through?
    My first guess was that it just took the first Ethernet
    interface and used that for broadcasting.  But playing
    around with nameif, this seems not to be the case.

 3. Can I set the default broadcast interface explicitly?
    For example, say I wanted broadcasts to go out over eth1
    by default, instead of over eth0.  What if I wanted them
    to get sent through tap0?

Yes, I know that what I *should* be doing is just send the
packages to the broadcast address specific to the network
where I want them to go.  (That is, I should be sending them
to 10.255.255.255 instead of 255.255.255.255 if I want them
to be broadcast to the 10.0.0.0 network.)

Unfortunately, this is not a viable option in my case, as
I'm dealing with a closed-source application that
unconditionally sends broadcasts to 255.255.255.255.
Ideally, the application would let me choose which interface
to broadcast to, but alas it does not.

I've tried searching for a solution to this problem on the
web and on IRC with no luck, so now I'm turning to you guys.


Thanks in advance,

-- 
Daniel Brockman <daniel@brockman.se>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Where do packets sent to 255.255.255.255 go?
  2005-08-25  1:02 Where do packets sent to 255.255.255.255 go? Daniel Brockman
@ 2005-08-25  8:17 ` Eric Piel
  2005-08-25 10:01   ` Daniel Brockman
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Piel @ 2005-08-25  8:17 UTC (permalink / raw)
  To: Daniel Brockman; +Cc: linux-kernel

25.08.2005 03:02, Daniel Brockman wrote/a écrit:
> Hi list,
> 
> If I understand correctly, packets sent to the all-ones
> broadcast address only go out through a single interface.
Hello,

I have some blur memories about this kind of issue, so my answer my be 
wrong on some points...

> 
> My question is threefold:
> 
>  1. Why doesn't Linux send 255.255.255.255 packages through
>     all network interfaces?  (I realize that this is
>     probably not a Linux-specific question.)
IIRC, Linux 255.255.255.255 as a normal IP address. Therefore it will 
follow the route for such an address and select the interface it is 
associated (probably eth0 if you are on a LAN).

> 
>  2. How does it choose which interface to send through?
>     My first guess was that it just took the first Ethernet
>     interface and used that for broadcasting.  But playing
>     around with nameif, this seems not to be the case.
cf 1

> 
>  3. Can I set the default broadcast interface explicitly?
>     For example, say I wanted broadcasts to go out over eth1
>     by default, instead of over eth0.  What if I wanted them
>     to get sent through tap0?
Again, I'm not sure, but I think that you can force the interface by 
adding a special route for IP 255.255.255.255 and with mask 
255.255.255.255 to the interface you want.


[sniped]

Hope this help, even if my memory is a bit confused,
Eric


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Where do packets sent to 255.255.255.255 go?
  2005-08-25  8:17 ` Eric Piel
@ 2005-08-25 10:01   ` Daniel Brockman
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Brockman @ 2005-08-25 10:01 UTC (permalink / raw)
  To: linux-kernel

Hi Eric,

>> If I understand correctly, packets sent to the all-ones
>> broadcast address only go out through a single interface.
>
> I have some blur memories about this kind of issue, so my
> answer my be wrong on some points...

It turns out you are exactly right on all points. :-)

>> My question is threefold:
>>
>>  1. Why doesn't Linux send 255.255.255.255 packages
>>     through all network interfaces?  (I realize that
>>     this is probably not a Linux-specific question.)
>
> IIRC, Linux treats 255.255.255.255 as a normal IP address.
> Therefore it will follow the route for such an address and
> select the interface it is associated (probably eth0 if
> you are on a LAN).

That makes a lot of sense, and it appears to be the case.

>>  2. How does it choose which interface to send through?
>>     My first guess was that it just took the first
>>     Ethernet interface and used that for broadcasting.
>>     But playing around with nameif, this seems not to
>>     be the case.
>
> cf 1
>
>>  3. Can I set the default broadcast interface explicitly?
>>     For example, say I wanted broadcasts to go out over
>>     eth1 by default, instead of over eth0.  What if I
>>     wanted them to get sent through tap0?
>
> Again, I'm not sure, but I think that you can force the
> interface by adding a special route for IP 255.255.255.255
> and with mask 255.255.255.255 to the interface you want.

Yes, this works!  It's so simple --- I can't believe I
didn't try it before.  I did mess around with iptables,
trying to add some weird PREROUTEing DNAT that would
redirect the packets, but I didn't know what I was doing.

> Hope this help, even if my memory is a bit confused,

Yes, it did help.  Thanks a bunch, Eric!  Your memory seems
to be in great shape. :-)


Regards,

-- 
Daniel Brockman <daniel@brockman.se>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Where do packets sent to 255.255.255.255 go?
  2005-09-19  5:35 PATCH: Fix race in cpu_down (hotplug cpu) Nigel Cunningham
@ 2005-09-19  7:43 ` Wei-Che, Hsu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei-Che, Hsu @ 2005-09-19  7:43 UTC (permalink / raw)
  To: 'Linux Kernel Mailing List'

Dear sir,

I have the same question recently & found a solution on the following url.
http://www.uwsg.iu.edu/hypermail/linux/kernel/0508.3/0397.html
& trace to this mailing list.

I had added a 255.255.255.255 route to a specific interface(eth0).
But seems no luck.
The broadcast package still go out via default gateway(eth1).
(detail "route -n" will be attached on the tail of this mail.)

Does anyone have any idea about it?
Should I enable something on my kernel?

ThanX in advance.

=== Original Post ===
>>> 3. Can I set the default broadcast interface explicitly?
>>> For example, say I wanted broadcasts to go out over
>>> eth1 by default, instead of over eth0. What if I
>>> wanted them to get sent through tap0?
>>
>> Again, I'm not sure, but I think that you can force the
>> interface by adding a special route for IP 255.255.255.255
>> and with mask 255.255.255.255 to the interface you want.

> Yes, this works! It's so simple --- I can't believe I
> didn't try it before. I did mess around with iptables,
> trying to add some weird PREROUTEing DNAT that would
> redirect the packets, but I didn't know what I was doing.
=== Original Post ===

=== Detail route output ===
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface
255.255.255.255 0.0.0.0         255.255.255.255 UH    0      0        0 eth0
192.168.7.0     192.168.6.254   255.255.255.0   UG    0      0        0 eth0
192.168.6.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.5.0     192.168.6.254   255.255.255.0   UG    0      0        0 eth0
192.168.4.0     192.168.6.254   255.255.255.0   UG    0      0        0 eth0
172.30.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.3.0     192.168.6.254   255.255.255.0   UG    0      0        0 eth0
192.168.2.0     192.168.6.254   255.255.255.0   UG    0      0        0 eth0
192.168.12.0    192.168.6.254   255.255.255.0   UG    0      0        0 eth0
192.168.11.0    192.168.6.254   255.255.255.0   UG    0      0        0 eth0
192.168.10.0    192.168.6.254   255.255.255.0   UG    0      0        0 eth0
192.168.9.0     192.168.6.254   255.255.255.0   UG    0      0        0 eth0
192.168.254.0   0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.8.0     192.168.6.254   255.255.255.0   UG    0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         172.30.1.254    0.0.0.0         UG    0      0        0 eth1
=== Detail route output ===

Good day.
 
Sincerely yours,
      responder



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-19  7:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-25  1:02 Where do packets sent to 255.255.255.255 go? Daniel Brockman
2005-08-25  8:17 ` Eric Piel
2005-08-25 10:01   ` Daniel Brockman
  -- strict thread matches above, loose matches on Subject: below --
2005-09-19  5:35 PATCH: Fix race in cpu_down (hotplug cpu) Nigel Cunningham
2005-09-19  7:43 ` Where do packets sent to 255.255.255.255 go? Wei-Che, Hsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox