Configuring a Device’s Unique Identity for the Network
To use a device in a network, you must configure the device’s identity. Doing this makes the device accessible on the network and so that other users can log in to it. You can refer to any Internet-connected machine in either of two ways:
By its IP address
By its hostname
Once you have a hostname, you can:
Find the IP address
Use the Domain Name System (DNS) to resolve an IP address from a hostname
Manually map the hostname to a static IP address
Although using DNS is an easier and more scalable way to resolve IP addresses from hostnames, you might not have a DNS entry for the router, or you might not want the computer to contact the DNS server to resolve a particular IP address. In this latter instance, perhaps you use this particular IP address frequently, or you might be using it only for testing or development purposes and do not want to give it a DNS entry.
To configure a router’s unique identity, you might need to include some or all of the following details: The hostname of the router, its IP address, the domain name, and IP addresses for two or three domain name servers.
No special configuration beyond device initialization is required.
In this context, the hostname is the device’s name. It is easier for most people to remember a hostname than an IP address. Junos OS uses the configured hostname as part of the command prompt, to prepend log files and other accounting information, as well as in other places where knowing the device identity is useful. You can also use the hostname to telnet to a device.
The domain name is the string appended to hostnames that are not fully qualified. The domain name is the name of a network associated with an organization. For sites in the United States, domain names typically take the form of org-name.org-type—for example, “Juniper.net.”
In case your hostname and IP address do not have a DNS entry in a name server, configure a static mapping.
The values given in the following table are used to configure each of these variables. You need to substitute data specific to your device and network for these values.
Table 1: Values to Use in Example
Name of Variable
Value Used in Example
Value You Substitute
CLI Quick Configuration
To quickly configure a device using this example
Copy the following commands and paste them in a text file
Remove any line breaks
Change the values listed here to match your network configuration
Copy and paste the commands into the CLI at the  hierarchy level
Finally, enter commit from configuration mode
Configuring the Router’s Identity
To configure the identity settings of a device:
- Configure the domain name of your network.user@host# set system domain-name device.example.net
- Configure the hostname, using the set system host-name command.user@host# set system host-name example-re0
- Configure from one to three name servers.user@host# set system name-server 172.24.16.115user@host# set system name-server 192.0.2.0
- Map from the hostname to the IP address, using the set system static-host-mapping command.user@host# set system static-host-mapping example-re0 inet 172.22.147.39
To check the configuration, use the configuration mode show system command.
When you have the correct configuration, enter commit.
Confirm the Device Hostname and IP Address
Confirm the hostname and IP address of a device are as expected.
Issue the show host host-name operational command.
user@example-re0> show host newton
newton.device.example.net is an alias for example-re0.device.example.net. example-re0.device.example.net has address 172.22.147.39