2

I have installed ubuntu server in Virtual Machine. I started exploring about the network, and read a book for it.

It says that my DNS server is given in /etc/resolv.conf file.

This is my server's IP.

luvpreet@server16:~$ hostname -I
192.168.122.62 

This is the /etc/resolv.conf file,

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.122.1

Well, DNS server maps the human readable addresses to IP addresses. In my main machine(not in VM)

tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      2332/dnsmasq    

The DNS server is running.

But how it works, I have no idea that how this IP address i.e, 192.168.122.1 is serving as my DNS Server. Please explain its working in detail and also the flow by which this DNS server works.

I know how a DNS server works, it is like a phonebook which helps us to locate to a particular website. Where is the DNS cache? I want to know how this IP address is working as my DNS server ? Can I bind any IP address as my DNS server ?If yes, How to do that ? If no, why ?

Sorry if this is dumb but I am not getting this.

1 Answer 1

1

Your question is too fuzzy for me, but anyway I try to clarify some of the things.

As you know 192.168.122.62 is your server (VM) IP, and you should be sitting on 192.168.122.0/24 network.

If you run ifconfig -a on your host machine, I'm pretty sure you will get 192.168.122.1 as one of your interfaces IP address, it should be on a virtual interface created by your hypervisor, which can be VirtualBox for example.

At the same time I guess your virtual network is behind a NAT (Network address translation), and your host is acting as a router for your VMs.

And thats why when you lookup your resolve.conf you get your host IP, in fact your host, which is a router to your VM, is responsible of resolving DNS requests.

You can run ip r or route or netstat -nr on your VM to see your routing table.

It's been a long time that i'm not using dnsmasq, but if I remember corectly if you send a USR1 signal to it's process it will generates some log about cached addresses at its service status, something like this:

kill -USR1 `pidof dnsmasq`

If you want to run a DNS server: ‌‌‌BIND9
To know more about dnsmasq which are listening on your host: Dnsmasq

4
  • means all my requests are routed through this 192.168.122.1 interface ? and where is the DNS cache ?
    – luv.preet
    Apr 7, 2017 at 19:47
  • Updated my answer.
    – Ravexina
    Apr 7, 2017 at 19:54
  • okay, I get it. the DNS caching is performed by OS, browser or the router ?
    – luv.preet
    Apr 7, 2017 at 22:25
  • It depends. for example my physical router uses dnsmasq as its DNS forwarder. It may use it to cache some of the results, but I don't know if it does. as I know ubuntu by default does not cache anything and caching the results is not a part of OS or browser responsibilities. but it does not mean that they can't. have a look at here.
    – Ravexina
    Apr 8, 2017 at 3:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .