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

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 on QFX Series switches and ACX Series, MX Series, PTX Series, and T Series routers.

Support for Python added in Junos OS Release 17.1R1 on ACX500, ACX1000, ACX1100, ACX2000, ACX2100, ACX2200, and ACX4000 routers, and EX Series switches.

Support for Python added in Junos OS Release 17.3R1 on SRX1500, SRX4100, SRX4200, SRX5400, SRX5600, and SRX5800 devices and vSRX instances.

Support for Python added in Junos OS Release 18.3R1 on ACX5048 and ACX5096 routers.

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

addressString containing an IPv4 or IPv6 address.

Return Value

nameHostname 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: