how does router know which PC to forward information content to?

rookie1010

Senior member
Mar 7, 2004
984
0
0
Hello

how does the following work in a NAT configuration. 2 PC'a A and B sitting beind a router(say with address 101.101.101.1) request to see two videos from youtube.
since PC-A is sending a request via the router to youtube for a video "cool_video", youtube is going to send the video "cool_video" back to the router (101.101.101.1)

likewise PC-B is sending a request via the router for a video "sports_video", youtube sends the video "sportsvideo" back to the router (101.101.101.1)

my question is how does the router know which video to forward to which PC? i guess it would some sort of mapping table (dynamic?) in the router, since the videos are going to arrive on the same port of the router, so port forwarding can't work, correct?
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
There is a state table maintained on the router.

This is based on layer3 and layer4 information. So basically IP address (src, dst), port (src,dst), and possibly state infomration (sequence numbers at layer 4).
 

JackMDS

Elite Member
Super Moderator
Oct 25, 1999
29,553
430
126
Cable/DSL Router is a Mini computer with CPU, Memory, and OS.

So as a computer it does what Spidey posted above.
 

jlazzaro

Golden Member
May 6, 2004
1,743
0
0
src and dst ports (ftp-21, smtp-25, http-80, https-443, etc) are listed in the ip header, so Layer 3.