How does WMI resolve hostname to IP - ip

For a machine with multiple IP addresses and has a hostname, how does the WMI remote query choose which IP address to connect to? I know that if we set the IP address of a machine in "hosts" file, the ping command will resolve to that IP address.
The reason I have this question is because one of the proprietary app
that I used had WMI query to get remote info, but it used different IP
to connect to the target machine than the one supplied in "hosts"
file.

Related

IP address is not reachable or is invalid

I am facing a strange issue these days. I have a list of IP addresses which I want to connect to during the deployment using Jenkins. Now what is happening is, if I am deploying at one IP address (remote machine but in same location) in my local location server, I can successfully do that. But If I am trying to deploy to an IP address (remote machine in other country/region) It is throwing the error, saying
Error : Ip address XYZ is not reachable or is invalid.
Please be notified that I am able to get the response from the machine when I ping it using:
ping XYZ
But while trying to deploy on it using Jenkins, I am not.
Please let me know if there's any solution for this problem.
There isn't enough data points but you can look for these things
1. IP address, Check if all three machines are in same n/w (Jenkins Server, target and your machine)
You can check it with IP address of each machine
2. check Gateway set for Jenkins server
3. Best way if feasible is to ssh / rdp to your Jenkins server and try running your command manually that will give you
Local machine get loopback address(127.0.0.1), so it will be reachable or any local machine having IP address with same subnet mask thats called LAN.
When you are reaching out to remote machine, either it should be public IP address(visible to everyone in the world) or you must have connect to that Area-Network via VPN, this is called tunnelling to remote over the WAN (wide area network). Their(remote location) again, you will notice that all the IP address have same subnet mask as you have on the local machine.
So their could be be IP address duplication case in VPN scenario, where you are bale to ping but not able to reach. This is because, IP address is assigned to other machine but not you yours and ping responses are coming from that other machine. That means your machine is in failed to resolve ARP and in dormant state.

Access internal resource from external ip

I have a network with a resource with an internal ip of 192.168.1.254 for example. I need to be able to access this resource from the external IP address of 86.126.1.234 let's say. I am off site and need to use VNC to access this computer.
How can I access this resource using just the two IP addresses.
Thanks in advance,
Maksim
192.168. is a non routable ip address.
You need an external facing ip address.
to find out your external ip address you can try
whatsmyipaddress.com
You will probably need to change your router configuration to make your VNC port forwarded to 192.168.1.254.
Or, you if you just need remote control access to your Computer, try using
www.teamviewer.com

How to find the local IP address that will be used for communication with a remote IP

Given that the local machine has multiple interfaces and I connect to a remote machine, the OS will choose the interface through which the remote IP address is reachable. If my client doesn't explicitly bind to a specific IP and if the remote machine is reachable via more than one interface, is there a way to detect which local IP address will be used for the communication or is it purely random?
In Linux at least, it needs to have the route specified in the routing table, it is not random.

How can a VM work out the address of the host node?

How can a Linux VM work out the IPaddress of the host node?
I need to connect to the IP address of the host node. I also need to know when it changes as it could be a dynamic IP. I need it to connect to a service there.
Is there some way to check this, irregardless of the type of VM, VMWare, Xen, Virtual Box?
It needs to be a Linux script, and should work regardless of the host operating system, whether Linux or Windows
My solution is to bridge a network adapter in the VM with one on the host, making it a dymanic IP address. As such it will always be on the subnet as the host adapter.
Next thing is to run an HTTP service on the host IP, that the VM will scan its network range on. The IP the service responds on will be the IP of the host. Having an IP service on the host is not ideal, but it is the best I can come up with.

I am getting the wrong client IP address

I am running an ASP.NET application. The web server is located on the same system. In the code behind I just want to get the IP address of the requesting client. I am using this code:
Request.UserHostAddress
But I am getting a wrong address: 127.0.0.1. My system IP address is 198.162.0.27.
You are getting the right one. 127.0.0.1 is the loopback IP address, which is mapped in your hosts file to localhost.
If you connect from a remote computer, you will get the remote computers network address.

Resources