Nameserver

Soodar router supports DNS (Domain Name System) configuration, allowing you to act as a DNS client or a DNS relay.

The system also supports defined hostnames, which are local names that can be used to refer to devices on the network. This functionality is also available in the DNS relay mode.

Configuring Nameserver

Nameserver configuration in Soodar is VRF-aware. It means that you can configure different DNS servers/ hostnames for different VRFs. It is also possible to configure VRFs to use another VRF’s DNS servers/ hostnames.

Note

DNS lookup is enabled by default. The only way to disable it is to remove all configured DNS servers and hostnames both.

Configuration Commands

ip name-server A.B.C.D

The command is used to configure the IP address of a DNS (Domain Name System) server on the default VRF.

  • A.B.C.D: is the IP address of the DNS server.

ip name-server vrf VRFNAME A.B.C.D

The command is used to configure the IP address of a DNS server for a specific VRF (Virtual Routing and Forwarding) instance.

  • VRFNAME: is the name of the VRF instance.

  • A.B.C.D: is the IP address of the DNS server.

ip name-server 0.0.0.0

The command is used to enable DNS relay on default VRF. The router will answer DNS queries from clients using the DNS servers configured on the router.

ip name-server vrf VRFNAME 0.0.0.0

The command is used to enable DNS relay on a specific VRF. The router will answer DNS queries from clients using the DNS servers configured on the router for that VRF.

ip host HOSTNAME A.B.C.D ...

The command is used to define a local hostname and its corresponding IP addresses on default VRF. The router will use this information to resolve hostnames to IP addresses when acting as a DNS relay for external clients or when resolving hostnames for its own use.

When multiple IP addresses are associated with a single hostname, the router will use the configured algorithm (Round Robin, First, or Random) to determine which IP address to return in response to a DNS query.

  • HOSTNAME: is the host’s name.

  • A.B.C.D: is the IP address associated with the hostname.

ip host vrf VRFNAME HOSTNAME A.B.C.D ...

The command is used to define a local hostname and its corresponding IP addresses for a specific VRF. The router will use this information to resolve hostnames to IP addresses when acting as a DNS relay for external clients or when resolving hostnames for its own use.

When multiple IP addresses are associated with a single hostname, the router will use the configured algorithm (Round Robin, First, or Random) to determine which IP address to return in response to a DNS query.

  • VRFNAME: is the name of the VRF instance.

  • HOSTNAME: is the host’s name.

  • A.B.C.D: is the IP address associated with the hostname.

ip dns expire-ttl (1-86400)

The command is used to set the TTL (Time To Live) for queries that the router answers as a DNS relay. The TTL value determines how long the response will be considered valid by the clients before they need to query again.

  • 1-86400: is the range of valid TTL values in seconds. The default value is 60 seconds.

Note

This command is available in both VRF and CONFIG nodes. In CONFIG node, it sets the default VRF to use the specific VRF.

ip dns algorithm <rr|first|random>

The command is used to set the algorithm for selecting a IP for a host when multiple IPs are configured. The available options are:

  • rr: Round Robin - The router will use the IPs in a round-robin fashion.

  • first: First - The router will always use the first IP in the list.

  • random: Random - The router will randomly select an IP from the list.

Note

This command is available in both VRF and CONFIG nodes. In CONFIG node, it sets the default VRF to use the specific VRF.

ip domain-lookup vrf-reference VRFNAME

The command is used to set the reference VRF for DNS lookups. This VRF can be used by other VRFs to resolve hostnames using the DNS servers configured in the reference VRF.

  • VRFNAME: is the name of the VRF instance that will be used as a reference for DNS lookups.

Note

By default, the reference VRF is set to the default VRF.

ip domain-lookup vrf-reference

The command is used to set VRF DNS resolving to be done via reference VRF. This means that the DNS servers configured in the reference VRF will be used for DNS lookups in the current VRF. Also the connections to the DNS servers will be established in the reference VRF.

Note

This command is available in both VRF and CONFIG nodes. In CONFIG node, it sets the default VRF to use the reference VRF.

soodar(config)# ip vrf red
soodar(config)# ip name-server vrf red 4.2.2.4
soodar(config)# ip domain-lookup vrf-reference red
soodar(config)# ip domain-lookup vrf-reference
soodar(config)# ip vrf green
soodar(config-vrf)# ip domain-lookup vrf-reference

In this example, the red VRF is configured with a DNS server and is set as the reference VRF. The green and default VRFs are set to use the reference VRF for DNS lookups( In this example, red). Any DNS queries made in these VRFs will be resolved in red VRF( Uses the DNS servers and routes configured in red VRF).

