| Dynamic DNSを利用する。 |
Dynamic DNSサービスは、ドメイン名を動的IPアドレスに変換するサービス
を行ってくれる。
有償のものもあるが、無償のものがあるのでそれを利用するとよい。
僕が利用しているのは、Hammernode Internet Servicesである。ここは、スポンサーによって運営され ていて無償で提供されているし、ユーザインタフェースがシンプルなので 使い勝手がよい。
もどる| Hammernode(hn.org)にサインアップする。 |
hn.orgのトップページから左側のCreate an Accountを選択する。
そうすると下記のような画面が表示されるので、UsernameとE-Mail
Addressを記入して、I agree to these terms & conditionsをチェックし
て送信する。

Welcome to hn.org! Your Account has successfully been created. Your Username is bigforest Your Password has been mailed to you at foo@bar.org While your're waiting Insider.hn.org... You must use this account within twenty-four hours, or it will be deleted. Back to the Main Menu |
| ドメイン名とIPアドレスを関連づける。 |
|
(example.hn.org) -and- URL Redirection (hn.org/example) IP: · Overview · Create an Account · Modify your Account · Downloads · Forgot Password |
Status Code: 101 Successful Update. bigforest.hn.org-->???.???.???.??? HAMMERNODE |
| 自動でIPアドレスを更新する。(ez-ipupdate) |
立ち上げるたびにいちいちWWWにアクセスするのは面倒くさいので、 Dynamic DNS更新用のアップデータがあるのでそれを利用する。
ぼくは、ez-ipupdateというアップデータを使っている。 ここにあるの で、ここから、ソースをダウンロードしてくる。現在最新版は、3.0.10み たいなのでそれを使う。
#!/usr/local/bin/ez-ipupdate -c # # example config file for ez-ipupdate # # this file is actually executable! # service-type=hn #ユーザネームとパスワード user=username:passward #ppxpの場合はtap0を使う。 interface=tap0 #PPPoEの場合はこれ(ADSLとか) #interface=ppp0 # hn.orgのサーバを記入 server=dup.hn.org # 適当なファイル。daemonモードではこれを利用する。 cache-file=/etc/ez-ipupdate.cache.tap0.hn #daemonモードで起動します。プロセスが残ってinterfaceを自動検出/更新をしてくれます。 daemon # other options: #host=mydomain.whatever.com #address=<ip address> #debug #foreground #host=<host> #interface=<interface> #mx=<mail exchanger> #retrys=<number of trys> #run-as-user=<user> #timeout=<sec.millisec> #max-interval=<time in seconds> #notify-email=<email address> #period=<time between update attempts> #url=<url> #wildcard #quiet |
大体上のような感じです。PPPoEの場合は、eth0ではなく、ppp0に ipが割り当てられているので注意する。 また、パスワードとか書いてあるので、自分しか読みめないようにする 必要がある。
このファイルに実行属性を持たせて実行すればOKである。
ppp0などのinterfaceの後ろに空白とかあると ちゃんと認識してくれないので注意が必要。 logが/var/log/messageのなかに残っていて、ez-ipudateの文字で 検索すれば良いでしょう。
daemonモードなのでlinux起動時に一度実行すればOKだ。 Linux起動時に実行させるには、 Linuxの起動と起動スクリプト を参照して欲しい。
| IPアドレスが更新されているか確認する。 |
IPアドレスとdomainが一致しているか確認してみる。 そのためには、まずは自分のIPアドレスがどう割り当てられているか ifconfigで確認する。 adslならば、ppp0に割り当てられているので、ppp0のIPアドレスを確認する。 (他のインタフェースに割り当てられている場合は、それぞれを指定する。)
# ifconfig ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr:210.254.28.169 P-t-P:210.254.28.254 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1454 Metric:1
RX packets:1094 errors:0 dropped:0 overruns:0 frame:0
TX packets:1157 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:859837 (839.6 Kb) TX bytes:163855 (160.0 Kb)
inet addr:210.254.28.169と言う部分が自分のIPアドレスである。 続いて、hostコマンドを使って、自分が登録した domainが上記のIPアドレスに割り当てられているか確認する。 このとき、ローカルのDNSだとローカルで引かれてしまう可能性があるので 外側のDNSに尋ねる。
$ host bigforest.hn.org dns.yahoo.co.jp Using domain server: Name: dns.yahoo.co.jp Address: 210.140.200.2#53 Aliases: bigforest.hn.org. has address 210.254.28.169
上記のように自分が登録したdomainが自分のppp0のIPアドレスに 割り当てられているのが分かる。
もどる