≡ Menu

How to make Bind listen on a specific IP address?

The question – I want Bind to listen on all of my IP addresses. How do I do this using Bind on CentOS?

There are listen-on and listen-on-v6 Bind directives that can be used to make Bind listen on specific ports and ip addresses.

Bind has config file called the following:

/etc/named.conf

To change the Bind listening addresses, you should change this file.

For IPv4 addresses, use the listen-on syntax:

listen-on { ip_address; };
listen-on { any; };

If you specify any, then Bind will listen on ALL ip addresses of the machine. If you specify an IP address, Bind will listen on that specific IP address only.

Similarly, for IPv6 addresses, you can use the listen-on-v6 directive:

listen-on-v6 { ipv6_address; };
listen-on-v6 { any; };

Note that you can also specify the port on which Bind will listen. However, it is highly recommended that you do not change the default port 53.

So, to listen on a specific IP address only, the Bind configuration file (/etc/named.conf) looks like the following:

options {
directory                "/var/named"; // the default
pid-file                 "/var/run/named/named.pid";
dump-file                "data/cache_dump.db";
statistics-file          "data/named_stats.txt";
allow-transfer {"none";};
allow-recursion {"none";};
recursion no;
listen-on { any; };
listen-on-v6 { any; };
};

The above configuration file will make Bind listen on any IPv4 and IPv6 address. This means all network interfaces and all IP addresses of your Linux machine.

{ 0 comments… add one }

Leave a Comment