Random ports are in use by service named

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux
  • bind

Issue

  • Why netstat shows random ports being in use by named?
udp  0.0.0.0:32868 0.0.0.0:*        1234/named

Resolution

This is an expected behavior, below there are some outputs from netstat filtered by named service and their explanation.

# netstat -lnptu |grep "named\W*$" 

Incoming TCP requests

tcp 0 0 :::53         :::*      LISTEN 1234/named 

Incoming UDP requests to IPv4 192.168.1.20

udp 0 0 192.168.1.20:53    0.0.0.0:*        1234/named

Incoming UDP requests to IPv4 localhost

udp 0 0 127.0.0.1:53  0.0.0.0:*        1234/named

Dynamic chosen port for outgoing queries

udp 0 0 0.0.0.0:32868 0.0.0.0:*        1234/named

Incoming UDP request to any IPv6

udp 0 0 :::53         :::*             1234/named

6.2.16.6 Query Address

If the server doesn’t know the answer to a question, it will query other name servers. query-source specifies the address and port used for such queries. For queries sent over IPv6, there is a separate query-source-v6 option. If address is * (asterisk) or is omitted, a wildcard IP address (INADDR ANY) will be used.

If port is * or is omitted, a random port number from a pre-configured range is picked up and will be used for each query. The port range(s) is that specified in the use-v4-udp-ports (for IPv4) and use-v6-udp-ports (for IPv6) options, excluding the ranges specified in the avoid-v4-udp-ports and avoid-v6-udp-ports options, respectively.

The defaults of the query-source and query-source-v6 options are:

query-source address * port *;
query-source-v6 address * port *;

If use-v4-udp-ports or use-v6-udp-ports is unspecified, named will check if the operating system provides a programming interface to retrieve the system’s default range for ephemeral ports. If such an interface is available, named will use the corresponding system default range; otherwise, it will use its own defaults:

use-v4-udp-ports { range 1024 65535; };
use-v6-udp-ports { range 1024 65535; };

Source: Bind9 ARM (http://www.isc.org/software/bind/documentation/)

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.