[SOLVED] The Internet and my LAN.

Status
Not open for further replies.

Pheetuz

Full Member level 3
Joined
Feb 12, 2010
Messages
162
Helped
21
Reputation
42
Reaction score
19
Trophy points
1,298
Location
Brighton
Activity points
2,835
Hi Folks,

I would like to start by saying that I am a noob when it comes to networking and am just looking for some re-assurances on the correctness of the information I have acquired.
Basically my understanding of the way that the internet works when combined with a LAN is this:

Your home IP address is assigned by your ISP.
Your computers IP address on you LAN can either by dynamically assigned or you can set it yourself.

When I send a message out of my PC over Ethernet the TCP/IP packet is sent to the router which then strips off any data relating to the network access layer, the remainder of the packet is then sent over the internet, this part I am fine with, however, it is when a packet is sent back that I am becoming slightly confused.

When a packet comes in over the home IP address to the router, how does that router know where to send the packet on the internal network as I am pretty sure that the destination IP address is just the home IP address and not the internal IP address of the computer on your home network? Is there some other method of addressing once the packet has reached the LAN that I am unaware of??

Any help will be greatly appreciated.

/Pheetuz.

---------- Post added at 19:27 ---------- Previous post was at 17:39 ----------

Hi Folks,

I just spoke to a friend of mine who works in the internet world and he explained the concept to me, thought I would post the response up here so that anyone could read it in the future before I close the post:


When a router is used to forward data from a LAN to the internet some changes must be made to the packet received by the router before it can be retransmitted.
The packet received by the router from the PC on the LAN will contain the PCs LAN IP address and the port number being used for the TCP connection as the source address/port section of the IP header, obviously this is useless outside of the LAN. This means that the router does what is known as port mapping, this is where it internally creates a virtual port for each TCP connection and then replaces the LAN IP address with the public IP address as normal but then it also replaces the source port address with this new virtual port address. This means that when a response packet is sent back to this router with that particular port number the router knows that particular port number needs routing to the specific IP address on the LAN and it also knows the specific port number on the destination PC, this means that the router has mapped a virtual port number internally to the specific socket number on the LAN.

Hope it proves useful to someone else

/Pheetuz
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…