EzDevInfo.com

nslookup interview questions

Top nslookup frequently asked interview questions

DNS lookup with custom DNS server in Objective-C

From a Mac OS X app, I want to resolve some domain names using a specific DNS server (that has not been set in System Preferences), and easily retrieve the resolved addresses.

I can do this in Terminal with nslookup google.com DNS_SERVER but can't find a simple way to accomplish it in Objective-C. I though NSHost would have a similar way to specify the DNS server to resolve with, but unfortunately it doesn't.

Any suggestions as to how to go about this?


Source: (StackOverflow)

** server can't find hostname.com nxdomain

I am trying to set up an apache web server on my vm and im running into some issues. When I do an 'nslookup' on the hostname of the machine this is what I get:

nslookup rhel64.xxxxx.xxxxx.com
Server:         xxx.xxx.32.1
Address:        xxx.xxx.32.1#53

** server can't find rhel64.xxxxx.xxxxx.com: NXDOMAIN

I'm sure this is a common problem but I'm not sure how to fix it. It seems that dnsmasq can't resolve the hostname. Adding the hostname to /etc/hosts doesn't fix it. Running on an RHEL6.4 machine. Thanks in advance.


Source: (StackOverflow)

Advertisements

Reverse DNS lookup in perl

How do I perform a reverse DNS lookup, that is how do I resolve an IP address to its DNS hostname in Perl?


Source: (StackOverflow)

How to perform "nslookup host server"

My C# service needs to periodically poll nslookup host server. Currently it spawns a Process that executes batch script. Due to performance reason I'm considering to do this check using some API. But the problem is, that using, for example, System.Net.Dns.GetHostAddresses I can only emulate nslookup host check, but not nslookup host server (without seconds param).

I've looked at bunch of similar SO questions, but none of them seem to solve my issue.

Are there any way to perform nslookup host server in C# without using some heavy third-patry library?


Source: (StackOverflow)

Most efficient way to programatically determine if a web domain is available?

I am writing some code to determine whether a network domain is registered. For example, I want to check if "Google123.com" is available. There are at least two ways I can do this programatically, but I'm not sure which is more valid:

  • A) In linux/cygwin, I can launch the whois command to see if a domain is in use.
  • B) In linux/windows, i can launch nslookup command to see if a domain is resolvable.

My questions are:

  1. Is nslookup really a valid way to check for registration? Does every registered domain have a name server and show up in DNS?
  2. What is the fastest way to make this registration check? Any tips or other ways to do it?

Source: (StackOverflow)

how to write nslookup programmatically?

instead of using exec in our script to do an nslookup, is there an easy way to write it programmatically in PHP, Python, or Ruby?


Source: (StackOverflow)

DNS lookup and HTTP proxies

How are DNS lookups managed when using a proxy ? I tried to nslookup google.com and it is unable to find it from my local DNS so what is the path of DNS lookups with a simple HTTP proxy ?


Source: (StackOverflow)

in c#, can't suppress every line of a process

I'm trying to read the output of a process to string. For some reason, it sort of looks like the one line in the middle of the output seems to get outputted (ie, it's displayed on the screen, and NOT saved to the string).

string strOutput = "";
Process process = new Process();

process.StartInfo.FileName = "nslookup";
process.StartInfo.Arguments = "-type=mx uic.edu";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start();

strOutput = process.StandardOutput.ReadToEnd();

process.WaitForExit();

Console.WriteLine("xxxxxxxxxxxxxxxxxxx");
Console.WriteLine(strOutput);
Console.WriteLine("yyyyyyyyyyyyyyyyyyy");

I get output that looks like this:

Non-Authoritative answer:
xxxxxxxxxxxxxxxxxxxx
Server: aaa.myserver.com
Address: 111.222.111.222

uic.edu MX preference = 10, mail exchanger - ...
...
yyyyyyyyyyyyyyyyyyyy

When I run the command via command line, "Non-Authoritative answer:" comes after "Address: ..."

Can someone explain why it's outputted, and not stored as part of the string? I'm probably missing something obvious, but I'm boggled.

Thanks


Source: (StackOverflow)

reverse lookup multiple IP's

If I do the below on a computer I get two IP's back. Nowthen, I want to extract both IP's and then do a reverse lookup on them - ie "nslookup IPADDRESS".

How do I extract each entry and then let it do a reverse lookup on the address?

