close

【Unix-like】DNS-浮動IP申請

對於架主機的人來說
pppoe最頭疼的就是每次得到的IP都不相同,
這樣要怎麼從外面連到自已家的主機呢?
在WIN底下有DynDNS Updater這套軟體好用!
那…在FreeBSD、Linux/UNIX-like OS底下呢@@?
呵呵別擔心~當然也有啊!

=========================
【申請DynDNS 帳號】

首先我們先去申請一個免費的 host name
這邊提供一個本人自已在用的網站
DynDNS

1. 點選『Create Account'連結

點選右上角的『Create Account' 申請帳號。

2. 填寫帳號資訊後,點按下方的『Create Account'按鈕

資料填完之後就是DynDNS的會員囉:3

3. 打開信箱,收取郵件

4. 點選帳號啟動連結




(網路上還有很多其他免費的動態DNS,有興趣的朋友可以自行去找找)

【設定Hostname】

接下來要申請一個動態的DNS(Dynamic DNS)
點選 >>點選 >>點選

>>點選 

>>點選 

>>設好喜歡的Hostname、選擇『Service Type』及填入目前的IP Address』,按下右下方的Add to Cart 按鈕,這樣就申請完了^^!



再次登入,點選左方圖示連結,進入下面畫面,並點選右下方『Next>>』按鍵。

進入下方的頁面,點選右下方『Activate Services>>』,令剛申請、設定的Hostname生效。





ddclient=============================

為了不想每次重開或斷線後就要上DynDNS去更新ip
我們要來
安裝一個可以自動連上DynDNS更新IP的Update軟體


【Download ddclient


DynDNS站上就能下載到這套軟體:ddclient

下載下來後解壓解包它 ddclient.tar.gz
# wget -c http://cdn.dyndns.com/ddclient.tar.gz
# tar -zxvf ddclient.tar.gz 

解開後就看到這個ddclient-3.7.3 的目錄
安裝的方法可以cat 一下README

*****************************************************
【INSTALLATION】
  # sudo cp ddclient /usr/local/bin/
 
  # sudo mkdir /etc/ddclient 
  #
sudo mkdir /var/cache/ddclient
  # sudo cp sample-etc_ddclient.conf /etc/ddclient/ddclient.conf
 
  # touch /var/cache/ddclient/ddclient.cache
 
  # sudo chown -R root:root /etc/ddclient  
  # sudo vi /etc/ddclient/ddclient.conf
   -- and change hostnames, logins, and passwords appropriately

*********************************************************

 (for Ubuntu,Fedora,Linux/Unix-like) 

【修改 /etc/ddclient/ddclient.conf 內容】

# cat > /etc/ddclient/ddclient.conf <<EOF
 >use=if,                      if=ppp0 
>login=jackiexie
>password=xxxxxxxxx
>server=members.dyndns.org
>protocol=dyndns2
>jackiexie.blogsite.org
>EOF


# cat /etc/ddclient/ddclient.conf

 

daemon=300                              
syslog=yes          
                                                 
mail=root
                                                          
mail-failure=root                                                           
pid=/var/run/ddclient.pid 
ssl=yes 

protocol=dyndns2
server=members.dyndns.org

 
# pppoe 設定方式
。。。
use=if,                      if=ppp0
login=jackiexie
password=xxxxxxxxx
server=members.dyndns.org
protocol=dyndns2
jackiexie.blogsite.org
。。。




----------------------------------------------

【測試】

# ddclient -daemon=0 -debug -verbose -noquie

=== opt ====
opt{cache}                    
       : <undefined>
opt{cmd}                      
       : <undefined>
opt{cmd-skip}                 
       : <undefined>
opt{daemon}                   
       : 0
opt{debug}                    
       : 1
opt{exec}                     
       : <undefined>
opt{facility}                 
       : <undefined>
opt{file}                     
       : <undefined>
opt{force}                    
       : <undefined>
opt{fw}                       
       : <undefined>
opt{fw-login}                 
       : <undefined>
opt{fw-password}              
       : <undefined>
opt{fw-skip}                  
       : <undefined>
opt{geturl}                   
       : <undefined>
opt{help}                     
       : <undefined>
opt{host}                     
       : <undefined>
opt{if}                       
       : <undefined>
opt{if-skip}                  
       : <undefined>
opt{ip}                       
       : <undefined>
opt{login}                    
       : <undefined>
opt{mail}                     
       : <undefined>
opt{mail-failure}             
       : <undefined>
opt{max-interval}             
       : 2160000
opt{min-error-interval}       
       : 300
opt{min-interval}             
       : 30
opt{options}                  
       : <undefined>
opt{password}                 
       : <undefined>
opt{pid}                      
       : <undefined>
opt{priority}                 
       : <undefined>
opt{protocol}                 
       : <undefined>
opt{proxy}                    
       : <undefined>
opt{query}                    
       : <undefined>
opt{quiet}                    
       : 0
opt{retry}                    
       : <undefined>
opt{server}                   
       : <undefined>
opt{ssl}                      
       : <undefined>
opt{syslog}                   
       : <undefined>
opt{test}                     
       : <undefined>
opt{timeout}                  
       : <undefined>
opt{use}                      
       : <undefined>
opt{verbose}                  
       : 1
opt{web}                      
       : <undefined>
opt{web-skip}                 
       : <undefined>
=== globals ====
globals{daemon}               
       : 60
globals{debug}                
       : 1
