3

Let's say you have a brand new 192.168.1.0/24 network that consists of a router, switch and two hosts (H1 and H2).

H1 would like to communicate with H2, but since this is a brand new network and no communication has never taken place before, how does H1 even know that H2 exits?

I understand that initially, the two hosts would not be aware of each other's IP addresses. I also understand that after a host becomes aware of another host's IP address and determines that it is on the same LAN, it can simply ARP to discover another host's MAC address. I'm just struggling to grasp how one host initially discovers the existence of other locally connected devices.

The answer to the question Found Here talks about the role of DNS, but I still don't understand how H1 would know the name of H2 to even ask the DNS server about what IP address belongs to a given name. Is there some sort of protocol/service that enables hosts existing on the same LAN/VLAN to know about all other hosts connected to that same LAN/VLAN?

In smaller networks that don't utilize a local DNS server, is this accomplished by NetBIOS? I'd be interested to also understand how this 'discovery' process works in this type of environment as well.

Thanks head of time!

2 Answers 2

6

This is an actual problem.

Most often, one hosts "wants" something from the other host, so it'll try to connect via a known DNS name. In a company network, a DNS server provides the IP address for a name (A record) and you're set. In smaller networks, broadcast name resolution might be working - this is also used by NetBIOS.

Broadcast to some UDP port is also used by various protocols for peers to "find" each other. Most often, multicast would actually be a better choice.

Generally, there is no single protocol or method that'll allow you to discover your local network in total. Various "bootstrap" methods can be used though. E.g. a Microsoft SMB client often discovers the DNS server by DHCP and then uses special DNS records to locate the nearest domain controller, LDAP server etc.

3
  • I just thought of this after reading your response, but a DNS server uses DDNS to dynamically keeps its Name to IP address records up-to-date, correct? So if a host needs to access something from another host, it would just need to query the DNS server since it would have an accurate list of all nodes on a given domain (by communicating with the DHCP server, i.e. DDNS). Is that an accurate statement? I guess I am still a bit confused, though, on how a host would discover the name of a file server, for example. Is that where the "special DNS records" come in?
    – ahelton
    Commented Aug 14, 2018 at 20:17
  • 1
    DDNS is a special case where an A record is dynamically updated when a host's IP address changes - commonly used with dynamic public IP addresses but not in use for servers within an organizational network. The rest is absolutely correct. A file server's name may be provided by a client login script that is in turn provided by a domain controller (or a similar authentication server) that is in turn provided by a DNS server that is in turn provided by DHCP, ....
    – Zac67
    Commented Aug 14, 2018 at 20:29
  • Ah. Thanks for the clarification. I've been learning all these terms lately and am trying to figure out how it all works together.
    – ahelton
    Commented Aug 14, 2018 at 22:08
3

One possible way (by far not the only one) is mDNS based Service Discovery as per Zeroconf Networking, based on link-local multicast (see Zac67's statement) and the DNS domain .local. For a good overview of Zeroconf, see Wikipedia on Zeroconf Networking, which also refers to RFC 6763.

Oversimplified: The service discovery section (mDNS-SD) of Zeroconf Networking specifies rules how to define more-or-less-widely-known service names, and how to represent and query them in a DNS-like way. These service names (and Computer Names, too) can be resolved by multicast DNS (mDNS) by interested hosts.

Example: Let's pick _ipp._tcp.local for an IPP capable printer. A host on the subnet interested in findig an IPP capable printer can multicast a DNS query for the name _ipp._tcp.local to the link-local multicast address 224.0.0.251.

Any host (in this case: a printer) which is turned on, has an IPP service running and by configuration feels inclined to respond (because mDNS-SD support is activated) may send a DNS response. From the answers coming in, the querying host may then populate its own list of IPP capable printers, and present it to the user.

The same multicast DNS (mDNS) resolution can be applied to find the IP address of othercomputer.local, or myinternalwebserver.local, so a user can direct his browser to http://myinternalwebserver.local

As Zac67 pointed out - there is no single universal way to do service or computer discovery on a network. HP uses someting similar to find their printers (using routeable multicast address 224.0.1.60), Apple calls their Zeroconf implementation Bonjour or Rendevous, one of the Linux implementations is called Avahi, and there's other ones, too, see the Wikipedia Page.

Eventually, the challenge remains the same: a host (or: software running on a host) interested in finding services on the local network must know what kind of services it is looking for, and send out an appropriate query.

4
  • That's interesting. So Zeroconf essentially automates what would other wise be a manual operation? From the Wikipedia article, it would seem that even modern SOHO routers have Zeroconf capabilities. I'm guessing the goal then is to simplify the setup of a network for average everyday users (in that particular case). And within ZeroConf there are certain queries that can be sent by a host on a network that are more or less "seek queries" with the goal to find a particular type of service, but this is generally vendor specific and not standardized by any organization or entity.
    – ahelton
    Commented Aug 14, 2018 at 22:25
  • 1
    Indeed, Zeroconf was geared to the single-subnet use case; this in itself makes it diffictult to implement in mutli-Subnet (VLAN, SSID etc..) environments. To let a mobile device on a WiFi network discover a wired printer in another VLAN (think students with their iDevices at the university library wanting to airprint), Zeroconf requires a gateway/proxy with directly attached connectivity into both subnets. This even lead to service discovery gateway features on WLAN controllers and routers. Commented Aug 14, 2018 at 22:58
  • Is it possible also that a host learns the name or IP address simply because you tell (as in the user) the host specifically what it is? For example, if I'm mapping a shared network drive in Windows I have to essentially point other hosts to that drive by inputting the \\FileServerName\FolderName and then properly authenticate when prompted for a username and password. This would appear to be explicitly informing a host about where it should look for some particular information.
    – ahelton
    Commented Aug 14, 2018 at 23:20
  • 1
    If an application (by configuration) or by user interaction tells the computer's network stack to to request something from another computer (in your example: fileserver), then the IP stack's name resolution procedures (which have a specific order, given by the OS) are invoked: e.g. hosts file, DNS, mDNS, broadcast. The IP address returned from name resolution will be used to invoke the subsequent connection to that other host. If that is to be ICMP, UDP, TCP and (if applicaple) which port to use is up to the application. But now we're discussing host behaviour - off topic for this board. Commented Aug 14, 2018 at 23:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.