Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resolve-DnsName -Server on specific Port

I'm trying to run a nslookup by specifying the host IP as as follows:

Resolve-DnsName -Type A -TcpOnly -DnsOnly -NoHostsFile -QuickTimeout -Server $THIS_MACHINES_IP -Name $NAME_OF_SERVER     

I get the following error when it runs:

An existing connection was forcibly closed by the remote host

The problem is that $THIS_MACHINES_IP server is running in a restricted environment so only few ports are open. In this case I need to run it on port 7450, i.e. $THIS_MACHINES_IP:7450.

Does anyone know how I can provide the port number when using Resolve-DnsName or alternative means to achieve the same?

like image 969
ke3pup Avatar asked Aug 31 '25 04:08

ke3pup


1 Answers

Resolve-DnsName doesn't allow changing the port. You could use nslookup, though:

nslookup -port=7450 $NAME_OF_SERVER $THIS_MACHINES_IP

However, running a nameserver on any port other than 53 is not a good idea in the first place. I wouldn't recommend it.

like image 90
Ansgar Wiechers Avatar answered Sep 02 '25 22:09

Ansgar Wiechers