Вот возник вопрос.Имеется два компа в сети,объединенных в свитч.Два компа в одно и тоже время смотрят один сайт.Как не происходит ошибок,когда два компа на сайте смотрят разные страницы,если за Натом у них один внешний ip адрес,как при ответе на запрос сайт понимает что именно один комп смотрит одну страницу сайта,а второй комп другую страницу ?
Цитата: jaster7 от 07 мая 2012, 08:36:09у них один внешний ip адрес
а порты разные.
см. NAT и PAT (http://ru.wikipedia.org/wiki/NAT)
какие порты и где ?
Цитата: jaster7 от 07 мая 2012, 15:19:11
какие порты и где ?
Вы по ссылке сходили?
я читал вики перед тем как написать здесь,имеется в виду то что динамические порты source разные и выбираются автоматом так ?
Цитата: jaster7 от 08 мая 2012, 08:25:52имеется в виду то что динамические порты source разные и выбираются автоматом так ?
Цитата: jaster7 от 08 мая 2012, 08:25:52я читал вики перед тем как написать здесь
Идем в вики, читаем:
ЦитироватьПерегруженный NAT (NAPT, NAT Overload, PAT, маскарадинг) — форма динамического NAT, который отображает несколько незарегистрированных адресов в единственный зарегистрированный IP-адрес, используя различные порты. Известен также как PAT (Port Address Translation). При перегрузке каждый компьютер в частной сети транслируется в тот же самый адрес, но с различным номером порта.
Механизм NAT определён в RFC 1631 (http://tools.ietf.org/html/rfc1631), RFC 3022 (http://tools.ietf.org/html/rfc3022).
переходим по ссылкам на указынные RFC. В RFC 3022 видим нужный нам пример
Цитировать2.2. Overview of NAPT
Say, an organization has a private IP network and a WAN link to a
service provider. The private network's stub router is assigned a
globally valid address on the WAN link and the remaining nodes in the
organization have IP addresses that have only local significance. In
such a case, nodes on the private network could be allowed
simultaneous access to the external network, using the single
registered IP address with the aid of NAPT. NAPT would allow mapping
of tuples of the type (local IP addresses, local TU port number) to
tuples of the type (registered IP address, assigned TU port number).
This model fits the requirements of most Small Office Home Office
(SOHO) groups to access external network using a single service
provider assigned IP address. This model could be extended to allow
inbound access by statically mapping a local node per each service TU
port of the registered IP address.
In the example of figure 3 below, stub A internally uses class A
address block 10.0.0.0/8. The stub router's WAN interface is
assigned an IP address 138.76.28.4 by the service provider.
\ | /
+-----------------------+
|Service Provider Router|
+-----------------------+
WAN |
|
Stub A .............|....
|
^{s=138.76.28.4,sport=1024, | v{s=138.76.29.7, sport = 23,
^ d=138.76.29.7,dport=23} | v d=138.76.28.4, dport = 1024}
+------------------+
|Stub Router w/NAPT|
+------------------+
|
| LAN
--------------------------------------------
| ^{s=10.0.0.10,sport=3017, | v{s=138.76.29.7, sport=23,
| ^ d=138.76.29.7,dport=23} | v d=10.0.0.10, dport=3017}
| |
+--+ +--+ +--+
|--| |--| |--|
/____\ /____\ /____\
10.0.0.1 10.0.0.2 ..... 10.0.0.10
Figure 3: Network Address Port Translation (NAPT) Operation
When stub A host 10.0.0.10 sends a telnet packet to host 138.76.29.7,
it uses the globally unique address 138.76.29.7 as destination, and
sends the packet to it's primary router. The stub router has a
static route for the subnet 138.76.0.0/16 so the packet is forwarded
to the WAN-link. However, NAPT translates the tuple of source
address 10.0.0.10 and source TCP port 3017 in the IP and TCP headers
into the globally unique 138.76.28.4 and a uniquely assigned TCP
port, say 1024, before the packet is forwarded. Packets on the
return path go through similar address and TCP port translations for
the target IP address and target TCP port. Once again, notice that
this requires no changes to hosts or routers. The translation is
completely transparent.
Цитата: jaster7 от 07 мая 2012, 07:27:18
Вот возник вопрос.Имеется два компа в сети,объединенных в свитч.Два компа в одно и тоже время смотрят один сайт.Как не происходит ошибок,когда два компа на сайте смотрят разные страницы,если за Натом у них один внешний ip адрес,как при ответе на запрос сайт понимает что именно один комп смотрит одну страницу сайта,а второй комп другую страницу ?
Сайт всё отдаёт нату. Нат отдаёт компам руководствуясь своей таблицей по сорс-адресу.