How do hosts inside a private network using the 10.0.0.0/8 address space know each others IP?
Normally to obtain an IP address DNS is used, but since DNS won't work in this case, how will they find the IP address of another host inside the same network?
They don’t. Hosts don’t just look for or access other hosts1. The computer does what you instruct it to do. Want to go to https://google.com
? You type it in your browser. Want to go to http://192.168.2.1
? You type that in, too.
DNS isn’t the only way you could come to know hosts’ IP addresses. Someone set up the network. They would know and could tell you, verbally, in writing, …. On SOHO routers, the default IP address is usually in the manual.
Still, in enterprise networks, DNS is usually used anyway because it scales. However, do keep in mind: You also don’t magically discover web addresses. They’re given to you, you find them in search machines/directory services…
1: Technically, computers actually do look for stuff on the network all the time, using link-local discovery mechanisms, all of which use broadcast messages.
Your assumption is flawed. DNS has a lot of uses - including converting a domain name into an IP address - but not finding an IP address.
Simplifying a bit - You may be aware that most computers in home networks get their IP addresses using DHCP. The DHCP client sends a request out the network interface asking everything that will listen "Can you give me the information I need to get onto the network". Included in this request is a unique address associated with the network card (called a MAC address). The DHCP server responds to the MAC address making the request with the necessary details. Included in this request are:
- The IP address the device should use.
- The netmask for the local network.
- Any DNS servers that the device should be use.
- The address of the router
- Possibly other details we don't need to worry about, and which may or may not be included for additional functionality.
The important bit is that the IP address, when combined with the Netmask, tells the computer what computers are on the same LAN as it is. It also knows to use the router for any IP addresses which are not on the LAN.
Lets assume the IP address is 10.1.1.1 and the netmask is 255.255.255.0. This netmask allows the computer to know that any traffic going to 10.1.1.x is on the LAN.
When it needs to speak to another computer on the LAN the computer sends out a broadcast (ARP) request saying "What computer on the LAN has this IP address?" The computer that has it then says "I DO", and provides the MAC address associated with the IP address. The computer then sends packets onto the LAN addressing it to the MAC address associated with the IP address. You can see a list of IP addresses on the LAN that your computer has tried to speak to "recently" by looking at the ARP table - probably by opening a cmd/powershell/bash prompt and typing "arp -a"
TLDR - devices on Ethernet have unique addresses called MAC addresses. These MAC addresses are mapped to IP addresses and the computers broadcast traffic to each other on these MAC addresses. Switches also learn what MAC addresses are associated with what ports (and this is what differentiates them from hubs)