How can I get IP/host using windows commandline?

1

1

nslooup something.com 127.0.0.1 nslooup 10.20.30.40 127.0.0.1

will send a query to 127.0.0.1 UDP 53. I want to use "127.0.0.1:545/UDP" as a DNS resolver.

Is there any good commandline tool(Open source & free only) that I can call it from command line?

Something like: https://github.com/jedisct1/dnscrypt-proxy/tree/master/src/hostip Sadly, it can't resolve IP to hostname, so I don't use it.

hostip.exe -r 127.0.0.1:545 something.com

Dont DownvoteMe

Posted 2014-06-28T06:22:52.057

Reputation: 11

Also what version of Windows? – Jason C – 2014-06-28T06:39:26.420

Answers

2

Well, documentation seems a bit inconsistent.

According to this (via "nslookup specify server port"):

In the nslookup console you can just type:

set port=545

To set the server port. In theory that means on the command line you can do:

nslookup -port=545 something.com 127.0.0.1

However I tried this on Windows 7 and it had no effect. Interestingly, the in-console help does not show port as a valid option on my system, yet clearly it knows about the option because set po=123 sets port (according to set all). So I can't really explain how it knows to expand po to port but does not list port as an option and does not honor it.

There is a second nslookup doc that states something different, though. For whatever reason Windows 7 is conspicuously skipped in the "applies to" list so I can't test it, but that says you can do the following for other versions of Windows:

nslookup /set port=545 something.com 127.0.0.1

My version of nslookup does not have a /set option, though.

In any case type nslookup /? and see what your options are.

Jason C

Posted 2014-06-28T06:22:52.057

Reputation: 8 273

nslookup "-set port=545" something.com 127.0.0.1 seemed to do the trick for me on Windows 7. – canton7 – 2018-03-16T17:16:10.407

nslookup "-set port=545" will NOT actually use port 545 if you check your logs or use a packet analyzer like Wireshark. At least not on Windows 7. – utopia – 2018-04-24T15:21:59.210