2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Raspberry Pi 4 に入れた Manjaro でIPアドレスを固定する

2
Posted at

はじめに

自宅サーバとして Raspberry Pi 4 (8GB) を買った!
OS は Manjaro にしました。
インストールはそこそこに、まずはネットワーク設定から始める。
初めてのArch系なのでどうかなと思ったけれど、systemd周りは一緒らしい。

  • Raspberry Pi 4 (8GB)
  • Manjaro-ARM-xfce-rpi4-20.06.img.xz

systemd でIPアドレスを固定する

公式のWiki に詳しい説明がある。

初期状態では NetworkManager が動いていた(systemctl list-dependencies で確認した。)ので、無効にする。

$ sudo systemctl disable --now NetworkManager.service

IPアドレスを固定するネットワークデバイス名を確認。

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.132/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
       valid_lft 222980sec preferred_lft 222980sec
    inet6 fe80::a0dd:d732:ac2a:f581/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

有線のデバイス名は eth0 のようだ。

/etc/systemd/network/ 配下に XX-*.network という命名で設定ファイルを作成する慣習らしいので、今回は 20-wired-eth0-static.network とした。

$ sudo vim /etc/systemd/network/20-wired-eth0-static.network
$ cat /etc/systemd/network/20-wired-eth0-static.network
[Match]
Name=eth0

[Network]
Address=192.168.1.22/24
Gateway=192.168.1.254
DNS=192.168.1.254
DNS=1.1.1.1

設定ファイルを作成したら、systemd-networkdを起動する。

$ sudo systemctl enable --now systemd-networkd.service

反映させるために今回は再起動したった。

$ sudo reboot

以上。

おわりに

自宅サーバとしての用途は決めていないので、とりあえず Docker 入れて Pi-hole か unbound 入れて、内向きDNSサーバでも立てて広告ブロッカーとして運用する。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?