Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have Freebsd as a router.
Local network is on interface sk0: inet 10.254.239.1 netmask 0xffffff00 broadcast 10.254.239.255
In my local network I have a computer(windows 7) that gets it's ip(10.254.239.2) from DHCP server on Freebsd.

  • Ping to exact address 10.254.239.2 works fine.

When I try to ping bradcast 10.254.239.255 from Freebsd itself nothing happens:

--- 10.254.239.255 ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss
  • #arp -a says:
    ...
    ? (10.254.239.255) at (incomplete) on sk0 expired [ethernet]
    ...

  • Firewall allows all on this interface

Where to look? What to do to make broadcast working?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

If you want to perform host discovery, don't use broadcast pings, just simply ping each possible permutation for a given subnet. It sounds heavy, but it actually takes seconds (brackets are important):

$ time ( s=192.168.0 ; for i in $(seq 1 254) ; do ( ping -n -c 1 -w 1 $s.$i 1>/dev/null 2>&1 && printf "%-16s %s\n" $s.$i responded ) & done ; wait ; echo )
192.168.0.5      responded
192.168.0.11     responded
192.168.0.2      responded
192.168.0.254    responded
192.168.0.4      responded

real    0m1.317s
user    0m0.004s
sys 0m0.084s
share|improve this answer
1  
While it does offer an alternative way to ping the network, it doesn't answer the questions posed as to "why doesn't broadcast ping work?" –  Sarge Oct 12 '12 at 21:52
1  
True, but call it pragmatic intuition. I suspected there was an underlying reason as to why this person was trying to broadcast ping the network. I don't see any harm in going beyond the answer to provide a possible solution. ;-) –  Craig Oct 12 '12 at 22:48
    
+1 for telepathy =) –  Sergey Jul 30 '13 at 6:40

Most operating systems simply ignore broadcast ICMP pings by default, for security reasons. You don't "make it work", and it has no effect on other kinds of broadcasts.


On FreeBSD, the net.inet.icmp.bmcastecho sysctl toggles this feature.

share|improve this answer
1  
And on Linux you can enable broadcast pings with: sysctl net.ipv4.icmp_echo_ignore_broadcasts=0 –  Andre Miller Nov 11 '12 at 15:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.