0

If I have more than one network card (I.E Ehernet and Wifi) and try to ping the machine name (echo %COMPUTERNAME%.%USERDNSDOMAIN%) I get response from one of the IP addresses.

  1. How does windows determines which one?
  2. How can I change that?
  3. Is there a way to control which IPs/interfaces will be mapped to computer host name and which won't?

Thanks

3
  • You have a misunderstanding of networking. The computer name never changes. For a home computer there is no domain, so I wonder what is %USERDNSDOMAIN% in your case. The IP is attributed by a DHCP server which is probably your router and usually rarely changes. Ping resolves host names by network protocol or the hosts file or localhost for the dummy loopback adapter. So what exactly is the question?
    – harrymc
    Commented Oct 10, 2016 at 15:41
  • 1. I do have a misunderstanding of networking. 2. the issue is quite real - I'm running a tomcat server inside vagrant raised virtualbox and trying to connect to it thru the computer name (with computer domain). For some reason I'm failing to reach vagrant instance from java but I can reach it from browser. Commented Oct 13, 2016 at 12:02
  • 1) An explanation of the Automatic Metric feature for IPv4 routes 2) The answer below 3a) In some routers should be possible to create a "local userdomain", then to manage IP and names integrating the DNS requests. 3b) You can buy/rent/have for free, a name for your host and add some secondary names...Check for Private Name Server, e.g.. Ps> about 3: A reference for Linux to have an idea.
    – Hastur
    Commented Oct 17, 2016 at 11:40

1 Answer 1

4
+50

I'll try to answer your questions as I understand them - just let me know if you would like further clarification.


  1. Windows determines which network adapter based on a "metric" value, defined by Microsoft as:

"A metric is a value that is assigned to an IP route for a particular network interface that identifies the cost that is associated with using that route. For example, the metric can be valued in terms of link speed, hop count, or time delay. Automatic Metric is a new feature in Windows that automatically configures the metric for the local routes that are based on link speed. The Automatic Metric feature is enabled by default, and it can also be manually configured to assign a specific metric."

  1. So, to change which adapter windows uses, you must manually change the metric. This can be done by opening the relevant adapter's properties from "Control Panel\All Control Panel Items\Network and Sharing Centre" and following the steps shown in the image below from left to right, noting that windows uses the adapter with the lowest metric when you enter a number in the box. (I suggest putting 1 in the box of the adapter you wish to use).

Metric Changing

With regard to your final question, harrymc's point is important - you are unlikely to be logged onto a domain on a personal computer, domains are usually reserved for large businesses or institutions.

IP addresses are assigned by the Dynamic Host Configuration Protocol (DHCP) on your router to your interface, which identifies your interface via its MAC address - computer host name as you call it, doesn't play a part in this.

  1. To answer the final question of how to control the assignment of IP addresses, the most common method is to use DHCP Address Reservation which is set up on your router. This is usually a very simple process and modern routers often show a list of currently connected devices, where you can you select a device and assign it an IP address of your choice without having to follow all the steps in the linked tutorial.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .