Network

DNS

This page applies to:

  • HAProxy ALOHA - all versions

You can configure which DNS servers to query when HAProxy ALOHA needs to resolve a server’s hostname. This is necessary, for example, when you want to specify a hostname instead of an IP address when defining a backend server. Also, features like Single Sign-on depend on resolving hostnames. Typically, these DNS servers will reside within the local network.

Changes affect the system’s /etc/resolv.conf file.

Caution

HAProxy ALOHA doesn’t perform DNS resolution for its internal system. For services such as NTP, syslog, and others that require the use of external servers, you should configure these services to use the servers’ IP addresses instead of their names or FQDNs. If you need to reference external servers by name, statically declare server names and IP addresses in /etc/hosts.

Configure DNS servers Jump to heading

  1. In the Services tab, click system setup next to the system service.

    System Setup

  2. Use the dns_servers directive to specify the IP addresses of your DNS servers, where each IP address is separated by a space.

    haproxy
    service system
    dns_servers 192.158.0.10 192.168.0.11
    haproxy
    service system
    dns_servers 192.158.0.10 192.168.0.11
  3. Optional: Use the dns_domain directive to specify the search list, which is equivalent to setting a search directive in /etc/resolv.conf. This allows you to use a server’s hostname in your configuration instead of its fully qualified domain name.

    If you specify the DNS suffix example.com, you will only have to type app in your configuration, which will expand to app.example.com.

    haproxy
    service system
    dns_servers 192.158.0.10 192.168.0.11
    dns_domain example.com
    haproxy
    service system
    dns_servers 192.158.0.10 192.168.0.11
    dns_domain example.com
  4. Optional: Use the hostname directive to change the HAProxy ALOHA hostname.

    haproxy
    service system
    dns_servers 192.158.0.10 192.168.0.11
    dns_domain example.com
    hostname aloha1
    haproxy
    service system
    dns_servers 192.158.0.10 192.168.0.11
    dns_domain example.com
    hostname aloha1
  5. Reload the system service.

  6. To make your changes persistent after a reboot, click the Setup tab. Then click Save under Configuration.

Troubleshooting Jump to heading

Below, you will find potential solutions to issues that may arise when configuring DNS with HAProxy ALOHA.

Improve boot time Jump to heading

If you are experiencing long boot times, this may be due to failing DNS lookups for external servers for NTP, syslog, and others. HAProxy ALOHA doesn’t perform DNS resolution for its internal system. We recommend using these external servers’ IP addresses instead of their names or FQDNs to improve your boot times. If you need to reference these types of external servers by name, we recommend you set static server names and IP addresses in /etc/hosts.

Set static server names and IP addresses in the hosts file Jump to heading

If you need to reference external servers by name instead of by IP address in your configuration, such as in the configuration for the NTP or syslog services, we recommend statically declaring the names and IP addresses of these servers in HAProxy ALOHA’s /etc/hosts file.

Exercise caution when using DNS with /etc/hosts entries

If you or other authorized HAProxy ALOHA users add entries to the /etc/hosts file, keep in mind that having DNS entries for the same servers may also cause collisions for lookups. If you are experiencing unexpected behavior when trying to reference a server by name in your configuration, ensure that you haven’t defined the server in both places or possibly with different IP addresses for the same server name.

To add an entry to the /etc/hosts file on the HAProxy ALOHA server:

  1. Edit the file /etc/hosts. To edit this file using the UI, select the Tools tab, then use the File Manager to navigate to the /etc folder and edit the file hosts.

  2. Add your server entries. Many entries may be present in the file, depending on your system. Add new entries at the end of the file. For example, to reference an NTP server named ntp.test.local with its IP address instead, add its IP address and server name to /etc/hosts:

    /etc/hosts
    text
    127.0.0.1 localhost
    # [...] additional entries may be present here
    192.168.99.125 ntp.test.local
    /etc/hosts
    text
    127.0.0.1 localhost
    # [...] additional entries may be present here
    192.168.99.125 ntp.test.local
  3. Click Save.

  4. To make the changes persist after a reboot, go to the Setup tab and click Save within the Configuration section.

Do you have any suggestions on how we can improve the content of this page?