LoginSignup
1
2

More than 3 years have passed since last update.

Mac から同じ LAN 内に接続した Raspberry Pi の IP アドレスを調べる

Posted at

Mac から Raspberry Pi に接続するために IP アドレスを調べる必要が生じたのでメモ。

環境

環境は下記のとおり。

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15.3
BuildVersion:   19D76

Raspberry Pi は Mac と同じ LAN に接続している。

arp-scan をインストールする

IP アドレスを調べるために arp-scan をインストールする。

Homebrew からインストールできる。

brew install arp-scan

Mac の IP アドレスを調べる

システム環境 > ネットワーク

から Mac の IP アドレスを確認する。

ネットワーク.png

ここでは 192.168.3.2 であることが分かる。

LAN のインターフェイス名を調べる

LAN に接続しているインターフェイス名を調べるために ifconfig を使う。

$ ifconfig | grep -B 4 192.168.3.2
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=400<CHANNEL_IO>
        ether a4:83:e7:15:4f:26
        inet6 fe80::6:67bd:fa54:173f%en1 prefixlen 64 secured scopeid 0x7
        inet 192.168.3.2 netmask 0xffffff00 broadcast 192.168.3.255

ここでは en1 であることが分かる。

Raspberry Pi の IP アドレスを調べる

先にインストールした arp-scan を使って Raspberry Pi の IP アドレスを調べる。

管理者権限が必要なので sudo を付けて実行する。

$ sudo arp-scan --localnet --interface en1 | grep 'Raspberry Pi'
192.168.3.19    dc:a6:32:71:f1:e6       Raspberry Pi Trading Ltd

192.168.3.19 であることが分かった。めでたい :tada:

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2