Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- install bind9:
- sudo apt-get install bind9
- add dns forwarders to /etc/bind/named.conf.options:
- sudo nano /etc/bind/named.conf.options
- add internet provider dns server ip or other dns server like google in the forwarders section:
- forwarders
- {
- 8.8.8.8;
- 8.8.4.4;
- };
- define forward lookup zone and reverse lookup zone to /etc/bind/named.conf.local:
- sudo nano /etc/bind/named.conf.local
- for forward lookup zone whose network ip is 192.168.254.0:
- zone "myowndomain.com"
- {
- type master;
- file "/etc/bind/zones/myowndomain.com.db";
- };
- for reverse lookup zone for the 192.168.254.0 network:
- zone "254.168.192.in-addr.arpa"
- {
- type master;
- file "rev.254.168.192.in-addr.arpa";
- };
- create the zones folder:
- sudo mkdir /etc/bind/zones
- create the forward lookup zone file myowndomain.com.db:
- sudo nano /etc/bind/zones/myowndomain.com.db
- add the following entry to the file:
- the number value below is for serial#, refresh, retry, expire, minimum:
- $TTL 3D
- @ IN SOA server1.myowndomain.com. admin.myowndomain.com. (
- 2007031001;
- 28800;
- 3600;
- 604800;
- 38400
- );
- myowndomain.com. IN NS server1.myowndomain.com.
- server1 IN A 192.168.254.254
- server2 IN A 192.168.254.250
- gateway IN A 192.168.254.1
- www IN CNAME server1
- create the reverse lookup zone file rev.254.168.192.in-addr.arpa:
- sudo nano /etc/bind/zones/rev.254.168.192.in-addr.arpa
- add the following entry to the file:
- the number value below is for serial#, refresh, retry, expire, minimum:
- $TTL 3D
- @ IN SOA server1.myowndomain.com. admin.myowndomain.com. (
- 2007031001;
- 28800;
- 3600;
- 604800;
- 38400
- );
- IN NS server1.myowndomain.com.
- 254 IN PTR server1.myowndomain.com.
- 250 IN PTR server2.myowndomain.com.
- 1 IN PTR gateway.myowndomain.com.
- edit resolv.conf:
- sudo nano /etc/resolv.conf
- add dns suffix search:
- search myowndomain.com
- point dns resolution to the local dns server:
- nameserver 192.168.254.254
- restart bind9:
- sudo /etc/init.d/bind9 restart
- test dns resolution with nslookup:
- nslookup server1
- nslookup server2
- nslookup gateway
- to check if the config files have no errors:
- named-checkconf /etc/bind/named.conf.options
- named-checkconf /etc/bind/named.conf.local
- to check if the zone files have no errors:
- named-checkzone myowndomain.com /etc/bind/zones/myowndomain.com.db
- named-checkzone 254.168.192.in-addr.arpa /etc/bind/zones/rev.254.168.192.in-addr.arpa
- ---------------------------------------------------------------------------------------
- use dig command to check dns:
- check via FQDN (check status, question section, answer section, authority section):
- dig server1.myowndomain.com | less
- check via IP address (check status, question section, answer section, authority section, additional section):
- dig -x 192.168.254.254 | less
- check SOA records of myowndomain.com (check status, question section, answer section, authority section, additional section):
- dig -t SOA mydomain.com | less
- check zone transfers and all records:
- dig -t axfr myowndomain.com | less
- -----------------------------------------------------------------------------------------
- use host command to check dns:
- check via FQDN:
- host server1.myowndomain.com
- check via domain name:
- host myowndomain.com
- check via IP address:
- host 192.168.254.254
- =========================================================================================
- FORWARD ZONE:
- $ORIGIN .
- $TTL 86400 ; 1day
- myowndomain.com. IN SOA server1.myowndomain.com. hostmaster.myowndomain.com. (
- 2014012001 ; serial - YYYYMMDDII format
- 8H ; refresh
- 4H ; retry
- 3W ; expires
- 1D ; minimum
- )
- myowndomain.com. IN NS server1.myowndoamin.com.
- myowndomain.com. IN MX 10 server1.myowndomain.com.
- $ORIGIN myowndomain.com.
- server1 IN A 192.168.254.254
- server2 IN A 192.168.254.250
- gateway IN A 192.168.254.1
- www IN CNAME server1
- ----------------------------------------------------------------------------------------
- REVERSE ZONE:
- @ IN SOA server1.myowndomain.com. hostmaster.myowndomain.com. (
- 2014012001 ; serial - YYYYMMDDII format
- 8H ; refresh
- 4H ; retry
- 3W ; expires
- 1D ; minimum
- )
- IN NS server1.myowndomain.com.
- 254 IN PTR server1.myowndomain.com.
- 250 IN PTR server2.myowndomain.com.
- 1 IN PTR gateway.myowndomain.com.
- =======================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement