Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Hostnames

Configuring the Hostname of a Device by Using a Configuration Group

The hostname of a Junos OS or Junos OS Evolved device is its identification. A network device must have its identity established to be accessible on the network. That is perhaps the most important reason to have a hostname, but a hostname has other purposes.

The software uses the configured hostname as part of the command prompt and to prepend log files and other accounting information. The hostname is also used anywhere else when knowing the device identity is important. For these reasons, we recommend hostnames be descriptive and memorable.

You can configure the hostname at the [edit system] hierarchy level, a procedure shown in Configuring a Device’s Unique Identity for the Network. Optionally, instead of configuring the hostname 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 hostname, especially if the device has dual Routing Engines. This procedure uses groups called re0 and re1 as an example.

Note:

Starting with Junos OS Release 13.2R3, if you configure hostnames that are longer than the CLI screen width, regardless of the terminal screen width setting, the commit operation occurs successfully. Even if the terminal screen width is less than the hostname length, commit is successful.

In Junos OS releases earlier than Release 13.2R3, if you configured such hostnames by using the host-name hostname statement at the [edit system] hierarchy level and the the terminal screen width was less than the length of the hostname by using the set cli screen-width statement, a foreign file propagation (ffp) failure error message is displayed when you attempt to commit the configuration. In such a case, because of the ffp failure, the commit operation does not complete and you cannot recover the router unless you make the modification in the backend in the juniper.conf.gz file and commit the change from the shell prompt.

To set the hostname using a configuration group:

  1. Include the host-name statement in the configuration at the [edit groups group-name system hierarchy level.

    The name value must be less than 256 characters.

    For example:

  2. If you used one or more configuration groups, apply the configuration groups, substituting the appropriate group names.

    For example:

  3. Commit the changes.

    The hostname subsequently appears in the device CLI prompt.

Mapping the Hostname of the Switch to IP Addresses

To map a hostname of a switch to one or more IP addresses, include the inet statement at the [edit system static-host-mapping hostname] hierarchy level:

hostname is the name specified by the host-name statement at the [edit system] hierarchy level.

For each host, you can specify one or more aliases.

Example: Configuring the Name of the Switch, IP Address, and System ID

The following example shows how to configure the switch name, map the name to an IP address and alias, and configure a system identifier: