newbie question

SatcomSatcom Member Posts: 110
so we have two computers behind a router... they are connected to the net we all share the same IP address to the outside world but internally we know that the IP address vary so for example 192.168.1.5. (A). and 192.168.1.15 (B)...

Now the question i have is when the data comes into the router from the cloud.. how does it know whether to go to computer A or B. I know data is encapsulated so im guessing the router would read the local hosts ip address off the ip header.. but in my mind the ip address off the header would be the IP address that is interfaced directly with the internet and is shared by both computer A and computer B. It is also shared with every device connected behind the initial router

Now i know that each device has a unique MAC address and I know each device has a unique ip address on the 192 local network.... so i dont remember seeing an entry in the IPv4 header fields for the 192 only the source IP address which i equate to being the source address the cloud sees .. so i am assuming that MAC address data from Layer 2 is transported back and forth during communication between devices in the cloud and devices on the 192 network.. this is the only way i see how the router can differentiate between incoming traffic routed to computer A or computer B

but this doesnt make sense to me.. because i know that as data hops from router to router.. it is stripped and encapsulated with its own layer 2 data ..HDLC..ATM..Frame relay... so where would the mac address for the 192 network devices be stored at in packets that are hopping around the net.. when the layer 2 data is stripped

this makes me look harder at the initial router before the cloud and i think the answer lies there... and im only on CH6 book 1 icnd.... and i think the answer lies in NAT which is in CH16.. lolz..

ahh back to the book icon_study.gif

Comments

  • SatcomSatcom Member Posts: 110
    i think i found the answer in wiki :)

    http://en.wikipedia.org/wiki/Network_address_translation

    Most often today, NAT is used in conjunction with network masqueradingIP masquerading) which is a technique that hides an entire address space, usually consisting of private network addresses (RFC 1918), behind a single IP address in another, often public address space. This mechanism is implemented in a routing device that uses stateful translation tables to map the "hidden" addresses into a single address and then rewrites the outgoing Internet Protocol (IP) packets on exit so that they appear to originate from the router. In the reverse communications path, responses are mapped back to the originating IP address using the rules ("state") stored in the translation tables. The translation table rules established in this fashion are flushed after a short period without new traffic refreshing their state. (or
    As described, the method enables communication through the router only when the conversation originates in the masqueraded network, since this establishes the translation tables. For example, a web browser in the masqueraded network can browse a website outside, but a web browser outside could not browse a web site in the masqueraded network. However, most NAT devices today allow the network administrator to configure translation table entries for permanent use. This feature is often referred to as "static NAT" or port forwarding and allows traffic originating in the 'outside' network to reach designated hosts in the masqueraded network.
  • NeekoNeeko Member Posts: 170
    The answer does lie with NAT.

    Basically the device responsible for NAT will translate each of the private addresses to the public address and will keep track of each translation by using unique source port numbers.

    The sending host on your network allocates a source port number to use in the TCP or UDP header. When this data reaches the NAT device (typically a firewall, or a router on smaller networks) the NAT information is recorded in a table, including the source port that is being used. The NAT device will attempt to preserve the source port that the host has assigned the transport layer header, but if two hosts send data that is using the same source port it will assign a new port. When data returns, the NAT device reads the destination port and looks it up in it's table. Then the process is reversed and the destination IP and port are translated back so they can be forwarded to the right host.

    That's NAT in a nutshell, it can get more complex but that should help for now.
Sign In or Register to comment.