ip domain-lookup vrf VRFNAME

The command is used to set VRF DNS resolving to be done via a specific VRF. This means that the DNS servers configured in the specific VRF will be used for DNS lookups in the current VRF. Also the connections to the DNS servers will be established in the specific VRF.

  • VRFNAME: is the name of the VRF instance.

Note

This command is available in both VRF and CONFIG nodes. In CONFIG node, it sets the default VRF to use the specific VRF.

ip domain cache max-ttl (1-86400)

The command is used to set the maximum TTL (Time To Live) for DNS cache entries. The TTL value determines how long a DNS entry will be stored in the cache before it is considered stale and needs to be refreshed.

  • 1-86400: is the range of valid TTL values in seconds. The default value is 86400 seconds (1 day).

Note

This command is available in both VRF and CONFIG nodes. In CONFIG node, it sets the default VRF to use the specific VRF.

ip domain timeout (1-360000)

The command is used to set the timeout value for DNS queries. The timeout value determines how long the router will wait for a response from a DNS server before considering the server is not responsible and try the next server or give up.

  • 1-360000: is the range of valid timeout values in milliseconds. The default value is 1000 milliseconds (1 seconds).

Note

This command is available in both VRF and CONFIG nodes. In CONFIG node, it sets the default VRF to use the specific VRF.

test ip name-server HOSTNAME [VRFNAME]

The command is used to test the DNS resolution of a hostname in a specific VRF or in the default VRF if no VRF is specified.

  • HOSTNAME: is the hostname to be resolved.

  • VRFNAME: (Optional) is the name of the VRF instance. If not specified, the default VRF will be used.

Note

The ip domain-lookup vrf-reference and ip domain-lookup vrf commands are somehow similar, but they have different use cases. The vrf-reference command is used to set a reference VRF for DNS lookups, while the vrf command is used to set a specific VRF for DNS lookups. The vrf-reference command is more flexible and the reference VRF can be changed without changing other VRFs’ configuration. It is useful when combining DNS with scripting and automation.

Note

The ip domain-lookup command does not affect defined hostnames. The defined hostnames are always resolved in the VRF where they are configured, regardless of the DNS settings.

ip domain picker sequential

The command is used to set the domain picker algorithm to sequential. When multiple DNS servers are configured, the router will try them in the order they were configured until it receives a response.

ip domain picker srtt [(10-10000)]

The command is used to set the domain picker algorithm to SRTT (Smoothed Round Trip Time). When multiple DNS servers are configured, all servers that their SRTT value is within the RTT range of the fastest server will be used in a random fashion. The RTT range is defined as the SRTT value of the fastest server plus the configured SRTT value. Cold (never-sampled) upstreams are always eligible so they get probed. Requires SRTT measurements to accumulate before it diverges from sequential behavior.

  • 10-10000: is the range of valid SRTT values in milliseconds. The default value is 50 milliseconds.

ip domain picker breaker threshold (1-100) backoff (100-60000) (1000-600000)

The command is used to set the domain picker algorithm circuit breaker. When multiple DNS servers are configured, the router will monitor the success rate of each server. If a server’s consecutive failures fall below the configured threshold, the router will consider that server as down and will not use it for DNS queries for a certain period of time defined by the backoff value. After the backoff period, the router will resume using the server. If the server continues to fail, the backoff period will increase exponentially until it reaches the maximum backoff time.

  • threshold: is the number of consecutive failures that will trigger the circuit breaker. The default value is 3.

  • backoff: The first parameter sets the base backoff time in milliseconds, which is the amount of time the router will wait before trying to use the server again after it has been marked as down. The second parameter sets the maximum backoff time in milliseconds, which is the maximum amount of time the router will wait before trying to use the server again. The default values are 5000 milliseconds for base backoff and 60000 milliseconds for maximum backoff.

ip domain picker hedge fixed delay (0-1000) max-attempts (2-10)

The command is used to set the domain picker algorithm hedge. When multiple DNS servers are configured, the router will send DNS query to the first server. If the router does not receive a response within the configured fixed delay, it will send the same query to the next server. The router will use the first response it receives and ignore the rest. This algorithm can help to reduce the DNS query latency when some servers are slow to respond.

  • fixed delay: is the fixed delay in milliseconds before sending the query to the next servers. A value of 0 hedges immediately (effectively parallel fanout), which maximizes latency reduction at the cost of doubling upstream load on every query. The default value is 50 milliseconds.

  • max-attempts: Caps how many parallel speculative requests can be in-flight for a single DNS query at once. A value of 2 means one initial request plus at most one hedge. Higher values allow multiple hedges to fire in sequence (each after its own delay interval), which can further reduce tail latency when several upstreams are slow but increases total upstream query volume proportionally. The default value is 2.

