获取网络下所有分配的IP地址

家里增加网络设备时,经常要找设备的IP,以便管理新的设备。如在网络中加树莓派Raspberry Pi之类的操作。要连接显示设备比较麻烦,可以直接用ssh进行连接操作。

windows 命令 arp

windows下自带命令 arp, 不需要额外工具软件去查找设备。

PS C:\Users\moguf> arp -a

接口: 192.168.0.108 --- 0xc
  Internet 地址         物理地址              类型
  192.168.0.1           f8-8c-21-2e-92-ec     动态
  192.168.0.100         a4-1f-72-71-1a-dc     动态
  192.168.0.101         6a-c5-ed-fb-76-9e     动态
  192.168.0.102         34-79-16-d3-6e-8e     动态
  192.168.0.104         7a-82-95-a7-82-00     动态
  192.168.0.105         d2-d8-36-00-24-96     动态
  192.168.0.106         02-00-cf-cd-57-06     动态
  192.168.0.255         ff-ff-ff-ff-ff-ff     静态
  224.0.0.2             01-00-5e-00-00-02     静态
  224.0.0.22            01-00-5e-00-00-16     静态
  224.0.0.251           01-00-5e-00-00-fb     静态
  224.0.0.252           01-00-5e-00-00-fc     静态
  239.255.255.250       01-00-5e-7f-ff-fa     静态
...
...

连接树莓配

以标准的Pi的系统为例。

  1. 下载PI的镜像写入工具
  2. 写入Img(需要点时间...)
  3. 开启SSH,(在SD卡的根目录新建一个SSH 文件,没内容没后缀就个SSH)
  4. 找到IP (arp -a)
  5. 使用ssh命令链接pi 设备
  6. 查看树莓派硬件信息screenfetch

使用到的命令

arp -a                          \\ 获取当前所有的IP,找到pi的IP地址 
ssh pi@192.168.0.109            \\ 使用命令连接pi
cat /proc/cpuinfo               \\ 查看当前cup信息 pi4,有四个
sudo apt install screenfetch    \\ 安装pi系统信息显示工具
screenfetch                     \\ 显示pi信息

注: 默认用户名和密码

  • 用户: pi
  • 密码: raspberry

实际如下

PS C:\Users\moguf> arp -a

接口: 192.168.0.108 --- 0xc
  Internet 地址         物理地址              类型
  192.168.0.1           f8-8c-21-2e-92-ec     动态
....
  192.168.0.106         02-00-cf-cd-57-06     动态
  192.168.0.109         dc-a6-32-80-12-ad     动态
  192.168.0.255         ff-ff-ff-ff-ff-ff     静态
...

PS C:\Users\moguf> ssh pi@192.168.0.109
The authenticity of host '192.168.0.109 (192.168.0.109)' can't be established.
ECDSA key fingerprint is SHA256:FSBQ1lTj/aQWmrle+qDl48Imv8wsaiuA9vz0h/AEtis.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.109' (ECDSA) to the list of known hosts.
pi@192.168.0.109's password:
Linux raspberrypi 5.10.17-v7l+ #1414 SMP Fri Apr 30 13:20:47 BST 2021 armv7l
...

pi@raspberrypi:~ $ cat /proc/cpuinfo

processor       : 0
model name      : ARMv7 Processor rev 3 (v7l)
BogoMIPS        : 108.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva ...

pi@raspberrypi:~ $ sudo apt install  screenfetch
Reading package lists... Done
...
Processing triggers for man-db (2.8.5-2) ...
pi@raspberrypi:~ $ screenfetch
    .',;:cc;,'.    .,;::c:,,.    pi@raspberrypi
   ,ooolcloooo:  'oooooccloo:    OS: Raspbian 10 buster
   .looooc;;:ol  :oc;;:ooooo'    Kernel: armv7l Linux 5.10.17-v7l+
     ;oooooo:      ,ooooooc.     Uptime: 12m
       .,:;'.       .;:;'.       Packages: 1385
       .... ..'''''. ....        Shell: 690
     .''.   ..'''''.  ..''.      CPU: ARMv7 rev 3 (v7l) @ 4x 1.5GHz [39.4°C]
     ..  .....    .....  ..      GPU:
    .  .'''''''  .''''''.  .     RAM: 63MiB / 3827MiB
  .'' .''''''''  .'''''''. ''.
  '''  '''''''    .''''''  '''
  .'    ........... ...    .'.
    ....    ''''''''.   .''.
    '''''.  ''''''''. .'''''
     '''''.  .'''''. .'''''.
      ..''.     .    .''..
            .'''''''
             ......
pi@raspberrypi:~ $ ^C

树莓派官网: www.raspberrypi.org

END (Moguf.COM)