Categories: Web

How to specify a DNS server in nslookup?

You can specify a DNS server in nslookup in two modes: interactive and non-interactive.

Interactive mode

In interactive mode, you can specify a DNS server using the server or lserver commands. The server command sets the default DNS server for the current nslookup session, while the lserver command sets the default DNS server for the current nslookup session, but also uses the local DNS resolver to resolve the IP address of the new DNS server.

To specify a DNS server using the server command, type the following command:

server <DNS server address>

For example, to set the default DNS server to 8.8.8.8, you would type the following command:

server 8.8.8.8

To specify a DNS server using the lserver command, type the following command:

lserver <DNS server address>

For example, to set the default DNS server to 8.8.8.8, but also use the local DNS resolver to resolve the IP address of the new DNS server, you would type the following command:

lserver 8.8.8.8

Non-interactive mode

In non-interactive mode, you can specify a DNS server by appending the DNS server address to the end of the nslookup command.

To specify a DNS server in non-interactive mode, type the following command:

nslookup host <DNS server address>

For example, to look up the IP address of the host google.com using the DNS server 8.8.8.8, you would type the following command:

nslookup google.com 8.8.8.8

Specifying the port number

DNS servers typically use port 53. However, some DNS servers may listen on a different port. In this case, you can specify the port number using the -port option.

To specify the port number, type the following command:

nslookup -port <port number> host <DNS server address>

For example, to look up the IP address of the host google.com using the DNS server 8.8.8.8 on port 42, you would type the following command:

nslookup -port 42 google.com 8.8.8.8
itamar

Recent Posts

How to Build a WordPress Site

Did you know that over 43% of the web is powered by WordPress? That's right,…

4 months ago

Ranking-Articles.com: A Beacon of Excellence in Content Creation

In the dynamic world of digital marketing, the power of well-crafted content reigns supreme. Ranking-Articles.com…

5 months ago

Five Steps to Resolve the ERR_CONNECTION_RESET Error

In today's digital landscape, encountering the ERR_CONNECTION_RESET error can disrupt the seamless flow of online…

5 months ago

Cloud Vs. VPS Hosting: Understanding Pros and Cons

As businesses continue to seek innovative hosting solutions, the debate between cloud and VPS hosting…

5 months ago

Mariadb Vs Mysql: Key Differences & All You Need to Know

In the realm of modern database management systems, MariaDB and MySQL stand as two prominent…

5 months ago

How To Fix a 502 Bad Gateway Error

Encountering a 502 Bad Gateway error can disrupt the seamless flow of online operations, hindering…

5 months ago