Sunday, December 4, 2011

Setup DNS ให้เรียบร้อยก่อนติดตั้ง Zimbra Server สำหรับ Ubuntu

Setup DNS ให้เรียบร้อยก่อนติดตั้ง Zimbra Server สำหรับ Ubuntu



1. ต้องกำหนด / setup DNS Server สำหรับ Linux ให้เรียบร้อยก่อน มิฉะนั้นในขั้นตอน install ZCS ที่กำหนดชื่อ mail จะมีปัญหาเสียเวลาเปล่า ๆ อีกอย่างหนึ่ง การส่งรับเมล์จะต้องมี MX เรคคอร์ดเป็นตัวบ่งชี้ ก็ MX จะมีที่ไหนหล่ะถ้าไม่ใช่ DNS

2. ติดตั้ง BIND Package ให้เรียบร้อยเสียก่อน
---
---
3. ย้ายไปยังไดเรกทอรี /etc/bind เพิ่ม zone เข้าไปในไฟล์ named.conf ดังนี้ (สีแดงคือที่เพิ่มเข้าไป)

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
type master;
file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};

include "/etc/bind/named.conf.local";

4. เพิ่มค่า Local Zone สำหรับทำเป็นชื่อ Mail ของเรา
สำหรับใช้ในองค์กรไม่เชื่อมต่อกับข้างนอก ก็อาจจะต้องชือเป็น it3plus.local

//
// Local for IT3Plus.com
// Network 192.168.1.0
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "it3plus.com" {
type master;
file "/etc/bind/db.it3plus";
};
zone "163.168.1.in-addr.arpa" {
type master;
notify no;
file "/etc/bind/db.192";
};

5. แก้ไขไฟล์ โดยการพิมพ์ไฟล์ขึ้นมาใหม่ตั้งชื่อตามค่า file "/etc/bind/db.it3plus"

file db.it3plus

;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.it3plus.com. root.it3plus.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL

@ IN MX 10 mail.it3plus.com.
;
@ IN NS ns.it3plus.com.
@ IN A 192.168.1.9
ns IN A 192.168.1.9
mail IN A 192.168.1.9

file "/etc/bind/db.192"
File: db.192


;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.it3plus.com. root.it3plus.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.
;
9 IN PTR ns.it3plus.com.
9 IN PTR mail.it3plus.com.

6. สุดท้ายไฟล์ที่แก้ไขคือ named.local.options

options {
directory "/var/cache/bind";
forwarders {
192.168.1.1;
8.8.8.8;
};
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};

192.168.1.1 คือ Gateway ของ network
8.8.8.8 คือ DNS ตัวที่สอง Google ใส่ค่า DNS อันอื่นก็ได้

7. แก้ไขไฟล์ที่เกี่ยวกับกระบวนการ resolve dns ใน ubuntu ต่าง ๆ ตามนี้

/etc/resolv.conf

nameserver 192.168.1.9
search it3plus.com

/etc/hosts

127.0.0.1 localhost.localdomain localhost
192.168.1.9 mail.it3plus.com mail
192.168.1.9 zcsit3.it3plus.com zcsit3

8. Restart DNS ไม่ควรมี ERROR ถ้ามีก็แก้ซะก่อน แก้ตรงไหนก็ไปดูให้ดีว่า error เกิดจากตรงไหน

ทดสอบก่อน เพื่อขั้นตอนติดตั้ง ZCS จะได้ไม่มีปัญหา

nslookup mail.it3plus.com

ควรจะแสดงผลดังนี้

Server: 192.168.1.9
Address: 192.168.1.9#53

Name: mail.it3plus.com
Address: 192.168.1.9

9. เริ่มขั้นตอนติดตั้ง ZCS ได้เลย ณ บัดนี้.... ./install.sh

เป็นไปตามคำกล่าวของนักปรัชญาท่านหนึ่งว่า "สิ่งใดที่ทำสำเร็จแล้ว ควรบันทึก เมื่อมาทำสิ่งเดียวกันนั้นอีกไม่ควรเริ่มต้นใหม่ สิ่งที่ควรจะทำคือต่อยอดความคิดนั้นไห้ได้"

เอวัง.....

0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More