-1

Question 1) which one is used nowadays? NAT or PAT?

Question 2) as I knew, when my pc requests some website, what happens is , the data(packets) from my pc go to router. then router makes the request to the internet, gets response, and sends it back to the pc. It knows which pc, because of PAT or NAT.

What I'm curious is the following.

how does data from my pc to router get sent? my pc's private ip address and router's ip address are used ? or MAC addresses get used? I just don't understand the whole thing at once. Can someone explain to me the whole scenario? Imagine there're 3 pc's in the same network, 3 of them are connected to wifi. and 1 of the computer makes request to google.com . what happens in each step? what addresses get used and so on and how does my pc finally get the response from google.com?

Please, I've been interested in the whole process and can't seem to relate all the things together. Thank you in advance.

1 Answers1

2

which one is used nowadays? NAT or PAT?

According to Wikipedia, PAT is one variant of NAT.

And if I understand correctly, PAT is the variant of NAT where you have multiple computers using the same global IP address.

This means: A WLAN router (for example) uses PAT, which is some variant of NAT.

my pc's private ip address and router's ip address are used ? or MAC addresses get used?

When IP (it does not matter if IPv4 or IPv6) packets are transmitted over Ethernet or WLAN, both the IP and the MAC address are used. So each (IP) data packet sent over the Ethernet contains two MAC addresses and two IP addresses:

  • The MAC addresses are used to define from which to which device the data is transferred inside the network. In your example the data is transferred from the PC to the router, so the Ethernet frame contains the MAC addresses of the PC and the router.

    It does not matter if the IP packet is sent to the router or if the router will forward it to another computer. The destination of the Ethernet frame is the router.

    In WLAN networks it is a bit more complicated, but similar: A third MAC addresses is used to identify the WLAN network and if a repeater is used, the repeater is identified by a fourth one. However, the source and destination addresses inside the WLAN network are identified by their MAC address.

  • The IP addresses are used to define the original source and the final destination of the data. So the IP packet (inside the Ethernet frame) contains the IP addresses of the PC and the web server somewhere in the internet.

    The packet will not contain the IP address of the router because the IP address will only specify the final destination of the data.

how does data from my pc to router get sent?

  • The PC itself does not know about NAT/PAT. It will send the data as if its local IP address would be a global one. (In the case of IPv6 it would be probable that the PC has an own global IP address.)
  • The PC knows the "network mask" of the Ethernet: This means: The PC knows that addresses in the range 10.0.5.1 to 10.0.5.254 are in the local network and other addresses are in the internet. It also knows the IP address of the router.
  • If the PC shall send data to a device in the local network (a device whose IP address is in the range given), it will send a special data packet (ARP or NDP) to all devices in the Ethernet network. If the computer wants to send data to the device 10.0.5.30, that packet will contain a request that device 10.0.5.30 should reply with a packet containing the own MAC address.
  • 10.0.5.30 will reply and the computer knows the MAC address of 10.0.5.30.
  • Knowing the MAC address of 10.0.5.30, the computer can send an Ethernet frame containing an IP packet to 10.0.5.30.
  • If the computer wants to send a packet to some device in the internet (e.g. 192.0.2.10), everything works similarly. However, the computer will ask the router for its MAC address. Therefore, it has to know the IP address of the router.
  • The MAC address in the reply is used to send the actual IP packet. However, the actual IP packet contains the IP address of the PC and the one of the web server. It does not contain the IP address of the router.
  • In a scenario without NAT/PAT the router will simply forward the IP packet to the internet.
  • In a scenario with NAT/PAT the router will replace the IP address and the source port number...
Martin Rosenau
  • 2,326
  • 6
  • 10
  • In the RFCs for NAT, including _[RFC 2663, IP Network Address Translator (NAT) Terminology and Considerations](https://tools.ietf.org/html/rfc2663)_, you will not find any mention of PAT, which is a Cisco-specific term. The proper terminology for PAT is NAPT. – Ron Maupin Mar 07 '19 at 16:26
  • Thanks so much for the nice explanation. Is it possible that we can have some kind of private chat? Thank you again so much. – Nika Kurashvili Mar 08 '19 at 18:10