$computername = gc env:computername
[System.Net.Dns]::GetHostByName($computername) | select AddressList

AddressList                                                                                                                                                  
-----------                                                                                                                                                  
{10.171.80.249, 10.171.80.82}    

Source: (StackOverflow)

Why golang Lookup*** function can't provide a server parameter?

For nslookup command, it has nslookup somewhere.com some.dns.server.

However, it seems that golang dnsclient only load config from /etc/resolv.conf

code here: https://golang.org/src/net/dnsclient_unix.go#L225

Does the golang standard library provide something like func LookupTXT(name string, dnsServer string) (txt []string, err error) ?

requirement: 1. Don't change the default /etc/resolv.conf.


Source: (StackOverflow)

Why can't I print out all ip addresses from a nslookup in c#

Hello I have a question i'm trying to get all ip addresses of an nslookup domain. I'm using the following script in c# on a button but it only prints out 1 ip address, what am I doing wrong?

string myHost = "domain.com";
string myIP = null;


for (int i = 0; i <= System.Net.Dns.GetHostEntry(myHost).AddressList.Length - 1; i++)
{
    if (System.Net.Dns.GetHostEntry(myHost).AddressList[i].IsIPv6LinkLocal == false)
    {
        //myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[i].ToString();
        txtIp.Text = System.Net.Dns.GetHostEntry(myHost).AddressList[i].ToString();
    }
}

All help would be greatfull because I've seen mutiple answers here on stackoverflow but I can't get one to work properly.

regards, Dennis


Source: (StackOverflow)

Nslookup or dig in Google App Script

Is there any way to run an nslookup / dig in Google App Script? I m looking to get the results of this command in a Google Spreadsheet.

Thanks


Source: (StackOverflow)

NSLOOKUP in R (rstats)

I am new to scripting and R.

In the Windows cmd.exe I can perform an NSLOOKUP on a domain by:

nslookup www.google.com

I have a dataset of domain names that I would like to verify as valid or invalid as part of my grouping process in R. Is there a way to do NSLOOKUP in base R or one of the packages?

Edit1: I made some alterations to loop through 3 domains using the system call suggested. The call works, however the output will not save directly into a vector (line 7 below). How would I need to rework this line so that I can capture the output?

domains <- c('www.google.com','www.badtestdomainnotvalid.com','www.yahoo.com')
dns <- vector()
dnsreturn <-vector()
for(i in 1:length(domains)){
  dns[i] <- paste('nslookup ',domains[i],sep='')
  dnsreturn[i] <- system(dns[i],intern=TRUE)}
}

Source: (StackOverflow)

Getting IP addresses for hostnames using nslookup in Powershell

I am new to Powershell scripting and I need to write one script. I have a list of server hostnames and I need to get IP addresses of those servers and write the results in a file.

The hostnames are one column in Excel spreadsheet but I can format them into anything (csv, simple txt file with one hostname per line etc.).

I would like to format the output the way there is a hostname of the server and its IP address per line (so there are multiple lines in case the server has more than one IP).

So far I have been using the simple text file with hostname per line, but from the output in PS I am unable to distinguish what server the IP address is for.

$servers = get-content "path_to_the_file" 
foreach ($server in $servers) {
[System.Net.Dns]::GetHostAddresses($server)
}

So I was wondering about loading the hostnames from csv file and printing the hostnames and related IP addresses to another csv again, but I am unsure how.

I am investigating the possibility to capture the required information (hostname and IP) by running nslookup $server in foreach.

Could someone give me a hand?

Thank you.


Source: (StackOverflow)

bash nslookup runs unmotivated ls

When I run

echo `nslookup 100.100.100.100`

in bash, it list all files (independent of the (non existing) ip adress). Is this an undocumented error, or what is going on?

I do realize that the echo is not needed here.

hpek@hpek:~/temp/nslookupTest$ touch fil1.txt
hpek@hpek:~/temp/nslookupTest$ touch fil2.txt
hpek@hpek:~/temp/nslookupTest$ touch fil3.txt
hpek@hpek:~/temp/nslookupTest$ echo `nslookup 100.100.100.100`
Server: 10.10.10.1 Address: 10.10.10.1#53 fil1.txt fil2.txt fil3.txt server can't find 100.100.100.100.in-addr.arpa.: NXDOMAIN
hpek@hpek:~/temp/nslookupTest$ 

Source: (StackOverflow)