开发者 · 2023年 6月 27日

如何通过SAMBA共享的主机名反查ip地址?

有时候各种局域网、公网、VLAN等网络环境比较复杂,虽然通过SAMBA host名字打开了文件,但是不知道走的是不是最快的链路。反正有一些场景下,还是想要看一下SAMBA主机的IP。右键查看详情肯定是没有的,此时只要一个最简单的ping命令即可:ping -c 1 [Your_host].local -4 //其中 -4是ipv4的意思,不加默认是ipv6.

以我的NAS为例:

(base) PS C:\Users\tieni> ping -c 1 xwdou.local -4

Pinging xwdou.local [10.10.10.61] with 32 bytes of data:
Reply from 10.10.10.61: bytes=32 time=74ms TTL=64
Reply from 10.10.10.61: bytes=32 time=76ms TTL=64
Reply from 10.10.10.61: bytes=32 time=79ms TTL=64
Reply from 10.10.10.61: bytes=32 time=75ms TTL=64

Ping statistics for 10.10.10.61:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 74ms, Maximum = 79ms, Average = 76ms