顯示具有 Dns 標籤的文章。 顯示所有文章
顯示具有 Dns 標籤的文章。 顯示所有文章

2011年7月7日 星期四

CHC安裝DNS

參考
http://www.chc.edu.tw/skill/dns.htm
/etc/init.d/bind9 restart

開機就啟動DNS
直接編輯 /etc/init.d/rcS ,放在最後面
/etc/init.d/bind9 start

參、DNS 伺服器的設定
/etc/bind/host.conf      名稱解析的順序宣告檔
/etc/bind/hosts          主機名稱與 IP 對照檔
/etc/bind/resolv.conf    名稱解析設定檔
/etc/bind/named.conf     領域型態組態檔
一.名稱解析的順序宣告檔 host.conf
主機名稱解析順序的設定檔 host.conf,其內容如下列:
order hosts,bind
上一行中的 order 是本機對名稱解析的順序設定,先到
hosts 這個檔案找名稱與 IP 的對照,若找不到,再到
bind 去找,意思就是到 Name Server 去查詢和尋找。
二.主機名稱與 IP 的對照檔 hosts
以成功國小為例作說明,因成功國小的網域名稱是 
cges.chc.edu.tw,所以,在此網域下的主機名稱,可
設在 hosts 檔案內,以加快本網域內主機查詢的速度。
 hosts 檔案的內容如下列:

#Do not remove the following line, or various
#programs
#that require network functionality will fail.
163.23.107.65 dns.cges.chc.edu.tw dns
#163.23.107.66 mail.cges.chc.edu.tw mail
127.0.0.1 localhost.localdomain localhost
三.名稱解析設定檔 resolv.conf
名稱解析設定檔  resolv.conf  其內容如下:
domain cges.chc.edu.tw
nameserver 163.23.107.65
nameserver 163.23.200.1
nameserver 168.95.1.1
 成功國小因主機本身是 DNS Server 管轄 cges.chc.edu.tw 這個領域,
 所以才用 domain cges.chc.edu.tw 的設定,若本身不是 DNS Server
 就用 search cges.chc.edu.tw 的設定。
查詢正、反解的順序,先由本身
nameserver 163.23.107.65 查詢起,若不能查詢,就 轉向縣網的 DNS 伺服器
nameserver 163.23.200.1 查詢,若還是不能查詢,則轉向中華電信公司的
nameserver 168.95.1.1 查詢。
四.領域型態組態檔 named.conf
成功國小的網域名稱是 cges.chc.edu.tw 所以在此網域下
DNS Server 的設定檔是 named.conf,其內容如下:
;-----------------------------------底下是檔案內容的開始
options{
directory "/etc/bind";
forwarders {163.23.200.1;};
};

zone "." IN {
type hint;
file "named.ca";
};

zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.localhost.rev";
allow-update { none; };
};

zone "cges.chc.edu.tw" IN {
type master;
file "named.cges";
allow-update { none; };
};

zone "192-255.107.23.163.in-addr.arpa" IN {
type master;
file "named.cges.rev";
allow-update { none; };
};
;-----------------------------------檔案內容結束

五.在目錄  /etc/bind  這個目錄下放置相關的設定檔如下:
;-------------------------------------------------------------------------------------
named.cges           正解檔
named.cges.rev             反解檔
named.localhost.rev 本機的Loopback的反解檔
named.title            正解檔、反解檔、本機Loopback反解檔檔案開頭共同的包含檔。
;-------------------------------------------------------------------------------------

;正解檔 named.cges 的內容:
$TTL 86400
$ORIGIN cges.chc.edu.tw.
$INCLUDE named.title
@ IN MX 5 mail.cges.chc.edu.tw.
@ IN MX 10 m1.cges.chc.edu.tw. localhost IN A 127.0.0.1
loopback IN CNAME localhost
dns IN A 163.23.107.65
mail IN A 163.23.107.66
www IN CNAME dns
ftp IN CNAME dns
m1 IN A 163.16.8.100
;若有其他的伺服器主機名稱可再增加設定上去。
;-------------------------------------------------------------------------------------
;反解檔 named.cges.rev 的內容:
$TTL 86400
$ORIGIN 192-255.99.23.163.in-addr.arpa.
$INCLUDE named.title
193 IN PTR dns.rces.chc.edu.tw.
193 IN PTR www.rces.chc.edu.tw.
193 IN PTR ftp.rces.chc.edu.tw.
194 IN PTR mail.rces.chc.edu.tw.
;若有其他的伺服器主機名稱的 ip 可再增加設定上去。
;-------------------------------------------------------------------------------------
;共同包含檔 named.title 的內容:
@     IN    SOA dns.cges.chc.edu.tw. admin.mail.cges.chc.edu.tw. (
            2002120401    ; serial
            3H           ; refresh  
            1H           ; retry
            1W           ; expiry
            1D           ; default_ttl
            )
IN    NS   dns.cges.chc.edu.tw.
;-------------------------------------------------------------------------------------
;named.localhost.rev  本機的Loopback的反解檔的內容:
$TTL 86400
$ORIGIN 0.0.127.in-addr.arpa.
$INCLUDE named.title
1      IN    PTR localhost.
;-------------------------------------------------------------------------------------

