Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

hostname() Function (Python, SLAX, and XSLT)

Namespaces

Python Syntax

SLAX Syntax

XSLT Syntax

Description

Return the fully qualified domain name associated with a given IPv4 or IPv6 address. The DNS server must be configured on the device in order to resolve the domain name.

Parameters

address

String containing an IPv4 or IPv6 address.

Return Value

name

Hostname associated with the IP address.

Usage Examples

The following SLAX example initializes the variable address with the IP address 198.51.100.1. The $address variable is passed as the argument to the jcs:hostname() function. If the DNS server is configured on the device, the function will resolve the IP address and return the fully qualified domain name, which is stored in the variable host.

In XSLT:

In Python:

Release Information

Function introduced in Junos OS Release 7.6.

Support for SLAX syntax added in Junos OS Release 8.2.

Support for Python added in Junos OS Release 16.1R1.