Reputation: 87
I've got a little bit confused with LAN networking, so I hope that someone can answer me for few theoretical questions:
Let's assume that I have a little LAN in my home. I'm writing a simple program that will send a 'Hello world' string to a IP that is given by the user. Now, the user is able to send either to the world-wide network, or to the LAN members. My question is:
Behind the scenes, where and by who, the seperation between the packets destinated to the outside world and to the LAN is made?
NAT: we are still working with the program. A user just sent a packet to the outside world, which handled by the router with NAT routing technique. While the packet was in it way to the destination, the NAT table in the router resets. What will happen once the reply packet from the destination will reach the router?
Thanks in advance, Idan
Upvotes: 0
Views: 461
Reputation: 1174
if the packet/message is sent to a host on the same subnet/vlan then it will be sent to to the host directly because it is at one hope distance (in layer3) from the origional host that's why the router is not included (however, behind the scenes it can be at many hopes in layer2 if there are swithes in between. A host has ARP table containing the MAC addresses and a switch has "Mac Address Table" which will forward the packet from a switch port to another till it reaches the second host without passing through the router).
If the NAT table in the router resets, obviously there is no way to track back which received packet belongs to whom and they will be dropped.
Upvotes: 0
Reputation: 8311
Your IP configuration is composed of:
From the IP address and the mask the card deduce the range of address of your LAN (e.g 192.168.1.0 to 192.168.1.255), if the destination address is in the range of address, the network card send directly the packet to the destination machine. If the destination address is outside of the range, the packet is sent to the gateway. The gateway (which is basically your router) will forward the packet, eventually using NAT.
Upvotes: 1