Community discussions

MikroTik App
 
User avatar
asashnov
just joined
Topic Author
Posts: 2
Joined: Fri Aug 12, 2016 3:36 pm
Location: Russia, Novosibirsk
Contact:

Errors and delays with simple static DNS records

Wed Jan 18, 2017 1:17 pm

version 6.37.4 on Mikrotik_RB915G

Simple (non-regexp) static DNS entries give 2-3 'unknown hostname' errors every day. Often MikroTik answers 'unknown host' immediately (that about static entry!), sometimes it takes up to 20 sec and the answer may be positive or negative. External DNS names are also affected.

Can anybody confirm the issue?
Does any solution exist?
What also can I check to investigate the problem?

The router is not under extensive use: CPU is below 20%, traffic is less than 1 mbps.
Versions prior 6.37.4 also behaive like this for us. We have two RB915G devices, both behave like this.

Here is the output of my script which resolves given hostname 2000 times with 2 sec interval (about one hour) via specified DNS server:
$ dns-resolv-test.sh git-test 192.168.188.1 | fold
Trying to resolve git-test 2000 times via 192.168.188.1...
Legend: + success, - unsuccess,  (N sec - time of successful but long query)
+++++++++++++++(5 sec)+++++++++++++++++++++++++++++(5 sec)++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)++++(
5 sec)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++(5 sec)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++(5 sec)+++++++++++++++++++++++++++++(5 sec)++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)+++++++++++
+++(5 sec)+++++++++++++++++++++++++++++++++++++++++(5 sec)++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++(5 sec)++++(5 sec)+++++++++++++++(5 sec)+++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++(5 sec)+++++(5 sec)+++++(5 sec)++++++++++++
++++++++(5 sec)+++++++++++++++(5 sec)++++++++++++++(5 sec)+++++(5 sec)++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(6 
sec)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)+++
++++++++++++++++++++++++(5 sec)+++++++++++++++++++++++++++++++++++++++++++++++++
++++(5 sec)+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5
 sec)++++(5 sec)++++++++++++++++++++++(5 sec)+++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++(5 sec)++++++++++++++++++++++++++++++++(5 sec)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)++++++++
+++++++++++++++++++++++++++++++++++++(5 sec)+++++++++++(5 sec)++++++++++++++++++
+++++++++++++++++(5 sec)++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++(5 sec)+++++++(5 sec)+++++++++++++
+++++++++++++++++++++++++++++++++++++++++++(5 sec)++++++++++++++++++++++++++++++
+(5 sec)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++
Total DNS queries: 2000, 0 errors, 37 delays
(git-test.ourdomain is static entry, 192.168.188.1 is MikroTik)

Resolving external names also fails sometimes:
$ dns-resolv-test.sh google.com 192.168.188.1 | fold
Trying to resolve google.com 2000 times via 192.168.188.1...
Legend: + success, - unsuccess,  (N sec - time of successful but long query)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(5 sec)+++++++++++++++++++++++++++++++++++++++++++++(4 sec)+++++++++++++++++++++
+++++++++++++++++++++++++++++++++(5 sec)++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++(5 sec)++++++++++++++++++++(5 sec)+++++++++++++++++++++
+(5 sec)+++++++++++++++++(5 sec)++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++(5 sec)+++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++(5 sec)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++(5 sec)+++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)+++++++++
+++++++++++++++++++++++++(5 sec)++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++(5 sec)+++++++++++++(5 sec)+++++++++++++(5 sec)+++++++++++++(5 sec)
+++++++++++++++++++++++(5 sec)++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++(5 sec)+++++++++++++++++++++(5 sec)++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++(5 sec)+++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)+++++++++++
++++++++++++++++++++++++++++++++++++++++++++(6 sec)++++(5 sec)++++++++++++++++++
++++(5 sec)+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++(5 sec)+(5 sec)+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)++++++
++++++++++++++++(5 sec)+++++++++++++++++++(5 sec)++++(5 sec)++++++++++++++++++++
++++++++++(5 sec)+++++++++++++++++++++++++++++++++++++++++++++++(5 sec)+++++++++
++++++++++++++++++++++(5 sec)+++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++(5 sec)+++++++(5 sec)++++++++++++++++++++(5 sec)+++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)+++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(5 sec)++++++++++++++
+++++(5 sec)+++++++++++++++++++++
Total DNS queries: 2000, 0 errors, 39 delays
(Cache size 2048, 494 KiB used)


To make sure my network works well I did the same test with external Google's DNS:
$ dns-resolv-test.sh google.com 8.8.8.8 | fold
Trying to resolve google.com 2000 times via 8.8.8.8...
Legend: + success, - unsuccess,  (N sec - time of successful but long query)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++(6 sec)++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++
Total DNS queries: 2000, 0 errors, 1 delays

Here is a test shell script dns-resolv-test.sh:
#!/bin/sh

test -z "$1" -o -z "$2" && {
  echo "Usage: $0  <hostname to resolve> <dns server>   "
  exit 1
}

HOSTNAME_TO_RESOLVE="$1"
DNS_SERV_ADDR="$2"

total_tries=2000
errors=0
delays=0

# Single attempt to resolve a hostname
# Args:
#  $1 - hostname
#  $2 - dns server
# Return 0 on success
# Side effects:
#   * prints + or - sign. Optionally time in seconds for slow responces
try_to_resolv()
{
  # global errors
  local hostnm="$1"
  local dnsserv="$2"
  local ret=0

  local time_start=`date +%s`

  if ! host "$HOSTNAME_TO_RESOLVE" "$DNS_SERV_ADDR" >/dev/null ; then
    ret=1
    echo -n '-'
    errors=$(( $errors + 1 ))
  else
    echo -n '+'
  fi

  local time_end=`date +%s`

  local runtime=$(( $time_end - $time_start ))
  if [ "$runtime" -gt "1" ] ; then
    echo -n "($runtime sec)"
    delays=$(( $delays + 1 ))
  fi

  return $ret
}

echo "Trying to resolve $HOSTNAME_TO_RESOLVE $total_tries times via $DNS_SERV_ADDR..."
echo "Legend: + success, - unsuccess,  (N sec - time of successful but long query)"

for i in `seq $total_tries` ; do

  try_to_resolv "$HOSTNAME_TO_RESOLVE" "$DNS_SERV_ADDR"

  sleep 2
done

echo "\nTotal DNS queries: $total_tries, $errors errors, $delays delays"
(or https://gist.github.com/asashnov/afbdca ... 894d076469 )
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3348
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Errors and delays with simple static DNS records

Wed Jan 18, 2017 3:47 pm

I did a test my self to my RG750Gv3 and do not get any error.
./dns.sh google.com 10.10.10.1
Trying to resolve google.com 2000 times via 10.10.10.1...
Legend: + success, - unsuccess,  (N sec - time of successful but long query)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Total DNS queries: 2000, 0 errors, 0 delays
OS ver 6.38.1
 
Sob
Forum Guru
Forum Guru
Posts: 9188
Joined: Mon Apr 20, 2009 9:11 pm

Re: Errors and delays with simple static DNS records

Thu Jan 19, 2017 2:10 am

I had it running for several hours against three devices (CHRs with 6.38.1 and 6.39rc13 and RB with 6.18) and it's all pluses, not a single error or delay. But it's worth noting that CHRs don't do anything and RB is very far from breaking a sweat either.