六.      四分之一  C  級網路 DNS 反解的說明:
(一). 本縣國中、小所分配到的 IP 範圍,從 163.23.66.0 至 163.23.119.255 總共有  54 個 C 級網路。
(二). 每個 C 級網路有 256 個 IP 分成四段,所以每段是四分之一個 C,它有  64(256/4=64) 個 IP,分配給國中或國小。這四段的 IP 範圍如下:第一段是  0~63 第二段是 64~127 第三 段是  128~191 第四段是 192~255。
(三). 例如,163.23.66 這個 C 級網路分成四段,其範圍如下:
第一段的 IP 範圍是 163.23.66.0~163.23.66.63
第二段的 IP 範圍是 163.23.66.64~163.23.66.127
第三段的 IP 範圍是 163.23.66.128~163.23.66.191
第四段的 IP 範圍是 163.23.66.192~163.23.66.255
每一段的第一個 IP 是網路 IP,最後一個 IP 作廣播用除外,其餘的 IP 皆可使用。


(八). nslookup 公用程式試查看看。

ubuntu10.04 DNS設定

參考
http://163.23.94.67/blog/post/2/434


一、安裝DNS所需套件
sudo apt-get install bind9
二、加入正反解檔案設定
sudo vi /etc/bind/named.conf

--------------------------------------------------------------------------------
include "/etc/bind/named.conf.options";
zone "xxx.chc.edu.tw" {
        type master;
        file "/etc/bind/正解檔檔名";
};
zone "192-255.xx.xx.163.in-addr.arpa" {
        type master;
        file "/etc/bind/反解檔檔名";
};
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

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

三、修改bind參數
sudo vi /etc/bind/named.conf.options
在「options {};」內加入

--------------------------------------------------------------------------------
        forwarders {
                168.95.1.1; 163.23.200.1;
        };
        allow-query { any; };
        allow-transfer { none; };
--------------------------------------------------------------------------------
四、修改正解檔
sudo vi /etc/bind/正解檔檔名

--------------------------------------------------------------------------------
$TTL    43200
@       IN      SOA     sdes.chc.edu.tw. dns.sdes.chc.edu.tw. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      dns.xxxx.chc.edu.tw.
@       IN      NS      www.xxxx.chc.edu.tw.
@       IN      A       163.xxx.xxx.xxx
dns     IN      A       163.xxx.xxx.xxx
www     IN      A       163.xxx.xxx.xxx
--------------------------------------------------------------------------------
五、修改反解檔
sudo vi /etc/bind/反解檔檔名

--------------------------------------------------------------------------------
$TTL    43200
@       IN      SOA     sdes.chc.edu.tw. dns.sdes.chc.edu.tw. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      dns.xxx.chc.edu.tw.
65      IN      PTR     www.xxx.chc.edu.tw.
--------------------------------------------------------------------------------

六、重新啟動 DNS
sudo /etc/init.d/bind9 restart

2011年1月21日 星期五

ubuntu設定ipv6

安裝 vi 加強版 #操作 vi 怪怪的,所以安裝加強版
apt-get install vim
網路設定 (設定固定ip,dhcp為自動取得ip)
vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 163.23.115.193
netmask 255.255.255.192
gateway 163.23.115.254
#同一張網卡新增一個虛擬的網路ip
auto eth0:0
iface eth0:0 inet static
address 172.20.1.248
netmask 255.255.255.0
gateway 172.20.1.254

/etc/init.d/networking restart #重新啟動網卡設定

如果沒有安裝 ncftp ,使用 apt-get install ncftp 來安裝
cd pub/ols3tools/
get ols3dns-1.0.5p.tar.gz
exit
tar zxvf ols3dns-1.0.5p.tar.gz
./ols3dns

檢查設定檔 (一定要檢查)
vi /etc/bind/named.conf
將路徑 /var/named 修改成 /etc/bind
vi /etc/bind/db.XXX.XXX.XX
vi /etc/bind/db.XXX.XXX.XXX
重新啟動 named
/etc/init.d/bind9 restart


ipv6
----------------------------------------------------
參考http://blogs.yyes.chc.edu.tw/post/2/2723

ifconfig
看網卡是否支援IPv6
出現inet6 addr表示支援
sudo vi /etc/networkinterfaces
iface eth0 inet6 static
address 2001:288:xxxx::2
netmask 48
gateway 2001:288:xxxx::1
sudo /etc/init.d/networking restart
網路連線測試
以「ping6」指令 ping 到「ipv6.l.google.com」
ping6 2404:6800:8005::6a

DNS 伺服器設定
sudo vi /etc/bind/named.conf
在 options 區段內有些 Bind 版本需加入以下內容:
listen-on-v6 { any; };
DNS 正解檔設定
vi /etc/bind/db.hnps.chc.edu.tw 裡列出正解設定,
IPv6 的寫法除了IP位址不同外,另一差別只是將「A」改成「AAAA」,
加上兩列關於這兩部主機新的設定:
dns             IN      AAAA    2001:288:xxxx::2
www           IN      AAAA    2001:288:xxxx::2

重新啟動DNS
sudo /etc/init.d/bind9 restart
測試
nslookup
> server 163.23.115.xx
Default server: 163.23.115.xx
Address: 163.23.115.xx#53

ipv6

vi /etc/network/interfaces

加入下列IPv6設定

iface eth0 inet6 static
  address 2001:288:56XX::XX
  netmask 48
  gateway 2001:288:56XX::XX

網路重新啟動
service networking restart