Menu
Online Notes
  • Privacy Policy
Online Notes

dnsmasq : For my local network

Posted on December 22, 2019 by sandeep

Need was to have a DNS service serving my local network name resolutions. After surfing on multiple how tos, found dnsmasq would suffice my needs.

Install dnsmasq

#apt install -y dnsmasq

Edit the configuration file and updated the following entries (uncomment if commented)

# Never forward plain names (without a dot or domain part)
domain-needed

# Never forward addresses in the non-routed address spaces.
bogus-priv 

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
local=/localnet/

# Add domains which you want to force to an IP address here.
# The example below send any host in sandeeprao.net to a local
# web-server 10.1.1.4
address=/sandeeprao.net/10.1.1.4

# Need to listen for dns requests from multiple networks associated
# with multiple interfaces - so added the following
listen-address=127.0.0.1
listen-address=10.1.1.3
listen-address=10.1.2.3
listen-address=10.1.3.3

The contents of /etc/resolv.conf in this system is as follows, Only local network dns queries are answered from /etc/hosts remaining get forwarded to the dns servers configured in the system.

nameserver 10.1.1.1
nameserver 8.8.4.4

Now update your /etc/hosts with your local network dns requirements, some sample entries

10.1.1.2        dcserver dcserver.xxx.net
10.1.1.3        dcdns dcdns.xxx.net
10.1.1.4        blog sandeeprao.net
10.1.2.5        db1 db1.xxx.net
10.1.2.6        db2 db2.xxx.net
10.1.2.7        db3 db3.xxx.net
10.1.2.10       haproxy1 haproxy.xxx.net
10.1.2.11       haproxy2 haproxy.xxx.net
10.1.2.12       dbvip dbvip.xxx.net

Restart dnsmasq service

service dnsmasq restart

Configure 10.1.1.3 (ip where dnsmasq was configured) as name server in your client systems and you will find dns resolutions work for local network and also get resolved for external networks.

Buster Debian DNS dns for local network dnsmasq local network
Howto Installation Steps

Recent Posts

  • Launching an instance
  • Removing compute node/host from an Openstack deployment
  • Cinder – Block storage services – Storage Nodes
  • Cinder – Block storage service – Controller node
  • Horizon – Dashboard on Controller Node
  • Neutron – Networking service on Compute nodes
  • Neutron – Networking service on Controller node
  • Nova – Compute services on Compute nodes
  • Nova – Compute services on Controller node
  • Placement services on Controller Node

Recent Comments

  • Adding ClamAV Anti-virus checks to existing Postfix, Amavis+Spamassasin configuration – Online Notes on Configuring secure mail server using Postfix with Dovecot, Amavis, Spamassasin, Postgrey and OpenDKIM

Archives

  • October 2020
  • February 2020
  • January 2020
  • December 2019

Categories

  • Howto
  • Installation Steps
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2021 Online Notes | Powered by WordPress & Superb Themes