I’m brand new to RouterOS, and I’m trying to set up an x86 install in a VM to replicate my existing (ClearOS) router functionality before I commit to buying an RB1100.
I’ve got up to the point where I’m carrying over my internal host names into the static DNS entries, however RouterOS seems to be both more limiting but more powerful - and definitely more frustrating here.
I need two entries for each single IP address, simple “hosts” file functionality equivalent to:
192.168.1.1 router.mydomain.com router
(this is what ClearOS and any ordinary “hosts” file would use, and would resolve both “router” and “router.mydomain.com” to the correct IP address).
Now, without entering in two entries per host (I have a lot of hosts so this is not feasible - and no I’m not setting up a separate DNS server) I understand that under RouterOS I need to use a regular expression to do this. I would think that the following would be correct:
/ip dns static> add address=192.168.1.1 name=“router(\.mydomain\.com)?”
but when I add this, it’s not recognised as a regular expression:
[admin@router2] /ip dns static> add address=192.168.1.1 name="router(\\.mydomain\\.com)\?"
[admin@router2] /ip dns static> print
Flags: D - dynamic, X - disabled, R - regexp
# NAME ADDRESS TTL
0 router(\.mydomain\.com)? 192.168.1.1 1d
(It should have an “R” next to it to show it recognised as a regexp).
If I use the example provided on the documentation page http://wiki.mikrotik.com/wiki/Manual:IP/DNS#Static_DNS_Entries it seems to at least recognise that entry as a regexp:
[admin@router2] /ip dns static> add address=192.168.1.1 name=".*\\.example\\.com"
[admin@router2] /ip dns static> print
Flags: D - dynamic, X - disabled, R - regexp
# NAME ADDRESS TTL
0 router(\.mydomain\.com)? 192.168.1.1 1d
1 R .*\.example\.com 192.168.1.1 1d
According to the documentation “In case an entry does not conform with DNS naming standards, it is considered a regular expression and marked with ‘R’ flag.” but what is it that determines whether
RouterOS agrees that it is a regular expression rather than a regular host name?
Incidentally, lookup against the non-regexp-recognised entries does not work:
[admin@router2] /ip dns static> /ping router
HOST SIZE TTL TIME STATUS
67.215.65.132 56 49 181ms
67.215.65.132 56 49 180ms
sent=2 received=2 packet-loss=0% min-rtt=180ms avg-rtt=180ms max-rtt=181ms
[admin@router2] /ip dns static> print
Flags: D - dynamic, X - disabled, R - regexp
# NAME ADDRESS TTL
0 router(\.mydomain\.com)? 192.168.1.1 1d
1 R .*\.example\.com 192.168.1.1 1d
2 router|router\.mydomain\.com 192.168.1.1 1d
Also, it seems that RouterOS strangely believes that a regexp needs to begin with a “.” to recognise it as one -
[admin@router2] /ip dns static> add address=192.168.1.1 name=".router(\\.mydomain\\.com)\?"
[admin@router2] /ip dns static> print
Flags: D - dynamic, X - disabled, R - regexp
# NAME ADDRESS TTL
0 R .router(\.mydomain\.com)? 192.168.1.1 1d
[admin@router2] /ip dns static> /ping router
HOST SIZE TTL TIME STATUS
67.215.65.132 56 49 180ms
67.215.65.132 56 49 180ms
sent=2 received=2 packet-loss=0% min-rtt=180ms avg-rtt=180ms max-rtt=180ms
… but this still doesn’t give you a simple working host entry.
Am I missing something, or is this functionality not quite right?