5

I just knew by theory how two host communicate through a port and a protocol, and i always thought that they must be using the same port number aat both ends to communicate, but looking at the network traffic(using iftop on unix) on my computer confuses me abit. As you can see there was an https request(port 443) but on my side it uses several different unknown ports why is that ?

192.168.0.253:47262       <=> 151.101.0.162:443             0b    419Kb   105Kb 
192.168.0.253:59526       <=> 151.101.64.162:443            0b   53.8Kb  13.5Kb 
192.168.0.253:45034       <=> 151.101.128.162:443           0b   41.7Kb  10.4Kb 
192.168.0.253:59534       <=> 151.101.64.162:443            0b   41.4Kb  10.4Kb 
192.168.0.253:45050       <=> 151.101.128.162:443           0b   39.0Kb  9.76Kb 
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer. – Ron Maupin Feb 19 '18 at 3:52
5

Source ports are randomly generated from the unregistered port range.

The source/destination port works similar to your IP. The port you send from, is the port the service will reply too. For instance; a website is simply a server listening for connections on port 80 (or 443).

When you attempt to load a website you generate a free port from the unregistered range and send the request from 192.168.1.1:45676 (Source port selected) your browser then sends the request to 200.20.20.20:80 (IP is an example) as the server is listening on this port.

Much like your IP, when the server replies to you it sets the destination IP AND port In the packets header to the source IP / Port it received the request on. This enables you to run multiple webpages at once.

If you had 4 webpages open, all sending and receiving on port 80, it would not know where the response traffic is meant to be directed. This is why the source port is used.

Here is an article which might help you understand it a bit better;

http://www.firewall.cx/networking-topics/protocols/tcp/133-tcp-source-destination-ports.html

This video may be of interest as well :):

https://www.youtube.com/watch?v=PBWhzz_Gn10

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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