-
-
Save agr-shrn/41b431de24dcd82d0014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In localhost | |
1. WE NEED TO CHANGE ENTRIES OF /ETC/HOSTS FILE | |
127.0.0.1 localhost | |
127.0.0.1 localhost | |
10.2.0.30 cit | |
--------------------------------------------------------------------------------------------------------------------------------------- | |
IN LAN | |
1. sudo apt-get install dnsmasq | |
2. gedit /etc/dnsmasq.conf | |
3. Uncomment the following lines: | |
domain-needed | |
bogus-priv | |
no-resolv | |
no-poll | |
server=/example.com/192.168.0.5 | |
server=8.8.8.8 | |
server=208.67.220.220 | |
local=/example.com/ | |
address=/doubleclick.net/127.0.0.1 | |
no-hosts | |
addn-hosts=/etc/dnsmasq.d/hosts.conf | |
expand-hosts | |
domain=example.com | |
dhcp-range=192.168.0.20,192.168.0.50,72h | |
dhcp-range=tftp,192.168.0.250,192.168.0.254 | |
hcp-host=mylaptop,192.168.0.199,36h | |
dhcp-option=option:router,192.168.0.1 | |
dhcp-option=option:ntp-server,192.168.0.5 | |
dhcp-option=19,0 # ip-forwarding off | |
dhcp-option=44,192.168.0.5 # set netbios-over-TCP/IP aka WINS | |
dhcp-option=45,192.168.0.5 # netbios datagram distribution server | |
dhcp-option=46,8 # netbios node type | |
4. gedit /etc/dnsmasq.d/hosts.conf | |
5. Add a list of local machines with static IP addresses in the same format as the hosts file | |
For exmaple: | |
192.168.0.8 mail mail.example.com | |
192.168.0.9 smtp smtp.example.com | |
192.168.0.120 mythtvbox mythtvbox.example.com | |
instead of the given IP's we need to add the addresses of those systems which are connected to the network. | |
6. sudo service dnsmasq start | |
7. sudo service dnsmasq stop | |
8. sudo service dnsmasq restart | |
9. You can now test using the adresses added in the hosts file. | |
Sorce: http://blogging.dragon.org.uk/howto-setup-dnsmasq-as-dns-dhcp/ | |
--------------------------------------------------------------------------------------------------------------------------------------- | |
WITH A FOREIGN SERVER GIVEN(We have used Karizna): | |
1. sudo apt-get update | |
2. sudo apt-get install bind9 | |
3. gedit /etc/bind/named.conf.options | |
4. Uncomment the following: | |
forwarders { | |
8.8.8.8; | |
8.8.4.4; | |
}; | |
5. sudo service bind9 restart | |
6. gedit /etc/resolv.conf | |
7. Edit nameserver ip to 127.0.0.1 or your serverIP. | |
nameserver 127.0.0.1 | |
8. sudo cp /etc/bind/db.local /etc/bind/db.krizna.com | |
9. gedit /etc/bind/db.krizna.com | |
10. The edited version of the file: | |
; BIND data file for local loopback interface | |
; | |
$TTL 604800 | |
@ IN SOA ns.krizna.com. root.ns.krizna.com. ( | |
2 ; Serial | |
604800 ; Refresh | |
86400 ; Retry | |
2419200 ; Expire | |
604800 ) ; Negative Cache TTL | |
; | |
@ IN NS ns.krizna.com. | |
@ IN A 192.168.6.5 | |
@ IN AAAA ::1 | |
ns IN A 192.168.6.5 | |
www IN A 192.168.6.10 | |
11. sudo cp /etc/bind/db.127 /etc/bind/db.192 | |
12. gedit /etc/bind/db.192 | |
13. Edited version of the file: | |
; BIND reverse data file for local loopback interface | |
; | |
$TTL 604800 | |
@ IN SOA ns.krizna.com. root.ns.krizna.com. ( | |
1 ; Serial | |
604800 ; Refresh | |
86400 ; Retry | |
2419200 ; Expire | |
604800 ) ; Negative Cache TTL | |
; | |
@ IN NS ns. | |
5 IN PTR ns.krizna.com. | |
10 IN PTR www.krizna.com. | |
14. gedit /etc/bind/named.conf.local | |
15. Edited version of the file: | |
// Forward zone | |
zone "krizna.com" { | |
type master; | |
file "/etc/bind/db.krizna.com"; | |
}; | |
//reverse zone | |
zone "6.168.192.in-addr.arpa" { | |
type master; | |
file "/etc/bind/db.192"; | |
}; | |
instead of 6.168.192 add the first three octets of your network ip. | |
16. sudo service bind9 restart | |
17. Now test using nslookup command. | |
18. nslookup www.krizna.com | |
19. Output: | |
Server: 127.0.0.1 | |
Address: 127.0.0.1#53 | |
Name: www.krizna.com | |
Address: 192.168.6.10 | |
20. nslookup 172.27.6.10 | |
21. Output: | |
Server: 127.0.0.1 | |
Address: 127.0.0.1#53 | |
10.6.27.172.in-addr.arpa name = www.krizna.com. | |
--------------------------------------------------------------------------------------------------------------------------------------- | |
Source: http://www.krizna.com/ubuntu/configure-dns-server-ubuntu-14-04/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment