Article ID: 122040, created on Jun 16, 2014, last review on Jun 17, 2014

  • Applies to:
  • Virtuozzo 6.0
  • Virtuozzo containers for Linux 4.7
  • Virtuozzo hypervisor


  • For command like wget http://hostname/some/file it takes >5 seconds to resolve the hostname.
  • Telnet login, ssh login, FTP login is slow (name resolution takes >5 seconds or in some cases 30-60 seconds)
  • The server is behind IPv4 and IPv6 configured firewall (for example, hardware based dedicated firewall is used).


The issue is caused by a known RedHat problem. The resolver uses the same socket for the A and AAAA requests and two requests from the same port are not handled correctly (some systems mistakenly send back only one reply; when that happens, the client system will sit and wait for the second reply).


Add options single-request-reopen line to the /etc/resolv.conf:

# echo "options single-request-reopen" >> /etc/resolv.conf

This option ensures that if two requests from the same port are not handled correctly, it will close the socket and open a new one before sending the second request.

In order to automate the solution, so that this adjustment is made for all newly created containers, post-install script for the OS template can be modified:

(on example of centos-6-x86_64 template):

  • Check the location of the templates folder:

    # grep ^TEMPLATE /etc/vz/vz.conf
  • Add echo "options single-request-reopen" >> etc/resolv.conf line to the /vz/template/centos/6/x86_64/config/os/default/post-install script:

    # diff -u post-install_orig post-install
    --- post-install_orig    2014-06-13 07:10:04.199956852 +0700
    +++ post-install         2014-06-13 07:09:19.724481908 +0700
    @@ -164,8 +164,5 @@
    # post-install script failure
    /usr/bin/update-mime-database /usr/share/mime > /dev/null 2>&1
    +echo "options single-request-reopen" >> etc/resolv.conf
     popd > /dev/null
  • Recreate the template cache:

    # vzpkg create cache centos-6-x86_64 -r -f

Search Words

slow name resoluiton

slow dns resolution

name resolution takes too long

a26b38f94253cdfbf1028d72cf3a498b 2897d76d56d2010f4e3a28f864d69223 e8e50b42231236b82df27684e7ec0beb d02f9caf3e11b191a38179103495106f 0dd5b9380c7d4884d77587f3eb0fa8ef 0c05f0c76fec3dd785e9feafce1099a9 c62e8726973f80975db0531f1ed5c6a2

Email subscription for changes to this article
Save as PDF