Config DNS Server Ubuntu
Config DNS Server Ubuntu
Config DNS Server Ubuntu
MONGKOL RODJAN
BIND
➤ Domain Name Service (DNS)
is an Internet service that
maps IP addresses and fully
qualified domain names
(FQDN) to one another.
➤ Computers that run DNS are
called name servers.
➤ Ubuntu ships with BIND
(Berkley Internet Naming
Daemon).
➤ BIND require static ip
address.
2
BIND9 CONFIGURATION SCENARIOS
➤ Caching Server
In this configuration BIND9 will find the answer to name queries and remember the answer for the next query. This can be useful for a slow
internet connection. By caching DNS queries, you will reduce bandwidth and (more importantly) latency.
➤ Primary Master Server
BIND9 can be used to serve DNS records (groups of records are referred to as zones) for a registered domain name or an imaginary one (but
only if used on a restricted network).
➤ Secondary Master Server
A secondary master DNS server is used to complement a primary master DNS server by serving a copy of the zone(s) configured on the
primary server. Secondary servers are recommended in larger setups. If you intend to serve a registered domain name they ensure that your
DNS zone is still available even if your primary server is not online.
➤ Hybrids
You can even configure BIND9 to be a Caching and Primary Master DNS server simultaneously, a Caching and a Secondary Master server or
even a Caching, Primary Master and Secondary Master server. All that is required is simply combining the different configuration examples.
➤ Stealth Servers
There are also two other common DNS server setups (used when working with zones for registered domain names), Stealth Primary and
Stealth Secondary. These are effectively the same as Primary and Secondary DNS servers, but with a slight organizational difference.
For example, you have 3 DNS servers; A, B and C.
A is the Primary, B and C are secondaries.
If you configure your registered domain to use A and B as your domain's DNS servers, then C is a Stealth Secondary. It's still a secondary, but
it's not going to be asked about the zone you are serving to the internet from A and B
If you configure your registered domain to use B and C as your domain's DNS servers, then A is a stealth primary. Any additional records or
edits to the zone are done on A, but computers on the internet will only ever ask B and C about the zone.
3
DNS RECORD TYPES
Address Records
The most commonly used type of record. This record maps an IP Address to a hostname.
www IN A 1.2.3.4
Alias Records
Used to create an alias from an existing A record. You can create a CNAME record pointing to another CNAME record. But it doubles the number of requests made to the
nameserver, thus making it an inefficient way to do so.
IN MX 10 mail.example.com.
[...]
mail IN A 1.2.3.4
IN NS ns.example.com.
[...]
ns IN A 1.2.3.4
4
HOW TO CUT AND PASTE TEXT IN PICO
1. Move the cursor to the first line of the text you want to cut.
2. Press Ctrl+^ to mark the beginning of the text you want to
cut. (Note that Ctrl+^ is really Ctrl+Shift+6 —it might work
without Shift, but it might not, depending on your terminal
program. Try it out and see what happens.)
3. Use the arrow keys to move the cursor to the end of the text
you want to cut.
4. Cut text use Ctrl+K
5. Using the arrow keys, move the cursor to where you want to
insert the cut text.
6. Paste text use Ctrl+U
5
BIND9 CONFIGURATIONS PRIMARY MASTER SERVER
➤ Installation
#sudo apt-get install bind9
6
CONFIG IP ADDRESS
#sudo pico /etc/network/interfaces
7
BIND9 CONFIGURATIONS PRIMARY MASTER SERVER
➤ Forward Zone File
#pico /etc/bind/named.conf.local
include “/etc/bind/zones.rfc1918”;
#pico /etc/bind/zones.rfc1918
zone "netos.com" {
type master;
file "/etc/bind/db.netos.com";
};
8
BIND9 CONFIGURATIONS PRIMARY MASTER SERVER
#sudo cp /etc/bind/db.local /etc/bind/db.netos.com
#sudo pico /etc/bind/db.netos.com
$TTL 604800
@ IN SOA netos.com. root.netos.com. (
2016042101 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
IN A 192.168.1.1
;
@ IN NS ns.netos.com.
@ IN A 192.168.1.1
@ IN AAAA ::1
ns IN A 192.168.1.1
9
BIND9 CONFIGURATIONS PRIMARY MASTER SERVER
➤ Reverse Zone File
#pico /etc/bind/zones.rfc1918
zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.192";
};
10
BIND9 CONFIGURATIONS PRIMARY MASTER SERVER
#sudo cp /etc/bind/db.127 /etc/bind/db.192
#sudo pico /etc/bind/db.192
$TTL 604800
@ IN SOA ns.netos.com. root.netos.com. (
2016042101 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.
1 IN PTR ns.netos.com.
11
LAMP (LINUX-APACHE-MYSQL-PHP)
MONGKOL RODJAN
12
LAMP INSTALLATION
#sudo apt-get update
#sudo apt-get install lamp-server^
13
CONFIG IP ADDRESS
#sudo pico /etc/network/interfaces
14
APACHE2 CONFIGURATIONS
After config then restart service apache2
15
APACHE2 CONFIGURATIONS
➤ Virtual Hosts
Create directory for virtual host
#mkdir /var/www/mail
#cd /var/www/mail
#pico index.html
#pico index.php
<?php phpinfo(); ?>
16
APACHE2 CONFIGURATIONS
➤ Virtual Hosts
To create a new site:
1. Copy the default website as a starting point.
#cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mail.netos.com.conf
2. Edit the new configuration file in a text editor.
#sudo pico /etc/apache2/sites-available/mail.netos.com.conf
ServerName netos.com
ServerAlias mail.netos.com
ServerAdmin webmaster@netos.com
DocumentRoot /var/www/mail
17
PHP
➤ Config file
/etc/php5/apache2/php.ini
18
PHP
➤ Config file
/etc/php5/apache2/php.ini
➤ After config restart service apache
#sudo service apache2 restart
MYSQL
➤ Config file
/etc/mysql/my.cnf
➤ After config restart service MySQL
#sudo service mysql restart
➤ Install phpmyadmin
#sudo apt-get install phpmyadmin 19
20