by March 24, 2014 0 comments

While running a Cloud infrastructure locally and hosting a bunch of servers on the cloud, we realized that we needed a mechanism to access the services/servers locally over the LAN and publicly over the Internet. But for the sake of convenience, we needed something that could let us use the same DNS name for the services, but resolve it to a local IP when accessed from within the LAN and if accessed from remotely, it should resolve to the public IP.
The trick is in hosting a local SPLIT DNS server and letting the DHCP server broadcast this DNS as the primary DNS in the network. And this SPLIT DNS will make sure that whenever you access a local resource using the global FQDN, it resolves to its local IP instead of the public IP.
To deploy this, we created a VM in our Cloud and installed Ubuntu (you can install whatever Linux flavor you’re comfortable using). Now, Login to the VM and escalate yourself as root
$sudo su –

Next, install dnsmasq like this
# aptitude install dnsmasq

Once done open /etc./dnsmasq.conf like this
# nano /etc./dnsmasq.conf

And add the following lines to the end of the file

Now save the file and open hosts file
#nano /etc./hosts

And add
<local-ip-of-the-server> <your-server-FQDN>

Now start dnsmasq and set it for starting at every reboot like this
# /etc./init.d/dnsmasq start
#chkconfig dnsmasq on

Once this is done, make sure your LAN DHCP lease setting has the IP address of this VM as its primary DNS IP. For the secondary IP, you can use any public DNS server.
And you are done!


No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.