Archive for the ‘Uncategorized’ Category

Multiple Domains under one ip in ubuntu 9.10 server

April 22, 2010

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.

host http://www.example1.com

you should get a result like this.

http://www.example1.com has address 192.168.1.16

host http://www.example2.com

again you should get a result like this

http://www.example2.com has address 192.168.1.16

host http://www.example3.com

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.

Advertisements