Page 1 of 1

How to apply DNS to DHCP server

Posted: Tue Apr 23, 2013 12:11 pm
by mbruck
Hi !

I'm newbe in RouterOS, I need help.

I want to setup network for my building with separate networks. So I decide to give put each floor to one interface port on Mikrotik. like this:

ether1: WAN, Public IP address and public DNS, 212.39.x.x (can't publish real adress, sorry)

ether2. IP 192.168.1.1/24, DHCP server, 192.168.1.10-192.168.2.254, gateway ether2
ether3. IP 192.168.2.1/24, DHCP server, 192.168.2.10-192.168.3.254, gateway ether3
ether4. IP 192.168.3.1/24, DHCP server, 192.168.3.10-192.168.4.254, gateway ether4
ether5. IP 192.168.4.1/24, DHCP server, 192.168.4.10-192.168.5.254, gateway ether5
ether6. IP 192.168.5.1/24, DHCP server, 192.168.5.10-192.168.6.254, gateway ether6
ether7. IP 192.168.6.1/24, DHCP server, 192.168.6.10-192.168.7.254, gateway ether7
ether8. IP 192.168.7.1/24, DHCP server, 192.168.7.10-192.168.7.254, gateway ether8

I have configured all DHCP servers, and I got internet connection, but I when I look at my status in command line (ipconfig /all), I got information that my DNS server is 212..39.x.x., basicaly what is configured on ether1.

How can I change this ? I want to DNS server would be on same address range as configured dhcp server port, eg. for dhcp clients on ether2 port, should be 192.168.1.1. But when I change to that IP in dhcp/network tab, DNS settings, my internet connection don't work since there is no DNS.
It only work if I leave it not configured, in which case mikrotik assign "global DNS", or I put something manuay like google.dns....

Regards !

Mladen Bruck

Re: How to apply DNS to DHCP server

Posted: Tue Apr 23, 2013 12:35 pm
by janisk
in cli looks like this.

ros code

ip dhcp-server network set <num> dns-server=dns ip
if dns-server field is empty, then dhcp-server requests dns-resolver for dhcp-server ip addresses and returns those to client.

when value is set - it is sent to client without querrying the dns resolver.

Re: How to apply DNS to DHCP server

Posted: Tue Apr 23, 2013 12:59 pm
by mbruck
Hi Janisk!

I'm afraid I didn't catch you.
What you suggest to me is to manualy put 212.39.etc.etc as DNS, which I already have, and that is not a solution. Or leave it empty, in which case I still got public DNS address. Which is at end, the same.

My current router is SOHO DLink. My WAN adress is 212.39.xx. and DNS server is 212.39.x.x. But DLink act as DNS server which is 192.168.0.1. Behind router, I don't know what is my real DNS. For me, it is DLink adress. And that is what I get with ipconfig command,

How can I mimics this also for my DHCP servers on Mikrotik?. For every client I want his DNS is like gateway. I want to hide DNS WAN adress from users.

Re: How to apply DNS to DHCP server

Posted: Tue Apr 23, 2013 1:13 pm
by janisk
ok, first things first:

link to the manual about DNS:
http://wiki.mikrotik.com/wiki/DNS

here you have to adjust allow-remote-requests and set value to yes

ros code

/ip dns set allow-remote-requests=yes
set up dns servers if you do not have one set already for dns resovler.

an example, google dns will be used, you can/should use your dns servers

ros code

/ip dns set servers=8.8.8.8,8.8.4.4
now the part you are interested in:

in '/ip dhcp-server network' menu you have to set up dns-server attribute a value you want your dhcp-server will give out to the client on dhcp address request.

so we want local router address to be dns server for dhcp hosts:

my local router address is 192.168.88.1 and clients are on 192.168.88.0/24 network.

ros code

/ip dhcp-server network set 0 dns-server=192.168.88.1
if you have other interfaces with dhcp-server configured it will have a local address, set up that local address as dns-server for network.

If you did not set up dns-server, for that network dns server ip addresses will be taken from DNS resolver that was configured at the beginning of post.

Re: How to apply DNS to DHCP server

Posted: Tue Apr 23, 2013 4:02 pm
by mbruck
Hi !

It's working now.... It seam I have worked all as you described trough GUI, except I didn't checked remote-request parametar. I had followed book "Dennis M Burgess - Learn RouterOS - 2009".

Long time I dind't see so fast technical support!

Thank you !

Mladen Bruck

Re: How to apply DNS to DHCP server

Posted: Tue Sep 23, 2014 11:03 pm
by colindb
Please can someone expand on this for me.

When you say local router address eg 192.168.88.1, is this the same as the LAN gateway address?

I am using 10.5.50.1 as a LAN gateway and a network 10.5.48.0/24.

Do I also need to make this a static address.

Would my "local router address" be 10.5.50.1 for DNS cache requirements?

Thanks in advance.