ip domain picker hedge adaptive quantile (0-100) window (10-1000) min-samples (1-1000) delay (0-1000) max-attempts (2-10)

The command is used to set the domain picker algorithm hedge adaptive. When multiple DNS servers are configured, the router will monitor the response times of each server and calculate a delay based on the configured quantile of the response times within a sliding window of recent samples. If the router does not receive a response from the first server within the calculated delay, it will send the same query to the next server. The router will use the first response it receives and ignore the rest. This algorithm can help to reduce the DNS query latency while minimizing unnecessary queries to upstream servers.

  • quantile: is the quantile percentage used to calculate the adaptive delay based on historical response times. For example, a value of 95 means that the delay will be set to the response time that is greater than 95% of all recorded response times in the sliding window. The default value is 95.

  • window: is the size of the sliding window in number of samples used to calculate the quantiles for adaptive hedging. A larger window provides more stable estimates but slower adaptation to changing conditions. The default value is 100 samples.

  • min-samples: is the minimum number of samples required in the sliding window before adaptive hedging can take effect. This ensures that there is enough data to make informed decisions about which servers are slow. The default value is 10 samples.

  • delay: used as the initial fallback delay before enough samples are collected. The default value is 50 milliseconds.

  • max-attempts: Caps how many parallel speculative requests can be in-flight for a single DNS query at once. A value of 2 means one initial request plus at most one hedge. Higher values allow multiple hedges to fire in sequence (each after its own delay interval), which can further reduce tail latency when several upstreams are slow but increases total upstream query volume proportionally. The default value is 2.

Troubleshooting Nameserver Configuration

test ip name-server HOSTNAME [VRFNAME]

The command is used to test the DNS resolution of a hostname in a specific VRF or in the default VRF if no VRF is specified.

  • HOSTNAME: is the hostname to be resolved.

  • VRFNAME: (Optional) is the name of the VRF instance. If not specified, the default VRF will be used.

show ip name-server

The command is used to display the configured DNS servers in all VRFs.

soodar# show ip name-server
Reference VRF for lookups: default
VRF Settings:
  VRF: default
    Name Servers:
      - 4.2.2.4
    Nameservers Source: Manual CLI
    DNS Relay Enabled: yes
  VRF: red
    Name Servers:
    Nameservers Source:
    DNS Relay Enabled: yes
    Upstream Lookup VRF: default

Note

Nameservers Source indicates how the DNS servers were configured. It can be Manual CLI or DHCP.

Note

DHCP configured DNS servers always override the manually configured DNS servers.

Note

DHCP configured DNS servers can not be removed from CLI. If you want to remove them, you need to disable the DHCP client on the interface.

show ip host

The command is used to display the configured hostnames in all VRFs.

soodar# show ip host
VRF Settings:
  VRF: default
    Hostnames:
      - soodar: 127.0.1.1
      - www.example.com: 192.168.1.1
  VRF: red
    Hostnames:

Usage examples

In this section, we will discuss the usage of nameserver module in Soodar router with some examples.

DNS Relay

In Soodar router, you can configure the router to act as a DNS relay. This means that the router will forward DNS queries from clients to the configured DNS servers( or lookup in defined hostnames) and return the responses to the clients.

Example: Configuring DNS Relay

soodar(config)# ip name-server 4.2.2.4
soodar(config)# ip name-server 0.0.0.0
soodar(config)# ip host www.example.com 10.14.56.23
soodar(config)# interface ge0
soodar(config-if)# ip address 192.168.1.1

The above block setups the router to use the DNS server at 4.2.2.4 then enable DNS relay on the default VRF.

Now we setup a client to use the router as its DNS server:

user@n4# nslookup www.example.com 192.168.1.1
Server:             192.168.1.1
Address:    192.168.1.1#53

Non-authoritative answer:
Name:       www.example.com
Address: 10.14.56.23
** server can't find www.example.com: NXDOMAIN

user@n4# nslookup www.example.com 192.168.1.1
Server:             192.168.1.1
Address:    192.168.1.1#53

Non-authoritative answer:
Name:       google.com
Address: 172.217.5.14
Name:       google.com
Address: 2607:f8b0:4009:807::200e

