First we need to install dns packages.
sudo apt-get install bind9
sudo apt-get install dnsutils
Then we have to edit the file /etc/bind/named.conf.local
sudo gedit /etc/bind/named.conf.local
then type the following content
zone “example1.com” {
type master;
file “/etc/bind/db.example1.com”;
};
zone “example2.com” {
type master;
file “/etc/bind/db.example2.com”;
};
zone “example3.com” {
type master;
file “/etc/bind/db.example3.com”;
};
zone “1.168.192.in-addr.arpa” {
type master;
file “/etc/bind/db.192”;
};
then save the file and exit.then create db.example1.com,db.example2.com,db.example3.com,db.192 files inside /etc/bind directory by execitng the command.
sudo cd /etc/bind
sudo cp db.local db.example1.com
sudo cp db.local db.example2.com
sudo cp db.local db.example3.com
sudo cp db.127 db.192
sudo gedit /etc/bind/db.example1.com
then edit the file as given below.
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA http://www.example1.com. root.www.example1.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS http://www.example1.com.
@ IN A 192.168.1.16
www IN A 192.168.1.16
then save the file and exit.
sudo gedit /etc/bind/db.example2.com
edit this file also with the below given content.
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA http://www.example2.com. root.www.example2.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS http://www.example2.com.
@ IN A 192.168.1.16
www IN A 192.168.1.16
then save and exit the file.
sudo gedit /etc/bind/db.example3.com
then edit the below given content
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA http://www.example3.com. root.example3.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS http://www.example3.com.
@ IN A 192.168.1.16
www IN A 192.168.1.16
then save and exit the file.
sudo gedit /etc/bind/db.192
and edit this file with the given content
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA localhost. root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
16 IN PTR http://www.example1.com.
16 IN PTR http://www.example2.com.
16 IN PTR http://www.example3.com.
then save and exit the file.
then restart the bind9 service
/etc/init.d/bind9 restart
then we can check whether dns properly configured or not by executing the command.
you should get a result like this.
http://www.example1.com has address 192.168.1.16
again you should get a result like this
http://www.example2.com has address 192.168.1.16
the result should be like this
http://www.example3.com has address 192.168.1.16
then,
host 192.168.1.16
the result should be something like this
16.1.168.192.in-addr.arpa domain name pointer http://www.example1.com 1.168.192.in-addr.arpa.
16.1.168.192.in-addr.arpa domain name pointer www.example2.com 1.168.192.in-addr.arpa
16.1.168.192.in-addr.arpa domain name pointer www.example3.com 1.168.192.in-addr.arpa
That’s it we have now configured multiple domains for single ip
Now, to ping with our newly configured Domains, just edit resolv.conf file.
Sudo gedit /etc/resolv.conf
nameserver 192.168.1.16
then save and exit the file.
Now we can ping to our Domains.
January 2, 2011 at 6:33 am |
hi kindly visit this too https://wiki.ubuntu.com/karthick87
January 23, 2014 at 1:20 pm |
Impressive issues in this article. We’re quite satisfied to see your write-up. Thank you and i am looking ahead to get hold of an individual. Are you going to remember to decrease me a mailbox?
February 12, 2014 at 12:21 pm |
Hello,
thanks for this tutorial.
The fellowing section seems to contain little errors:
@ IN NS localhost.
16 IN PTR http://www.example1.com.
16 IN PTR http://www.example2.com.
16 IN PTR http://www.example3.com.
it should be
@ IN NS localhost.
16 IN PTR http://www.example1.com.
16 IN PTR http://www.example2.com.
16 IN PTR http://www.example3.com.
😉
February 12, 2014 at 12:23 pm |
oupps it seems that http:// is added by the wordpress software …
the http:// after the PTR instruction should be leaved.
June 11, 2014 at 4:48 am |
Amazing issues here. I’m very glad to peer your post.
Thank you a lot and I’m looking ahead too contact you. Will you
kindly drop me a mail?
June 12, 2014 at 12:26 am |
Hi everyone, it’s my first pay a visit at this website, and post
is in fact fruitful for me, keep up posting these posts.
August 5, 2014 at 1:28 am |
This is my first time pay a quick visit at here and i am actually pleassant to read
all at alone place.