Raspberry Piでno-ipのDynamic DNSを使う
no-ip で取得した Dynamic DNS を Raspberry Pi で自動更新させるまでの流れを記載します。なお、no-ip の登録は終わっているものとします。
2019-08-19 Raspbian 9.9 環境での情報に更新
環境
Raspbian GNU/Linux 9.9 (stretch)
Dynamic DNS Update Client for Linux version 2.1.9
DNS Update Client の取得から make install まで
1$ wget https://www.noip.com/client/linux/noip-duc-linux.tar.gz
2$ sudo tar zxvf noip-duc-linux.tar.gz
3$ cd noip-2.1.9-1/
4$ sudo make
5$ sudo make install
make 時の warning: variable ‘i’ set but not used は問題ありません。
1Please enter the login/email string for no-ip.com USERNAME
2Please enter the password for user 'USERNAME' ****************
USERNAME と password は no-ip のものを入力し、Enter 。
1Do you wish to have them all updated?[N] (y/N) y
私は登録している2つのホストをまとめて更新したいので、 y 。
1Please enter an update interval:[30] 5
IP アドレスに変化がないかを確認する間隔(分)。
1Do you wish to run something at successful update?[N] (y/N) n
特にないので、 n 。
DNS Update Client の自動起動
Raspbian では debian.noip2.sh を使用しますが、付属のものをそのまま使うと
1insserv: warning: script 'noip2' missing LSB tags and overrides
1$ sudo nano debian.noip2.sh
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: noip2
4 # Required-Start: $local_fs $remote_fs $network
5 # Should-Start: $syslog
6 # Required-Stop: $local_fs $remote_fs $network
7 # Should-Stop: $syslog
8 # Default-Start: 2 3 4 5
9 # Default-Stop: 0 1 6
10 # Short-Description: Start/stop noip2
11 ### END INIT INFO
12 # /etc/init.d/noip2.sh
1$ sudo cp debian.noip2.sh /etc/init.d/noip2
2$ sudo chkconfig -add noip2
3noip2 0:off 1:off 2:on 3:on 4:on 5:on 6:off
自動起動の登録に問題がないようなら、一度サービスを終了し、-C オプションで再度 make install 時の設定を行います。
1$ sudo /etc/init.d/noip2 stop
2$ sudo /usr/local/bin/noip2 -C # Re-config option
3$ sudo /etc/init.d/noip2 start
サービス起動後、-S オプションで no-ip サービスの情報を表示し、問題なければ設定は終了です。
1$ sudo /usr/local/bin/noip2 -S
21 noip2 process active.
3
4Process 10813, started as noip2, (version 2.1.9)
5Using configuration from /usr/local/etc/no-ip2.conf
6Last IP Address set ***.***.***.***
7Account ******
8configured for:
9 host ****.****.net
10 host ****.****.com
11Updating every 5 minutes via /dev/eth0 with NAT enabled.
お疲れ様でした。
no-ip で気をつけること
no-ip を無料で使用している場合、30日毎に no-ip の Web 上で期限延長の確認作業が必要です。期限の7日前に確認のメールが no-ip から届くので、no-ip の web にログインし、忘れずにホスト名の confirm をしましょう。