LassoScript Utility
Basics Browse Detail


Tag Link [DNS_Lookup] Category Utility
Type Substitution Source Available Yes
Support Preferred Version 8.5
Change New Data Source Any
Output Type String or DNS_Response Security None
Implementation LassoScript Sets Lasso 8.5


[DNS_Lookup] performs a DNS query and returns the results in one of several formats. The tag requires a single parameter which specifies the host name or IP address that should be looked up.

If a host name is specified then the result of the tag is a preformatted string that provides all of the available DNS information for the host. If an IP address is specified then the result is an array which contains the reverse lookup host name for the address.

The -Type parameter controls what type of information about the specified host name is returned. -Type='A' returns an array of IP addresses for the host name. -Type='MX' returns an array of pairs each of which contains a priority and the IP address of a mail server (see also the [Email_MXLookup] tag). -Type='PTR' performs a reverse lookup of an IP address, returning an array of host names (the default if an IP address is passed into the tag without a type). An empty array will be returned if no answer can be determined.

The full list of supported types include *, A, NS, MD, MF, CNAME, SOA, MB, MG, MR, NULL, WKS, PTR, HINFO, MINFO, MX, TXT. If an unsupported type is required it can be specified as an integer from 0 to 255. Other parameters include -Class which defaults to 'IN' for Internet DNS queries. -NoRecurse which instructs the local DNS server to use a result from its cache or authoritative knowledge and not to query additional DNS servers. -Inverse performs an inverse lookup. -Status performs a status lookup.

By default the tag returns an array of values if a -Type is specified (or if an IP address is passed to the tag for a reverse lookup) and a formatted result string if no -Type is specified. The -Format parameter forces all query types to return a formatted result string. -BitFormat returns the low-level data which was received from the remote server formatted for readability. -ShowResponse returns a [DNS_Response] object representing the response from the remote server which can be further manipulate.

The query which is being performed can also be inspected. The following parameters cause the [DNS_Lookup] tag to return information about what query it will perform, but the query is not actually performed. -FormatQuery returns a formatted string showing the query. -BitQuery shows the low-level data of the query formatted for readability. -ShowQuery returns a [DNS_Response] object representing the query which can be further manipulated.

Note: Lasso's DNS tags only support DNS hosts which communicate through TCP. The DNS host built into some DSL/Cable modem gateways only support UDP communications and cannot be used through Lasso. In order to use the DNS tags (and the MX lookup feature for direct sending of SMTP email) it may be necessary to specify a valid DNS host either in the system network preferences or in the Setup > Site > Lasso Settings section of Lasso Stie Administration.


[DNS_Lookup: '']

[DNS_Lookup: '', -Type='A']

[DNS_Lookup: '', -Type='MX']

[DNS_Lookup: '']

[DNS_Lookup: '', -Type='A', -Format]

[DNS_Lookup: '', -Type='A', -BitFormat]


Required Parameters
Host Name The host name to lookup or the IP address for reverse lookups.
Optional Parameters
-Type The type of lookup to be performed. Defaults to *, returning all available information for host names and to a reverse lookup for IP addresses. See the description for a full list of possible values.
-Class The class of the lookup, usually not necessary to change from the default.
-NoRecurse If set then the DNS query will only return the data from the local DNS server. This can be useful for checking the DNS cache without causing a recursive lookup.
-Inverse If set then an inverse lookup is performed.
-Status If set then a status lookup is performed.
-Format If set then the tag returns the output from the DNS server formatted in a human readable format.
-BitFormat If set then the tag returns the low-level response from the DNS server. Useful for debugging.
-ShowResponse If set then the [DNS_Response] object is returned.
-FormatQuery If set then the DNS lookup is not performed, but the query is simply returned in human readable format.
-BitQuery If set then the DNS lookup is not performed, but the query is returned in low-level format.
-ShowQuery If set then the DNS lookup is not performed, but the [DNS_Response] object for the query is returned.


See the Lasso 8 Language Guide for examples of how to use this tag.