DDNS ddclientの設定

FreeBSD

インストール

動的IPアドレス変化時に、DDNSサービスへ自動的に新しいIPアドレスを更新してくれるツールとして、ddclientを導入します。

# pkg search ddclient
ddclient-3.11.2 Update dynamic DNS entries
# pkg install -y ddclient-3.11.2

—–
Message from ddclient-3.11.2:


To configre ddclient,edit the following file:

/usr/local/etc/ddclient.conf

If you would like to run ddclient as a daemon add the
following line to /etc/rc.conf

ddclient_enable=”YES”

If you would like to force ddclient to update your account
daily regardless of IP chabges add the following line to
your /etc/periodic.conf

daily_ddclient_force_enable=”YES”

ddclient.confの設定

Dynu.comの設定例を参考にddclient.confを設定します。

# ee /usr/local/etc/ddclient.conf

daemon=300
#IPアドレスを300秒毎にチェック
syslog=yes
#syslogにログを残す
mail=root
#アップデートしたらrootにメール
mail-failure=root
#アップデート失敗したらrootにメール
pid=/var/run/ddclient.pid
#pidファイル
use=web
#webでIPチェック
server=api.dynu.com
#IPアップデートサーバー
protocol=dyudns2
login=myusername
#ログインユーザー名
password=yourpassword
#ログインパスワード
jsnsver.com
#自分のホスト名

リストにDynu.comがないので上記編集、追記します。

# ee /etc/rc.conf

ddclient_enable=”YES”
#自動起動 ↑ 追記


# service ddclient start
Starting ddclient
#ddclient起動

FreeBSDの起動時に自動起動するようにrc.confに追記します。

動作テスト

# ddclient -daemon=0 -debug -verbose -noquiet
# ↑ コマンドで動作テストを行います。

SUCCESS: jsnsver.com: skipped: IP address was already set to xxx.xxx.xxx.xxx.

いろいろ沢山出てきますが、最後にSUCCESSが出ればOKです。
念の為ルーターを再起動して、Dynu.comでIPアドレスが更新されているか確認します。

更新設定

最後にIPアドレスが変化しなくても毎日Dynu.comへ更新するように設定します。

# ee /etc/defaults/periodic.conf

daily_ddclient_force_enable=”YES”
#ddclient update account
↑ 追記

タイトルとURLをコピーしました