LoginSignup
0
0

More than 3 years have passed since last update.

Raspbianの固定ローカルネットワークアドレスの設定

Last updated at Posted at 2019-05-17

IPの設定

まず/etc/dhcpcd.confを開きます。

ここで固定IPを設定します。

interface eth0
static ip_address=192.168.10.33/24
static routers=192.168.10.1
static domain_name_servers=192.168.10.1 8.8.8.8

ip_addressは設定したいRaspberryPiのIPアドレス。
routerは同ネットワークのルーターのIPアドレス。
domain_name_serversはDNSと呼ばれるもので名前解決するサーバーのIPアドレス。

設定が通らない時はいくつかのパターンがあります。

  • ルーターのIPアドレスが間違っている。 -サブネットが間違っている。
  • 物理的にネットワークに繋がっていない。
  • domain_name_serversの指定が間違っていたりして、/etc/resolve.confに正常な設定がされない。

確認

まずはネットワークが設定されているか確かめましょう。
適当な所でCtrl+cを入力して終了しましょう。

$ ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=49 time=10.9 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=49 time=5.33 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=49 time=5.52 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=49 time=5.46 ms

^C
--- 8.8.8.8 ping statistics ---

もしここでping: icmp open socket: Operation not permittedといったエラーが発生した場合はpingコマンドの設定をしましょう。

$ sudo chmod u+s /bin/ping

これで繋がります。

SSH

RaspberryPi3にSSHする場合、専用の設定をしておかなければSSHができません。

これについては簡潔な外部記事(1分程度)を貼っておきますのでそちらをご覧ください。

まとめ

以上で設定は終了です。

同じネットワークに属す別のPCからSSHしてみましょう。
ユーザー名など変更していないのであればpiのままです。

$ ssh pi@192.168.10.33

yes/noの質問が出たらyesを入力しておけば大丈夫です。

0
0
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
0
0