Related Documentation
- ACX Series
- Understanding DNS
- J Series
- Understanding DNS
- M Series
- Understanding DNS
- MX Series
- Understanding DNS
- PTX Series
- Understanding DNS
- SRX Series
- Understanding DNS
- T Series
- Understanding DNS
Reaching a Domain Name System Server
Domain name system (DNS) servers are used for resolving hostnames to IP addresses.
For redundancy, it is a best practice to configure access to multiple DNS servers. You can configure a maximum of three DNS servers. The approach is similar to the way Web browsers resolve the names of a Web site to its network address. Additionally, Junos OS enables you configure one or more domain names, which it uses to resolve hostnames that are not fully qualified (in other words, the domain name is missing). This is convenient because you can use a hostname in configuring and operating Junos OS without the need to reference the full domain name. After adding DNS server addresses and domain names to your Junos OS configuration, you can use DNS resolvable hostnames in your configuration and commands instead of IP addresses.
Optionally, instead of configuring the name server at the [edit system] hierarchy level, you can use a configuration group, as shown in this procedure. This is a recommended best practice for configuring the name server. This procedure uses a group called global as an example.
Before you begin, configure your DNS servers with the hostname and an IP address for your Junos OS device. It does not matter which IP address you assign as the address of your Junos OS device in the DNS server, as long it is an address that reaches your device. Normally, you would use the management interface IP address, but you can choose the loopback interface IP address, or a network interface IP address, or even configure multiple addresses on the DNS server.
To configure the router or switch to resolve hostnames into addresses:
- Reference the IP addresses of your DNS servers.[edit groups group-name system]
The following example shows how to reference two DNS servers:
[edit groups global system]user@host# set name-server 192.168.1.253user@host# set name-server 192.168.1.254
user@host# showname server {192.168.1.253;192.168.1.254;} - (Optional) Configure the name of the domain in which the
device itself is located.
This is a good practice. Junos OS then uses this configured domain name as the default domain name to append to hostnames that are not fully qualified.
[edit system]domain-name domain-name;The following example shows how to configure the domain name:
[edit groups global system]user@host# set domain-name company.net
user@host# showdomain-name company.net; - (Optional) Configure a list of domains to be searched.
If your device can reach several different domains, you can configure these as a list of domains to be searched. Junos OS then uses this list to set an order in which it appends domain names when searching for the IP address of a host.
[edit groups global system]domain-search [ domain-list ];The domain list can contain up to six domain names, with a total of up to 256 characters.
The following example shows how to configure two domains to be searched. This example configures Junos OS to search the company.net domain and then the domainone.net domain and then the domainonealternate.com domain when attempting to resolve unqualified hosts.
[edit groups global system]domain-search [ company.net domainone.net domainonealternate.com ] - If you used a configuration group, apply the configuration
group, substituting global with the appropriate group name.[edit]user@host# set apply-groups global
- Commit the configuration.user@host# commit
- Verify the configuration.
If you have configured your DNS server with the hostname and an IP address for your Junos OS device, you can issue the following commands to confirm that DNS is working and reachable. You can either use the configured hostname to confirm resolution to the IP address or use the IP address of your device to confirm resolution to the configured hostname.
user@host> show host host-nameuser@host> show host host-ip-addressFor example:
user@host> show host san-jose-router1san-jose-router1.company.net san-jose-router1.company.net has address 192.168.187.1
user@host> show host 192.168.187.11.187.168.192.in-addr.arpa domain name pointer san-jose-router1.company.net.
Related Documentation
- ACX Series
- Understanding DNS
- J Series
- Understanding DNS
- M Series
- Understanding DNS
- MX Series
- Understanding DNS
- PTX Series
- Understanding DNS
- SRX Series
- Understanding DNS
- T Series
- Understanding DNS