globals{if}                   
       : ppp0
globals{login}                
       : jackiexie
globals{mail}                 
       : root
globals{mail-failure}         
       : root
globals{password}             
       : jackiexie
globals{pid}                  
       : /var/run/ddclient.pid
globals{protocol}             
       : dyndns2
globals{quiet}                
       : 0
globals{server}               
       : members.dyndns.org
globals{ssl}                  
       : 1
globals{syslog}               
       : 1
globals{use}                  
       : if
globals{verbose}              
       : 1
=== config ====
config{
jackiexie.blogsite.org}{atime} : 1255678252
config{
jackiexie.blogsite.org}{backupmx} : 0
config{
jackiexie.blogsite.org}{cacheable} : ARRAY(0x1f82e68)
config{
jackiexie.blogsite.org}{custom} : 0
config{
jackiexie.blogsite.org}{host} :  
 jackiexie.blogsite.org  
config{
jackiexie.blogsite.org}{ip} : xxx.xxx.xxx.xxx
config{
jackiexie.blogsite.org}{login} : jackiexie
config{
jackiexie.blogsite.org}{max-interval} : 2160000
config{
jackiexie.blogsite.org}{min-error-interval} : 300
config{
jackiexie.blogsite.org}{min-interval} : 30
config{
jackiexie.blogsite.org}{mtime} : 1255678252
config{
jackiexie.blogsite.org}{mx} : 
config{
jackiexie.blogsite.org}{password} : xxxxxxx
config{
jackiexie.blogsite.org}{protocol} : dyndns2
config{
jackiexie.blogsite.org}{server} : members.dyndns.org
config{
jackiexie.blogsite.org}{static} : 0
config{
jackiexie.blogsite.org}{status} : good
config{
jackiexie.blogsite.org}{warned-min-error-interval} : 0
config{
jackiexie.blogsite.org}{warned-min-interval} : 0
config{
jackiexie.blogsite.org}{wildcard} : 0
config{
jackiexie.blogsite.org}{wtime} : 30
=== cache ====
cache{jackiexie}{atime}  
       : 1255677637
cache{jackiexie}{
backupmx}      : 0
cache{jackiexie}{custom} 
       : 0
cache{jackiexie}{host}   
       : jackiexie
cache{jackiexie}{mtime}  
       : 0
cache{jackiexie}{mx}     
       : 
cache{jackiexie}{static} 
       : 0
cache{jackiexie}{status} 
       : noconnect
cache{jackiexie}{warned-
min-error-interval} : 1255677679
cache{d jackiexie}{warned-
min-interval} : 0
cache{jackiexie}{
wildcard}      : 0
cache{jackiexie}{wtime}  
       : 30
cache{
 
 jackiexie.blogsite.org}{atime} : 1255678252
cache{
jackiexie.blogsite.org}{backupmx} : 0
cache{
jackiexie.blogsite.org}{custom} : 0
cache{
jackiexie.blogsite.org}{host} : jackiexie.blogsite.org
cache{
jackiexie.blogsite.org}{ip} : xxx.xxx.xxx.xxx
cache{
jackiexie.blogsite.org}{mtime} : 1255678252
cache{
jackiexie.blogsite.org}{mx} : 
cache{
jackiexie.blogsite.org}{static} : 0
cache{
jackiexie.blogsite.org}{status} : good
cache{
jackiexie.blogsite.org}{warned-min-error-interval} : 0
cache{
jackiexie.blogsite.org}{warned-min-interval} : 0
cache{
jackiexie.blogsite.org}{wildcard} : 0
cache{
jackiexie.blogsite.org}{wtime} : 30
DEBUG:    get_ip: using if, ppp0 reports 
xxx.xxx.xxx.xxx
DEBUG:    
DEBUG:     nic_dyndns2_update -------------------
INFO:     setting IP address to
xxx.xxx.xxx.xxx for
jackiexie.blogsite.org
UPDATE:   updating 
jackiexie.blogsite.org
DEBUG:    proxy  = 
DEBUG:    url    = 
http://members.dyndns.org/nic/update?system=dyndns&hostname=jackiexie.blogsite.org
&myip=xxx.xxx.xxx.xxx
DEBUG:    server = 
members.dyndns.org
CONNECT:  
members.dyndns.org
CONNECTED:  using SSL
SENDING:  GET /nic/update?system=dyndns&
hostname=jackiexie.blogsite.org&myip=xxx.xxx.xxx.xxx HTTP/1.0
SENDING:   Host: 
members.dyndns.org
SENDING:   Authorization: Basic ZG5pLW5ldHdvcmtpbmc6ZG5pbmV0d2
9ya2luZw==
SENDING:   User-Agent: ddclient/3.7.3
SENDING:   Connection: close
SENDING:   
RECEIVE:  HTTP/1.1 200 OK
RECEIVE:  Date: Fri, 16 Oct 2009 07:52:14 GMT
RECEIVE:  Server: Apache
RECEIVE:  Content-Type: text/plain
RECEIVE:  Connection: close
RECEIVE:  
RECEIVE:  good 
xxx.xxx.xxx.xxx
SUCCESS:  updating 
jackiexie.blogsite.org: good: IP address set to xxx.xxx.xxx.xxx
 


進dyndns>>My Services>>Host Services,查看ip是否已經改變


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Bluelove1968 的頭像
    Bluelove1968

    藍色情懷

    Bluelove1968 發表在 痞客邦 留言(1) 人氣()