Question Simple Networking Question/Concepts

Jan 8, 2021
5
0
10
0
Hey there Guys!

I don't really interact with networking very much and, thus, realized I ultimiately don't know how a lot of communications work.

To my understanding; with a normal connection to a website from a computer:
- The computer sends a packet to the router instructing it wants to go to example.com
  • The router assigns a port to the connection and sends the packet out to a DNS server asking where example.com is
  • The whole DNS thing happens, which is fun in itself, and then eventually the information to the IP address of example.com is returned
  • Message is sent to that IP
  • The message includes the ports that a communication should be received on
  • The website responds to the message, sending the message back via the specified port
  • Because it came on that port, the message is routed from the server to the computer on the internal network


A few questions then:
0.) Is this even correct?
1.) When the router ultimiately sends to an IP, what is happening here? How does it know which 'direction' to send the message to based on the IP? What does it do with this IP?
2.) What happens if, later, the server wants to talk to that computer in the internal network? Would that port have to be open/routed for it to connect, since the server ultimiately has no idea of 'who' it is communicating with other than that external IP? Can it just not do it?

Connected to that question is a scenario for another question that kind of shows my misunderstanding/confusion:
3.) If one system has software for being remote controlled and the other has software for controlling a system, how does one know that the other is online? Is this just done through a 3rd party server that each application keeps polling to see if one or the other is online? E.g. in the case that you can see the computer is online from the remote control software.
4.) I don't see a way that two computers, both with hidden internal network IPs, only showing external can talk to each other without some 3rd party being involved and constant polling, or port forwarding being set up on the router (which I don't see/notice in the software used)
5.) Is it just a case that when the controller, on one network, selects to 'connect' to the other computer it's really being facilitated through a 3rd party server that will pass along ports to use, etc? If this is the case, are there ways to do it without it?
6.) If there are two computers on two different networks, without any applications or 3rd party servers involved, could they interact with each other? Presumably you'd have to know the internal IP and there is some way to tell the router just to send your data there directly, etc?

Sorry for the block of text; hopefully I've not made a fool of myself here with the somewhat basic questions but it's not something I've thought about until now and I've never studied networking.

Thanks in advance,
SinPi
 

hotaru.hino

Commendable
Sep 1, 2020
1,564
489
1,640
35
0.) Is this even correct?
More or less.

1.) When the router ultimiately sends to an IP, what is happening here? How does it know which 'direction' to send the message to based on the IP? What does it do with this IP?
When your computer sends a request to a remote computer out on the network, there's information in it much like how you would write out stuff on a letter. This information contains a source and destination IP address, as well as a source and destination port (at least if the application is using TCP or UDP). In addition, the router also has information on how to route packets based on what the destination IP address is. For example, a router knows that all 192.168.1.X packets are local, so any packets with said destination addresses will be kept locally. But if there's a packet with a destination address that's not in that range, it'll throw it to the outside world and the next node gets to handle it. When the remote computer replies back, the source and destination values basically flip.

2.) What happens if, later, the server wants to talk to that computer in the internal network? Would that port have to be open/routed for it to connect, since the server ultimiately has no idea of 'who' it is communicating with other than that external IP? Can it just not do it?
Routers are smart enough to know that if a computer in the internal network sent a packet out to a remote computer, any response back from the remote computer should go back to it. The problem is when said computer in the internal network is a server because to the rest of the world, all of the computers in that internal network have the same IP address. A port is akin to an apartment number in a physical address. If you forget the apartment number, the courier won't know who to actually deliver to.

3.) If one system has software for being remote controlled and the other has software for controlling a system, how does one know that the other is online? Is this just done through a 3rd party server that each application keeps polling to see if one or the other is online? E.g. in the case that you can see the computer is online from the remote control software.
4.) I don't see a way that two computers, both with hidden internal network IPs, only showing external can talk to each other without some 3rd party being involved and constant polling, or port forwarding being set up on the router (which I don't see/notice in the software used)
5.) Is it just a case that when the controller, on one network, selects to 'connect' to the other computer it's really being facilitated through a 3rd party server that will pass along ports to use, etc? If this is the case, are there ways to do it without it?
Either the software can continuously poll it or if the remote computer doesn't respond, the local computer retries and declares something is wrong after a certain number of retries have been attempted. Also you can declare something is wrong if you're expecting a constant stream of data and this stream is interrupted after a certain amount of time.

6.) If there are two computers on two different networks, without any applications or 3rd party servers involved, could they interact with each other? Presumably you'd have to know the internal IP and there is some way to tell the router just to send your data there directly, etc?
Yes, as long as everything in the chain knows how to direct packets then the computers can talk to another without applications doing some black magic behind your back.

I feel like 3-6 you feel there needs to be software in the middle or something that monitors network traffic. This is not the case. At the bare minimum, every computer with networking capabilities just needs to know how to direct the packets it receives. For those packets to actually be processed by the destination computer though, something has to be running to accept and process it.
 

ASK THE COMMUNITY

TRENDING THREADS