How can I send packets to 255.255.255.255 from the command line?

Paul Thornton paul at prt.org
Thu Aug 18 21:43:12 UTC 2016


On 18/08/2016 21:55, Ryan Stone wrote:
> On Thu, Aug 18, 2016 at 4:48 PM, Paul A. Procacci <pprocacci at datapipe.com>
> wrote:
>
>> You should be able to ping the local subnet.
>> Alternatively you can use net/arping.
>>
>> ~Paul
>>
>
> I'm specifically looking to test the handling of 255.255.255.255, so a
> local broadcast address is out.  Unfortunately, arping doesn't seem to do
> the right thing on FreeBSD.  It manages to get the kernel to try arp'ing
> for 255.255.255.255.

This very likely comes under the heading of "horrible bodges" but when I 
needed to do this, after much experimenting I added a static route to 
255.255.255.0/24 pointing to the local LAN broadcast address.

For example, on a machine with address 192.168.10.10/24 the "fix" would be:
route add 255.255.255.0/24 192.168.10.255

My code could then happily send UDP to 255.255.255.255 without issue, 
and the packets make it out onto the wire with a broadcast destination 
MAC address.

This was under 10.1-RELEASE; things may have changed that make it no 
longer work.

I did warn you that it came under the heading of "horrible bodges" :)

Paul.


More information about the freebsd-net mailing list