大网数据广告活动
服务器运维问答

Linux : Ping all the host in the subnet

· 52CE 我爱测

There is one solaris command to ping all the hosts in the subnet by issuing : ping -s 255.255.255.255 Is there anything similar to this one in linux ? My intention is to find one mac address as below after pinging all the hosts: …

问题原文

原帖链接 · user173141 · CC BY-SA 3.0

There is one solaris command to ping all the hosts in the subnet by issuing :

ping -s 255.255.255.255

Is there anything similar to this one in linux ? My intention is to find one mac address as below after pinging all the hosts:

arp -an | grep mac_address

已采纳解答

原帖链接 · user9517 · CC BY-SA 3.0

All you are doing is pinging the broadcast address. The GNU/Linux version of ping requires that you use the -b switch

-b Allow pinging a broadcast address

There doesn't appear to be a direct equivalent of the Solaris -s switch either (it's only pinging every second and gathering stats) but perhaps it's buried in the Linux man pages- well worth a read (as may be the Solais ones ).

I wouldn't go pinging 255.255.255.255 either (it may take a while to complete) I'd use the broadcast address of the network I was connected to.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。