macos Mac 上的网络发现
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/544926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Network discovery on a Mac
提问by Abdullah Jibaly
Is there a Mac/Unix commands that lets you see the local network in terms of machines/IP addresses? If there's something on the Mac that is gui-based that would be great too.
是否有 Mac/Unix 命令可以让您根据机器/IP 地址查看本地网络?如果 Mac 上有基于 gui 的东西,那也很棒。
采纳答案by Howard
Try IP Scanner 2.5 for OS X. http://10base-t.com/Looking for others, but that's the only real one I've found for OS X.
尝试 OS X 的 IP Scanner 2.5。http://10base-t.com/寻找其他人,但这是我为 OS X 找到的唯一真正的。
回答by diciu
ping
the broadcast address (the broadcast address is printed as part of the output to ifconfig en0
)
ping
广播地址(广播地址作为输出的一部分打印到ifconfig en0
)
The hosts answering are on your local network. (You may also try arp -a
but that only keeps track of recently contacted hosts so you may want to run it after the broadcast.)
回答的主机在您的本地网络上。(您也可以尝试,arp -a
但这只会跟踪最近联系过的主机,因此您可能希望在广播后运行它。)
回答by jdizzle
There is a program called Bonjour Browserthat will list well known services that have registered on your local network. I believe that most Macs have one or more registered protocols by default.
有一个名为Bonjour 浏览器的程序,它会列出已在您的本地网络上注册的知名服务。我相信大多数 Mac 默认都有一个或多个注册协议。
回答by Jay
The only way to reliably do this is to scan the network using ping sweeps and similar techniques looking for open ports etc on various addresses. You can do that with nmapwhich is available for OS X. See http://www.netadmintools.com/art406.htmlfor an example.
可靠地做到这一点的唯一方法是使用 ping 扫描和类似技术来扫描网络,以寻找各种地址上的开放端口等。您可以使用可用于 OS X 的nmap来做到这一点。有关示例,请参见http://www.netadmintools.com/art406.html。
EDIT: Just to clarify, as diciupointed out, you can usually ping the broadcast address and/or use your arp cache as well. This will probably work for most home networks where directed broadcast is allowed.
编辑:只是为了澄清,正如diciu 所指出的,您通常也可以 ping 广播地址和/或使用您的 arp 缓存。这可能适用于大多数允许定向广播的家庭网络。
If not, then you would need to run a ping sweep with a tool like nmap to individually check each address for an available host. Many network discovery/scanning tools can check for more than just ping, looking for listening ports, SNMP, etc. as well.
如果没有,那么您需要使用类似 nmap 的工具运行 ping 扫描,以单独检查可用主机的每个地址。许多网络发现/扫描工具不仅可以检查 ping,还可以查找侦听端口、SNMP 等。
回答by ecume
in the days of tiger (10.4) every mac broadcast a 'presence' service on bonjour, which made finding macintoshes on the network a snap. alas, no more...
在 Tiger (10.4) 时代,每台 Mac 都在 bonjour 上播放“在线”服务,这使得在网络上查找 Macintosh 变得轻而易举。唉,没有了……
回答by shaochuancs
You can use netdiscoveron Mac OS, which is based on ARP packets. It will send ARP requests and scan the response.
您可以在 Mac OS 上使用netdiscover,它基于 ARP 数据包。它将发送 ARP 请求并扫描响应。
For example, run netdiscover command sudo netdiscover -i en0 -r 10.106.0.0/16
in my local network would bring the following result:
例如,sudo netdiscover -i en0 -r 10.106.0.0/16
在我的本地网络中运行 netdiscover 命令会带来以下结果:
回答by M. Dave Auayan
You can use Nmapbut that seems to be a bit much for your stated goals.
您可以使用Nmap,但这对于您既定的目标来说似乎有点多。
OS X ships with netstat, or open Up /Applications/Utilities/Network Utility.app, perhaps this will work for you?
OS X 附带netstat,或者打开 /Applications/Utilities/Network Utility.app,也许这对你有用?
EDIT:oops. netstat doesn't do what I thought.
编辑:哎呀。netstat 没有做我想的那样。
回答by Josh Bierman
angry IP scanner for a no mus - no fuss IP scanner with basic port scanning. NMap and Zenmap for the big power scans. I actually use both together, as nmap can get easily sidetracked by certain reverse proxy boxes.
愤怒的 IP 扫描仪,没有 mus - 没有大惊小怪的 IP 扫描仪与基本端口扫描。NMap 和 Zenmap 用于大功率扫描。我实际上将两者结合使用,因为 nmap 很容易被某些反向代理框所干扰。