ON THIS PAGE
Example: Configure a Device’s Unique Identity for the Network
To use a device in a network, you must configure the device’s identity. Configuring the device's identity makes the device accessible on the network and allows other users to log in to it. You can refer to any Internet-connected device 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
Using DNS is an easy and scalable way to resolve IP addresses from hostnames. However, you might not have a DNS entry for the device. You might not want the computer to contact the DNS server to resolve a particular IP address. Perhaps you use this particular IP address frequently. Maybe you use it only for testing or development purposes and do not want to give it a DNS entry.
To configure a device's unique identity, you might need to include some or all of the following details: The hostname of the device, its IP address, the domain name, and IP addresses for one or more name servers.
Requirements
We are using a private IP address for the example, but a globally routable IP address and DNS registration is needed to receive information back about your device from a web name server.
Overview
In this example, the hostname is the device’s name. Most people find it easier to remember a hostname than an IP address. The software uses the configured hostname as part of the command prompt, to prepend log files and other accounting information, and in other places where knowing the device identity is useful. You can also use the hostname to telnet to a device.
You append a domain name 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.”
If a hostname for an IP address does not have a DNS entry in a name server, configure a static host mapping. See static-host-mapping for more information.
This example uses the values given in the following table to configure each of these variables. You need to substitute data specific to your device and network for these values.
Name of Variable |
Value Used in Example |
---|---|
|
|
|
|
|
|
|
|
Configuration
CLI Quick Configuration
To quickly configure a device using this example:
-
Copy the following commands and paste the commands 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
[edit]
hierarchy level. -
Enter
commit
in configuration mode.
set system domain-name example.net set system host-name R1 set system name-server 8.8.8.8 set interfaces ge-0/0/0 unit 0 family inet address 172.16.1.1/24 set routing-options static route 0.0.0.0/0 next-hop 172.16.1.254
Configure the Device's Identity
Step-by-Step Procedure
To configure the identity settings of a device:
-
Configure the domain name of your network.
[edit] user@R1# set system domain-name example.net
-
Configure the hostname of the device.
[edit] user@R1# set system host-name R1
-
Configure the name server. Multiple name servers can be configured. For instance you might have an internal name server and an external or Internet name server.
[edit] user@R1# set system name-server 8.8.8.8
-
Configure the interface connected to the DNS server. In this example we configure the interface connected to the Internet.
[edit] user@R1# set interfaces ge-0/0/0 unit 0 family inet address 172.16.1.1/24
-
Configure a route to reach the DNS server. In this example we configure a default route to the next hop for the Internet.
[edit] user@R1# set routing-options static route 0.0.0.0/0 next-hop 172.16.1.254
Results
To check the configuration, use the configuration mode show
command. In this output we omitted configuration that is not part of the
example, for instance login and management interface configuration.
[edit] user@R1# show system { host-name R1; domain-name example.net; name-server { 8.8.8.8; } } interfaces { ge-0/0/0 { unit 0 { family inet { address 172.16.1.1/24; } } } } routing-options { static { route 0.0.0.0/0 next-hop 172.16.1.254; } }
When you have the correct configuration, enter commit
.
Verification
Verify the Hostname and the IP Address of the Device
Purpose
Verify that the hostname and the IP address of a device are as expected.
Action
Issue the show host host-name
operational
command.
user@R1> show host juniper.net juniper.net has address 52.42.68.58 juniper.net mail is handled by 10 mxa-00273201.gslb.pphosted.com. juniper.net mail is handled by 10 mxb-00273201.gslb.pphosted.com. user@R1> show host R1 R1.example.net is an alias for R1.example.net. R1.example.net has address 172.16.1.1
Meaning
The output shows you are able to obtain DNS information from the Internet and about your router. The output for your device will require domain name registration if using a web DNS server. Such registration requires a globally routable IP when using public DNS servers.