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?
Answer
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
No comments:
Post a Comment