Pivotal Knowledge Base


BOSH DNS Introduced Container DNS Behavior Changes in PAS 2.0


  • Operations Manager 2.0
  • Pivotal Application Services 2.0


Bosh DNS was introduced in PAS 2.0. This article describes how Bosh DNS changes "how containers perform DNS lookups on a Diego Cell".


Container Life before bosh DNS ( pre 2.0 )

The configured DNS servers (located in the create networks tab under the director tile) will get inserted into the Diego Cells /etc/resolv.conf file by the bosh agent during deployment. For example, if we have DNS server "," configured in the ops manager, the file would look like below:

nameserver is the consul agent running on the cell and is mainly used for the service discovery of internal PAS services. However, consul agent will perform a recursive DNS lookup using the configured external DNS server when the search domain is not in services.cf.internal.

When a Container gets created, Diego will populate the /etc/resolv.conf with the external DNS server as followed:


Now all DNS lookups by the container will be serviced by the external DNS servers as expected.

Container Life with Bosh DNS

With the introduction of BOSH DNS, the Diego cell will have a listening process on internal IP address

tcp        0      0*               LISTEN      5715/bosh-dns

With the same dns server configuration as the previous example the Diego Cell will have the following configuration in /etc/resolv.conf:


This means the DNS lookup behavior for the Diego Cell does not change at all.

The APP Container running on the diego cell will now have this configuration in its /etc/resolv.conf


All DNS lookups will now go through the BOSH-DNS process running on the diego cell.

How Bosh DNS behaves

Startup of the BOSH-DNS process:

When Bosh DNS starts up, it randomly selects one of the externally configured IP addresses in /etc/resolv.conf. In the case of windows, BOSH DNS will query all the network adapter settings for IP addresses.  The following powershell script can be used to identify what servers it will find:

try {
  [array]$routeable_interfaces = Get-WmiObject Win32_NetworkAdapterConfiguration | Where { $_.IpAddress -AND ($_.IpAddress | Where { $addr = [Net.IPAddress] $_; $addr.AddressFamily -eq "InterNetwork" -AND ($addr.address -BAND ([Net.IPAddress] "").address) -ne ([Net.IPAddress] "").address }) }

  $interface = (Get-WmiObject Win32_NetworkAdapter | Where { $_.DeviceID -eq $routeable_interfaces[0].Index }).netconnectionid

  (Get-DnsClientServerAddress -InterfaceAlias $interface -AddressFamily ipv4 -ErrorAction Stop).ServerAddresses
} catch {
  Exit 1
Exit 0

In both the cases of Linux and Windows, the loopback interface of is ignored.  To find out which IP is used, you can look at its log file and observe this message during startup. Also when recursive queries are initiated BOSH DNS will log which server is used to perform the lookup through:

[FailoverRecursor] 2018/02/28 22:38:58 INFO - starting preference:

This behavior is different from how linux behaves. For example, when you run programs like the host, nslookup, dig, etc.. they will likely be calling a common function such as getaddrinfo that does things like read /etc/nsswitch.conf and decides how to perform the resolution. These commands will certainly read the /etc/resolv.conf from top to bottom resulting in getting picked first every time in case of perfoming a lookup from the Diego cell. It is important to understand this difference in behavior when you are troubleshooting APP Container lookup issues


BOSH DNS does not support reverse DNS lookups in early PAS 2.0 release. This is fixed in Bosh-DNS release v0.1.3 and v1.3.0. Refer to the PAS release notes to identify which versions have this feature.

Additional Information

For a full description of Bosh DNS see the Open Source Documentation https://bosh.io/docs/dns.html.

Amazon Web Services and Google Cloud Platform will inject a DNS server defined in the subnet into /etc/resolv.conf. This entry is typically injected as the last nameserver in /etc/resolv.conf. This could result in BOSH DNS selecting the IAAS DNS server on startup which may cause undesired DNS lookup behavior. Make sure to disable this DNS feature in your IAAS.

Operations Manager will allow Operators to add the IAAS DNS servers to an exclude list which sets the "excluded_recursors" in deployment manifests. Any DNS server in the exclude list will be ignored by Bosh DNS.



Powered by Zendesk