Please note that the DNS is only available in default VRF. If we move the interface to another VRF, the DNS will not work:

soodar(config-if)# vrf red
soodar(config)# interface ge0
soodar(config-if)# ip vrf forwarding red
soodar(config-if)# ip address
user@n4# nslookup www.example.com 192.168.1.1
;; communications error to 192.168.1.1#53: connection refused
;; communications error to 192.168.1.1#53: connection refused
;; communications error to 192.168.1.1#53: connection refused
;; no servers could be reached

To make the DNS work in the red VRF, we need to either configure a DNS server, or force the DNS to use the default VRF’s DNS server:

soodar(config)# vrf red
soodar(config-vrf)# ip domain-lookup vrf default

Now, enable DNS relay in the red VRF:

soodar(config)# ip name-server vrf red 0.0.0.0
user@n4# nslookup www.example.com 192.168.1.1
Server:             192.168.1.1
Address:    192.168.1.1#53

** server can't find www.example.com: NXDOMAIN

user@n4# nslookup www.example.com 192.168.1.1
Server:             192.168.1.1
Address:    192.168.1.1#53

Non-authoritative answer:
Name:       google.com
Address: 172.217.5.14
Name:       google.com
Address: 2607:f8b0:4009:807::200e

Note that the resolution of www.example.com is not working, because it is defined in the default VRF and is not available in the red VRF. However, the DNS relay is working and the router is able to resolve google.com using the DNS server configured in the default VRF.

Reference VRF for DNS Lookups

Let’s set up a network with multiple VRFs: - internet, backup-internet VRF: Has external connectivity and access to DNS servers - sales, hr, and dev VRFs: Department networks that need DNS resolution

First, configure the VRFs and assign interfaces:

soodar(config)# ip vrf internet
soodar(config)# ip vrf backup-internet
soodar(config)# ip vrf sales
soodar(config)# ip vrf hr
soodar(config)# ip vrf dev

soodar(config)# interface ge0
soodar(config-if)# ip vrf forwarding internet
soodar(config-if)# ip address 203.0.113.1/24

soodar(config)# interface ge4
soodar(config-if)# ip vrf forwarding backup-internet
soodar(config-if)# ip address 151.11.49.5/24

soodar(config)# interface ge1
soodar(config-if)# ip vrf forwarding sales
soodar(config-if)# ip address 10.1.1.1/24

soodar(config)# interface ge2
soodar(config-if)# ip vrf forwarding hr
soodar(config-if)# ip address 10.2.1.1/24

soodar(config)# interface ge3
soodar(config-if)# ip vrf forwarding dev
soodar(config-if)# ip address 10.3.1.1/24

Now, configure DNS servers in the internet VRF and set it as the reference VRF:

soodar(config)# ip name-server vrf internet 8.8.8.8
soodar(config)# ip name-server vrf internet 1.1.1.1
soodar(config)# ip name-server vrf backup-internet 8.8.8.8
soodar(config)# ip name-server vrf backup-internet 1.1.1.1
soodar(config)# ip domain-lookup vrf-reference internet

Next, configure each department VRF to use the reference VRF for DNS lookups:

soodar(config)# ip vrf sales
soodar(config-vrf)# ip domain-lookup vrf-reference

soodar(config)# ip vrf hr
soodar(config-vrf)# ip domain-lookup vrf-reference

soodar(config)# ip vrf dev
soodar(config-vrf)# ip domain-lookup vrf-reference

You can also define VRF-specific hostnames:

soodar(config)# ip host vrf sales sales-server 10.1.1.10
soodar(config)# ip host vrf hr hr-server 10.2.1.10
soodar(config)# ip host vrf dev dev-server 10.3.1.10

Now, test DNS resolution from different VRFs:

soodar# test ip name-server google.com sales
Resolved google.com as 142.250.185.78

soodar# test ip name-server sales-server sales
Resolved sales-server as 10.1.1.10

soodar# test ip name-server hr-server hr
Resolved hr-server as 10.2.1.10

If your ISP changes their DNS servers, you only need to update the internet VRF:

soodar(config)# no ip name-server vrf internet 8.8.8.8
soodar(config)# no ip name-server vrf internet 1.1.1.1
soodar(config)# ip name-server vrf internet 9.9.9.9
soodar(config)# ip name-server vrf internet 149.112.112.112

All department VRFs will automatically use the new DNS servers without any additional configuration changes.

Also you can activate the backup internet VRF for DNS lookups, if the primary internet VRF is not available:

soodar(config)# ip domain-lookup vrf-reference backup-internet