<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>STORY of AODDY. &#187; DNS</title>
	<atom:link href="http://www.aoddy.com/category/dns/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aoddy.com</link>
	<description>If you lose yourself, you lose everything. -- Michael Scofield</description>
	<lastBuildDate>Mon, 01 Aug 2011 14:32:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to install trac service on Ubuntu for multiple projects using Mod_Python.</title>
		<link>http://www.aoddy.com/2008/10/17/how-to-install-trac-service-on-ubuntu-for-multiple-projects-using-mod_python/</link>
		<comments>http://www.aoddy.com/2008/10/17/how-to-install-trac-service-on-ubuntu-for-multiple-projects-using-mod_python/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 16:25:21 +0000</pubDate>
		<dc:creator>aoddy</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[trac]]></category>

		<guid isPermaLink="false">http://www.aoddy.com/?p=228</guid>
		<description><![CDATA[Previously I have installed a DNS service on my Ubuntu server. Today I would like to install a Trac service which supports for multiple projects using Mod_Python on Apache. Condition : I would like to use sub-domain for trac service &#8230; <a href="http://www.aoddy.com/2008/10/17/how-to-install-trac-service-on-ubuntu-for-multiple-projects-using-mod_python/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a title="How to install DNS server on Ubuntu 8.04.1." href="http://www.aoddy.com/2008/10/11/how-to-install-dns-server-on-ubuntu-8041/" target="_blank"><img class="alignleft" style="margin: 5px;" title="Trac Integrated SCM &amp; Project management" src="http://www.edgewall.org/gfx/trac_logo.png" alt="Trac Logo" width="214" height="61" />Previously</a> I have installed a DNS service on my Ubuntu server. Today I would like to install a Trac service which supports for multiple projects using Mod_Python on Apache.</p>
<p><span style="text-decoration: underline;"><strong><br />
</strong></span></p>
<p><span style="text-decoration: underline;"><strong>Condition :</strong></span></p>
<ol>
<li>I would like to use sub-domain for trac service that is trac.aoddy.com</li>
<li>Trac service can support multiple projects such as trac.aoddy.com/Project1, trac.aoddy.com/Project2</li>
<li>Trac service supports SVN service too.</li>
</ol>
<p><span id="more-228"></span><br />
<script type="text/javascript"><!--
google_ad_client = "pub-2013111130648878";
google_ad_slot = "7396784224";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<br />
<span style="text-decoration: underline;"><strong>Softwares :<br />
</strong></span></p>
<ol>
<li>enscript</li>
<li>libapache2-mod-python</li>
<li>python-docutils</li>
<li>trac</li>
<li>db4.3-util</li>
<li>libapache2-svn</li>
<li>subversion-tools</li>
</ol>
<p>You can install software by</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo apt-get install enscript libapache2-mod-python python-docutils trac db4.3-util libapache2-svn subversion-tools</pre></td></tr></table></div>

<p><span style="text-decoration: underline;"><strong>Install &amp; Configurations :</strong></span></p>
<ol>
<li>Create SVN directory such as :

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo mkdir /svn</pre></td></tr></table></div>

</li>
<li>Set SVN directory to repository.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo svnadmin create /svn</pre></td></tr></table></div>

</li>
<li>Create a user account so as to security policy.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo htpasswd 2 -cm /etc/apach2/dav_svn.passwd YOUR-ACCOUNT</pre></td></tr></table></div>

</li>
<li>Create TRAC directory such as :

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo mkdir /trac</pre></td></tr></table></div>

</li>
<li>Change owner of TRAC directory to www-data :

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo chown -R www-data:www-data /trac</pre></td></tr></table></div>

</li>
<li>Create a configuration file of TRAC in apache

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo vi /etc/apache2/site-available/trac.aoddy.com
&lt;VirtualHost * &gt;
ServerName trac.aoddy.com
DocumentRoot /trac
&lt;Location /&gt;
SetHandler mod_python
PythonInterpreter main_interpreter
PythonOption TracEnvParentDir /var/lib/trac
PythonOption TracUriRoot /
&lt;/Location&gt;
&lt;LocationMatch &quot;/[^/]+/login&quot;&gt;
AuthType Basic
AuthName &quot;Trac&quot;
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
&lt;/LocationMatch&gt;
Alias /svn /svn
&lt;Location /svn/&gt;
DAV svn
SVNParentPath /svn
SVNListParentPath On
AuthType Basic
AuthName &quot;Subversion Repository&quot;
AuthUserFile /etc/apache2/dav_svn.passwd
AuthzSVNAccessFile /etc/apache2/authz_svn.access
Require valid-user
&lt;/Location&gt;
ErrorLog /var/log/apache2/trac.aoddy.com/error.log
CustomLog /var/log/apache2/trac.aoddy.com/access.log common
&lt;/VirtualHost&gt;</pre></td></tr></table></div>

</li>
<li>Create a directory for keep error log.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo mkdir -p /var/log/apache2/trac.aoddy.com/</pre></td></tr></table></div>

</li>
<li>Add this site into apache service.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo a2ensite trac.aoddy.com
$ sudo /etc/init.d/apach2 restart</pre></td></tr></table></div>

</li>
<li>Sometime you need to re-configure in this file, I recommend you should use these commands.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo a2dissite trac.aoddy.com
$ sudo a2ensite trac.aoddy.com
$ sudo /etc/init.d/apach2 restart</pre></td></tr></table></div>

</li>
<li>Test by open an URL http://trac.aoddy.com/</li>
</ol>
<p><span style="text-decoration: underline;"><strong>Create SVN</strong></span></p>
<p>You can use this script for create a SVN environment.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">#!/bin/bash
PROJECTNAME=$1
mkdir -p /tmp/${PROJECTNAME}/branches /tmp/${PROJECTNAME}/tags/ /tmp/${PROJECTNAME}/trunks
svnadmin create /svn/${PROJECTNAME}
svn import /tmp/${PROJECTNAME} file:///svn/${PROJECTNAME} -m &quot;initial import&quot;
sudo rm -rf /tmp/${PROJECTNAME}</pre></td></tr></table></div>

<p>Don&#8217;t remember to change mode of this script to execute file and run this script by root permission.</p>
<p><span style="text-decoration: underline;"><strong>Create TRAC </strong></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo trac-admin /trac/YOUR-PROJECT-NAME initenv</pre></td></tr></table></div>

<p>After you run this command you should find some question about your project</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">the project name (YOUR-PROJECT-NAME)
use the default database connection string (sqlite:db/trac.db)
the path to svn repository (/svn/YOUR-PROJECT-NAME)
use the default Trac templates directory (/usr/share/trac/templates)</pre></td></tr></table></div>

<p>Change permission of this project so as to support apache service</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo chown -R www-data /trac/YOUR-PROJECT-NAME</pre></td></tr></table></div>

<p>Woowww, you should find your new project on trac service at http://trac.aoddy.com/YOUR-PROJECT-NAME<br />
<script type="text/javascript"><!--
google_ad_client = "pub-2013111130648878";
google_ad_slot = "7396784224";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aoddy.com/2008/10/17/how-to-install-trac-service-on-ubuntu-for-multiple-projects-using-mod_python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to install DNS server on Ubuntu 8.04.1 .</title>
		<link>http://www.aoddy.com/2008/10/11/how-to-install-dns-server-on-ubuntu-8041/</link>
		<comments>http://www.aoddy.com/2008/10/11/how-to-install-dns-server-on-ubuntu-8041/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 06:39:50 +0000</pubDate>
		<dc:creator>aoddy</dc:creator>
				<category><![CDATA[DNS]]></category>
		<category><![CDATA[Movies]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.aoddy.com/?p=217</guid>
		<description><![CDATA[ได้รับมอบหมายให้มาจัดการกับ Service ต่างๆ ที่ run อยู่ ณ ขณะนี้ใน office โดยพี่เค้าไม่อยากให้ user ต้องมานั่งจำ Service ต่างๆ เป็น IP Address แต่ให้จำเป็นชื่อของ Sub Domain เอา เช่น mail.aoddy.com, backup.aoddy.com, twiki.aoddy.com ฯลฯ โดยเงื่อนไขก็ Basic ทั่วๆไป คือต้องการให้มี DNS Service ที่เป็น Internal ข้างนอกไม่สามารถที่จะเข้ามา Access ได้ คราวนี้ก็มาดูว่า&#8230; รายละเอียดของ Network &#8230; <a href="http://www.aoddy.com/2008/10/11/how-to-install-dns-server-on-ubuntu-8041/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignleft" style="margin: 5px;" title="DNS" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Domain_name_space.svg/675px-Domain_name_space.svg.png" alt="" width="324" height="258" />ได้รับมอบหมายให้มาจัดการกับ Service ต่างๆ ที่ run อยู่ ณ ขณะนี้ใน office โดยพี่เค้าไม่อยากให้ user ต้องมานั่งจำ Service ต่างๆ เป็น IP Address แต่ให้จำเป็นชื่อของ Sub Domain เอา เช่น mail.aoddy.com, backup.aoddy.com, twiki.aoddy.com ฯลฯ โดยเงื่อนไขก็ Basic ทั่วๆไป คือต้องการให้มี DNS Service ที่เป็น Internal ข้างนอกไม่สามารถที่จะเข้ามา Access ได้</p>
<p>คราวนี้ก็มาดูว่า&#8230; รายละเอียดของ Network ผมเป็นอย่างไรบ้าง</p>
<ol>
<li>มี Internal Network เป็น 192.168.0.0/24</li>
<li>IP Address ของ DNS คือ 192.168.0.2 และให้ชื่อเครื่อง ว่า ns.aoddy.com</li>
<li>บนเครื่อง DNS มีจะทำเป็น Virtual Hosting ด้วย</li>
<li>มี Service ที่ต้องใช้ใน Virtual Hosting นี้ก็คือ wwwin.aoddy.com, twiki.aoddy.com และ trac.aoddy.com</li>
</ol>
<p><span id="more-217"></span><br />
<script type="text/javascript"><!--
google_ad_client = "pub-2013111130648878";
google_ad_slot = "7396784224";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<br />
พอเราทราบเงื่อนไขคร่าวๆ แล้วคราวนี้เราก็คงต้องมาทำความรู้จักกับ DNS ซักหน่อยนะครับ กระบวนการก็ง่ายๆครับ เมื่อมีเครื่อง Client ที่อยู่ใน Internal Network ของเราต้องการทราบว่า ไอ้ wwwin.aoddy.com อยู่ที่ไหนมันก็จะวิ่งเข้าไปถามที่ DNS Server ทันที&#8230;อ่าว&#8230;แล้ว Client ไปรู้จัก DNS Server ได้ยังไง ? Client สามารถรู้จัก DNS Server ของเราได้..เพราะว่า</p>
<ol>
<li>มี Admin หน้าตาดีเดินไปบอกว่า..เฮ้ยน้อง ให้ Set DNS เป็น IP เบอร์ 192.168.0.2 นะ</li>
<li>ก็ Admin หน้าตาดีคนเดิม.. ทำการ ตั้ง DHCP Server ขึ้นมาแล้วพอจ่าย IP Address ให้เครื่อง Client ก็ส่ง IP ขอบ DNS Server พร้อมกับ IP ไปด้วย</li>
</ol>
<p>พอมัน&#8230;วิ่งไปถามที่ DNS Server เสร็จ DNS Server ก็จะตอบกลับออกมาเป็น IP Address ของ wwwin.aoddy.com ออกมาซึ่งแน่นอนว่าใน DNS Server ของเราก็ต้องมี List ของ IP Address ดังกล่าว..แต่ถ้าไม่มี..Client ก็อาจจะวิ่งไปถามที่ตัว DNS ตัวที่ 2 ก็ได้ซึ่งนั่นหมายความว่าเราสามารถใส่ IP DNS ที่เครื่องเราได้มากกว่า 1 IP</p>
<p style="text-align: center;"><a href="http://www.aoddy.com/wp-content/uploads/2008/10/563px-an_example_of_theoretical_dns_recursionsvg.png"><img class="size-medium wp-image-218 aligncenter" title="563px-an_example_of_theoretical_dns_recursionsvg" src="http://www.aoddy.com/wp-content/uploads/2008/10/563px-an_example_of_theoretical_dns_recursionsvg-300x106.png" alt="" width="403" height="141" /></a></p>
<p style="text-align: left;">สิ่งที่จะต้องจำเป็นต้องรู้อีกอย่างใน DNS ก็คือ Type of Zone Record ซึ่งมีดังนี้</p>
<ol>
<li><strong>A (Address) Record</strong> เป็น Record ที่เราจะระบุว่า..IP อันนี้ให้ชื่อเป็น wwwin.cisco.com</li>
<li><strong>MX (Mail eXchange) Record</strong> เป็น Record ที่เราจะเอามาใช้ระบุว่า Mail Server ของเรา มี A Record เป็นอะไร ..แสดงว่า MX Record ไม่สามารถที่จะระบุเป็น IP Address ได้นะครับ..เราต้องสร้าง A Record ขึ้นมาก่อน.แล้วค่อย Point MX Record มาที่ A Record ดังกล่าว</li>
<li><strong>NS (Name Server) Record </strong>เป็น Record ที่บอกว่า DNS Server มี A Record เป็นอะไร..อ่ะๆ เหมือนกับ MX Record เลย..คือต้อง สร้าง A Record ขึ้นมาชี้ไปที่ IP ของ DNS Server ก่อนแล้วค่อยกำหนดว่า NS Record เป็น A Record อันนั้นนะ</li>
<li><strong>CNAME (Canonical Name)</strong> Record เป็น Record ที่ถูกเอามาใช้ในกรณีที่เรามีหลาย Service อยู่ในเครื่องเดียวกัน เช่น ftp.aoddy.com อยู่บนเครื่องเดียวกับ wwwin.aoddy.com เป็นตัว..เราก็เอา CNAME มาใช้นั่นเอง</li>
<li><strong>SOA (Start Of Authorities) Record</strong> เป็น Record ที่แตกต่างจากชาวบ้านเค้ามากที่สุดและจำเป็นต้องมีอีกด้วย โดย Record นี้จะบอกให้เราทราบได้ว่า
<ol>
<li>เราจะใช้ Domain เป็นอะไรเช่น @aoddy.com</li>
<li>เป็น Record ที่มีได้แค่ Record เดียวใน Zone File นั้นๆ</li>
<li>มี Timing Information ในกรณีที่เรามี Second DNS Server มันจะทำการเอาข้อมูล Timing ดังกล่าวไป Check กันว่า ตรงกันหรือ เปล่า</li>
</ol>
</li>
</ol>
<p>นอกจากนี้ยังมีค่า TTL (Time To Live) มีหน่วยเป็น &#8220;วินาที&#8221; ซึ่งเป็นค่าที่บอกให้ เราทราบว่า เมื่อใดก็ตามที่มี Client มา lookup ที่ Zone File นี้แล้วใช้เวลาเกินกว่าเวลา TTL ก็ให้ไปถามที่ Secondary DNS แทนนะ จริงๆแล้วค่า TTL นี้เราสามามารถกำหนดเป็น ชั่วโมง(h), หรือ วัน(d) ได้อีกด้วย โดยการเติมตัวอักษร h หรือ d ไว้ข้างหลังตัวเลขนั้นๆ</p>
<p><em><strong>ตัวอย่าง</strong></em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$TTL 86400
my-name.com.          IN     SOA    debns1.my-name.com. \
 joe.my-name.com. &lt;span style=&quot;color: #0000c0;&quot;&gt;{&lt;/span&gt;
 2004011522     ; Serial no., based on date
 21600     ; Refresh after 6 hours
 3600     ; Retry after 1 hour
 604800     ; Expire after 7 days
 3600     ; Minimum TTL of 1 hour
&lt;span style=&quot;color: #0000c0;&quot;&gt;)&lt;/span&gt;
;Name servers
debns1                IN     A       192.168.1.41
debns2.joescuz.com.   IN     A       192.168.1.42
&nbsp;
@                     IN     NS      debns1
my-name.com.          IN     NS      debns2.my-name.com.
&nbsp;
;Mail servers
debmail1              IN     A       192.168.1.51
debmail2.my-name.com. IN     A       192.168.1.52
&nbsp;
@                     IN     MX      10 debmail1
my-name.com.          IN     MX      20 debmail2.my-name.com.
&nbsp;
;Aliased servers
debhp                 IN     A       192.168.1.61
debdell.my-name.com.  IN     A       192.168.1.62
&nbsp;
www                   IN     CNAME   debhp
ftp.my-name.com.      IN     CNAME   debdell.my-name.com.</pre></td></tr></table></div>

<p>หลังจากที่เรารู้จักกับ DNS มากันพอสมควรแล้วคราวนี้..เราก็มาเริ่มการติดตั้งกันดีกว่า ครับ</p>
<p><span style="text-decoration: underline;"><em><strong>Install phase</strong></em></span></p>
<p>1. การติดตั้ง Package ที่จะต้องใช้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo aptitude install bind9 dnsutils</pre></td></tr></table></div>

<p>** dnsutils เป็น package ที่ช่วยทำให้ Client ที่มีความแต่งต่างกันเวลาเรียกใช้ DNS Server จะได้ Output ที่เหมือนๆกัน</p>
<p>2. ข้อดีของ BIND อีกอย่างที่เด่นชัดก็คือ ตัว Software สามารถที่จะแบ่งออกเป็น External DNS และ Internal DNS ได้ในเครื่องเดียวกัน..แต่เราจะ Focus แค่ใน Internal Network เท่านั้น..(แต่ External ก็ Comment ไว้..สร้าง Directory เผื่อไว้ใช้ในอนาคตด้วย) คราวนี้ก็มาสร้าง ACL เผื่อที่จะกำหนดว่าให้ User ที่อยู่ใน Network วงไหนที่จะสามารถวิ่งเข้ามาใช้ DNS Service ของเราได้บ้าง โดยการเข้าไปแก้ไขที่ ไฟล์ /etc/bind/named.conf.local</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo vi /etc/bind/named.conf.local
&lt;pre&gt;acl internals {
    127.0.0.0/8;
    192.168.0.0/24;
    192.168.1.0/24;
};
&nbsp;
include &quot;/etc/bind/aoddy.com.conf&quot;;</pre></td></tr></table></div>

</pre>
<p>3. เข้าไปแก้ไขไฟล์ /etc/bind/aoddy.com.conf ดังนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">view &quot;internal&quot; {
    match-clients { internals; };
    zone &quot;aoddy.com&quot; IN {
        type master;
        file &quot;/etc/bind/internal/aoddy.com.fwd&quot;;
        allow-update { none; };
    };
    zone &quot;0.168.192.in-addr.arpa&quot; IN {
        type master;
        file &quot;/etc/bind/internal/aoddy.com.rev&quot;;
        allow-update { none; };
    };
};
# Comment ที้งไว้ เผื่อใช้ในอนาคค
#view &quot;external&quot; {
#    match-clients { any; };
#    zone &quot;aoddy.com&quot; IN {
#        type master;
#        file &quot;/etc/bind/external/aoddy.com.fwd&quot;;
#        allow-update { none; };
#    };
#    zone &quot;223.222.111.in-addr.arpa&quot; IN {
#        type master;
#        file &quot;/etc/bind/external/aoddy.com.rev&quot;;
#        allow-update { none; };
#    };
#};</pre></td></tr></table></div>

<p>4. เข้าไปที่ Directory /etc/bind แล้วก็ทำการสร้าง Directory ที่ชื่อว่า internal และ external หลังจากนั้นก็เข้าไปใน directory ที่ชื่อว่า internal แล้วก็สร้างไฟล์ขึ้นมา 2 ไฟล์ คือ aoddy.com.fwd และ aoddy.com.rev โดยมีรายละเอียดดังนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo vi /etc/bind/internal/aoddy.com.fwd
&nbsp;
$TTL    86400
@       IN  SOA ns.aoddy.com. root.ns.aoddy.com. (
                2008101100      ; serial (d. adams)
                3H      ; refresh
                15M     ; retry
                1W      ; expiry
                1D )    ; minimum
@       IN  NS  ns.aoddy.com.    ; primary NS
&nbsp;
wwwin     IN  CNAME   ns
twiki     IN  CNAME   ns
trac      IN  CNAME   ns
; append or edit host file here
ns        IN  A   192.168.0.1</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo vi /etc/bind/internal/aoddy.com.rev
$TTL    86400
@       IN  SOA ns.aoddy.org. root.ns.aoddy.org. (
                20081011      ; serial (d. adams)
                3H      ; refresh
                15M     ; retry
                1W      ; expiry
                1D )    ; minimum
@       IN  NS  ns.aoddy.org.    ; primary NS
&nbsp;
2   IN  PTR ns.aoddy.com.
2   IN  PTR wwwin.aoddy.com.
2   IN  PTR twiki.aoddy.com.
2   IN  PTR trac.aoddy.com.</pre></td></tr></table></div>

<p>ตัว "@" ก็คือชื่อ Zone ซึ่งในที่นี่จะมีค่าเป็น aoddy.com ซึ่งเป็นค่าที่เราระบุใน aoddy.com.conf นั่น</p>
<p>5. ไฟล์ที่เราสร้างไปจะมี owner เป็น root เราต้องเปลี่ยน owner เป็น bind account ด้วย..ทำแบบนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ cd /etc/bind/
$ sudo chown -R bind:bind *</pre></td></tr></table></div>

<p>6. ทำการ Start DNS Server service โดยใช้ command ดังนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo /etc/init.d/bind9 restart</pre></td></tr></table></div>

<p>7. แน่นอนว่า..เราต้องการให้ DNS Server เรา Start ตอนที่มัน Boot แบบ autumatic ก็ใช Command ดังนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$ sudo update-rc.d &lt;span&gt;bind9 &lt;span&gt;defaults&lt;/span&gt;&lt;/span&gt;</pre></td></tr></table></div>

<p>** จาก command ตรงนี้มันจะ Start service DNS Server ที่ Run Level 2,3,4 และ 5</p>
<p><span style="text-decoration: underline;"><em><strong>Test phase</strong></em></span></p>
<p>หลังจากติดตั้งเสร็จก็มา ทดสอบกันครับว่า ไอ้ที่เราทำไปมัน Work หรือเปล่า วิธี Test ก็ง่ายๆ ด้วยการใช้ Command nslookup เช่น</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">aoddy@ns:~$ nslookup
&amp;gt; wwwin
Server:        192.168.0.2
Address:    192.168.0.2#53
&nbsp;
wwwin.aoddy.com    canonical name = ns.aoddy.com.
Name:    ns.aoddy.com
Address: 192.168.0.2
&amp;gt; twiki
Server:        192.168.0.2
Address:    192.168.0.2#53
&nbsp;
twiki.aoddy.com    canonical name = ns.aoddy.com.
Name:    ns.aoddy.com
Address: 192.168.0.2
&amp;gt; 192.168.0.2
Server:        192.168.0.2
Address:    192.168.0.2#53
&nbsp;
2.0.168.192.in-addr.arpa    name = trac.aoddy.com.
2.0.168.192.in-addr.arpa    name = wwwin.aoddy.com.
2.0.168.192.in-addr.arpa    name = ns.aoddy.com.
2.0.168.192.in-addr.arpa    name = twiki.aoddy.com.</pre></td></tr></table></div>

<p><script type="text/javascript"><!--
google_ad_client = "pub-2013111130648878";
google_ad_slot = "7396784224";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<br />
<span style="text-decoration: underline;"><em><strong>Site referrence</strong></em></span></p>
<ol>
<li><a title="DNS on debain" href="http://aboutdebian.com/dns.htm" target="_blank">http://aboutdebian.com/dns.htm</a></li>
<li><a title="Domain Name System" href="http://en.wikipedia.org/wiki/Domain_Name_System" target="_blank">http://en.wikipedia.org/wiki/Domain_Name_System</a></li>
<li><a title="Bind9 การให้บริการเครื่อข่ายภายในและภายนอก" href="http://www.thaitux.info/node/478" target="_blank">http://www.thaitux.info/node/478</a></li>
<li><a href="http://catadmin.cattelecom.com/km/blog/adisornk/2007/08/01/enabling-and-disabling-services-during-start-up-in-ubuntu/" target="_blank">http://catadmin.cattelecom.com/km/blog/adisornk/2007/08/01/enabling-and-disabling-services-during-start-up-in-ubuntu/</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.aoddy.com/2008/10/11/how-to-install-dns-server-on-ubuntu-8041/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to install DNS server on CentOS 5.</title>
		<link>http://www.aoddy.com/2007/11/18/how-to-install-dns-server-on-centos-5/</link>
		<comments>http://www.aoddy.com/2007/11/18/how-to-install-dns-server-on-centos-5/#comments</comments>
		<pubDate>Sun, 18 Nov 2007 08:27:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[DNS]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.aoddy.com/2007/11/18/how-to-install-dns-server-on-centos-5/</guid>
		<description><![CDATA[In the first time, you must download core software of this service, that are bind caching-nameserver bind-chroot You can download this software by this command, # yum -y install bind caching-nameserver bind-chroot After you downloaded , you can setup follow &#8230; <a href="http://www.aoddy.com/2007/11/18/how-to-install-dns-server-on-centos-5/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>    In the first time, you must download core software of this service, that are</p>
<ol>
<li>bind</li>
<li>caching-nameserver</li>
<li>bind-chroot</li>
</ol>
<p>You can download this software by this command,</p>
<p><em><strong># yum -y install bind caching-nameserver bind-chroot</strong></em></p>
<p>After you downloaded , you can setup follow this instruction :</p>
<p><span id="more-55"></span></p>
<p>1.  Check your hostname by this command :</p>
<p># uname -n<br />
dns.aoddy.com</p>
<p>2. Edit /etc/named.conf</p>
<table bgcolor="black" width="80%">
<tr>
<td><font color="white"> options {<br />
directory &#8220;/var/named&#8221;;<br />
forwarders {WWW.XXX.YYY.ZZZ;};         // IP of ISP</font><font color="white">        // query-source address * port 53;<br />
allow-query { localhost; 192.168.0.0/24;};<br />
</font><font color="white">     // query range<br />
allow-transfer { localhost; 192.168.0.0/24;};<br />
// transfer range<br />
allow-recursion { localhost; 192.168.0.0/24;};<br />
// recursion range<br />
};</font><font color="white">controls {<br />
inet 127.0.0.1 allow { localhost; } keys { rndckey; };<br />
};</font><font color="white">// here is the section for internal informations</font><font color="white">view &#8220;internal&#8221; {<br />
match-clients {<br />
localhost;<br />
192.168.0.0/24;<br />
};</font><font color="white">      zone &#8220;.&#8221; IN {<br />
type hint;<br />
file &#8220;named.ca&#8221;;<br />
};</font><font color="white">      zone &#8220;aoddy.com&#8221; IN {<br />
// for common resolving<br />
type master;<br />
file &#8220;aoddy.com.fwd&#8221;;<br />
allow-update { none; };<br />
};</font><font color="white">      zone &#8220;0.168.192.in-addr.arpa&#8221; IN {<br />
// for reverse resolving *note<br />
type master;<br />
file &#8220;aoddy.com.rev&#8221;;<br />
allow-update { none; };<br />
};</font></p>
<p><font color="white">        zone &#8220;localdomain&#8221; IN {<br />
type master;<br />
file &#8220;localdomain.zone&#8221;;<br />
allow-update { none; };<br />
};</font></p>
<p><font color="white">        zone &#8220;localhost&#8221; IN {<br />
type master;<br />
file &#8220;localhost.zone&#8221;;<br />
allow-update { none; };<br />
};</font></p>
<p><font color="white">        zone &#8220;0.0.127.in-addr.arpa&#8221; IN {<br />
type master;<br />
file &#8220;named.local&#8221;;<br />
allow-update { none; };<br />
};</font></p>
<p><font color="white">        zone &#8220;255.in-addr.arpa&#8221; IN {<br />
type master;<br />
file &#8220;named.broadcast&#8221;;<br />
allow-update { none; };<br />
};</font></p>
<p><font color="white">        zone &#8220;0.in-addr.arpa&#8221; IN {<br />
type master;<br />
file &#8220;named.zero&#8221;;<br />
allow-update { none; };<br />
};</font></p>
<p><font color="white">};</font></p>
<p><font color="white">// here is the section for external informations<br />
view &#8220;external&#8221; {<br />
match-clients {<br />
any;<br />
};</font></p>
<p><font color="white">        zone &#8220;.&#8221; IN {<br />
type hint;<br />
file &#8220;named.ca&#8221;;<br />
};</font></p>
<p><font color="white">        zone &#8220;server-linux.info&#8221; IN {<br />
// for common resolvin<br />
type master;<br />
file &#8220;server-linux.info.wan&#8221;;<br />
allow-update { none; };</font></p>
<p><font color="white">        };</font></p>
<p><font color="white">        zone &#8220;80.0.16.172.in-addr.arpa&#8221; IN {<br />
// for reverse resolving *note<br />
type master;<br />
file &#8220;80.0.16.172.db&#8221;;<br />
allow-update { none; };<br />
};<br />
};<br />
include &#8220;/etc/rndc.key&#8221;;</font></td>
</tr>
</table>
<p>2. Create /var/named/aoddy.com.fwd</p>
<table bgcolor="black" width="80%">
<tr>
<td><font color="white"><br />
$TTL    86400<br />
@       IN      SOA     dns.aoddy.com. root.aoddy.com.(<br />
1997022700      ; Serial<br />
28800           ; Refresh<br />
14400           ; Retry<br />
3600000         ; Expire<br />
86400 )         ; Minimum<br />
IN      NS      dns.aoddy.com.<br />
IN      MX 10   dns.aoddy.com.<br />
IN      MX 20   web.aoddy.com.<br />
IN      A       192.168.0.2<br />
dns            IN      A       192.168.0.2<br />
web           IN       A       192.168.0.3<br />
</font></td>
</tr>
</table>
<p>3. Create file /var/named/aoddy.com.rev</p>
<table bgcolor="black" width="80%">
<tr>
<td><font color="white"><br />
$TTL    86400<br />
@       IN      SOA     dns.aoddy.com. root.aoddy.com.(<br />
1997022700      ; Serial<br />
28800           ; Refresh<br />
14400           ; Retry<br />
3600000         ; Expire<br />
86400 )         ; Minimum<br />
IN      NS      dns.aoddy.com.<br />
IN      MX 10   dns.aoddy.com.<br />
IN      MX 20   web.aoddy.com</font><font color="white"><br />
IN      PTR     dns.aoddy.com.<br />
2               IN      PTR     dns.aoddy.com.<br />
3               IN      PTR     web.aoddy.com.<br />
</font></td>
</tr>
</table>
<p>4. Start service</p>
<p># service named restart</p>
<p>5. Test this server can resolve domain&amp;ip</p>
<table bgcolor="black" width="80%">
<tr>
<td><font color="white">[root@dns named]# nslookup<br />
&gt; dns.aoddy.com<br />
Server:         192.168.0.2<br />
Address:        192.168.0.2#53</font><font color="white">Name:   dns.aoddy.com<br />
Address: 192.168.0.2</font></p>
<p><font color="white">&gt; 192.168.0.2<br />
Server:         192.168.0.2<br />
Address:        192.168.0.2#53</font></p>
<p><font color="white">2.0.168.192.in-addr.arpa name = dns.aoddy.com.<br />
&gt;</font></td>
</tr>
</table>
<p>6. If your service can&#8217;t resolve , you can check on your file config by this command :</p>
<p># named-checkconf</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aoddy.com/2007/11/18/how-to-install-dns-server-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

