PAT Question

typeshtypesh Member Posts: 168
Hey everyone, I had a PAT questions (actually 2 questions)...

(1) When a host assembles a frame, it fills in all required information in the necessary headers and add the data. Let us say that a router is the 192.168.1.0/24 subnet out on its FastEthernet Interface. When PCs on the 192.168.1.0/24 subnet have to forward a message outside of its LAN, it will send to the Default-Gateway. These PCs will have filled in its own IP in the source field, and a destination of, lets say, 185.1.1.1. If the Router has PAT configured, does the router actually take the frame received from the PCs and change the ip address in the source field of the Network Layer header (to the public IP)? Does it also change the source port number in the Transport Layer header (example: PC1 and PC2 both send a frame to the router and they somehow both decided to use a source-port of 1025 and frames get to the router just a few milliseconds apart). It appears that the router modifies the fields in the received frame before sending it out... Is that correct?

(2) In a case where PC1 and PC2 pick the same source port, will the Router just assign a totally different port number in its PAT table? If it has sent PC1s frame out with a source port of 1025, and then PC2 sends the Router a frame also using source port 1025 right after, what happens?

Thank you.

Comments

  • kalebkspkalebksp Member Posts: 1,033 ■■■■■□□□□□
    typesh wrote: »
    Hey everyone, I had a PAT questions (actually 2 questions)...

    (1) When a host assembles a frame, it fills in all required information in the necessary headers and add the data. Let us say that a router is the 192.168.1.0/24 subnet out on its FastEthernet Interface. When PCs on the 192.168.1.0/24 subnet have to forward a message outside of its LAN, it will send to the Default-Gateway. These PCs will have filled in its own IP in the source field, and a destination of, lets say, 185.1.1.1. If the Router has PAT configured, does the router actually take the frame received from the PCs and change the ip address in the source field of the Network Layer header (to the public IP)? Does it also change the source port number in the Transport Layer header (example: PC1 and PC2 both send a frame to the router and they somehow both decided to use a source-port of 1025 and frames get to the router just a few milliseconds apart). It appears that the router modifies the fields in the received frame before sending it out... Is that correct?

    (2) In a case where PC1 and PC2 pick the same source port, will the Router just assign a totally different port number in its PAT table? If it has sent PC1s frame out with a source port of 1025, and then PC2 sends the Router a frame also using source port 1025 right after, what happens?

    Thank you.

    You've described PAT correctly, the router does modify the source IP and port of the packet.

    FYI, technically it wouldn't be called a frame because a frame exists at the data link layer rather than the network layer. Packets may be transmitted as multiple frames which would be reassembled at the router. I realize this isn't what you were asking about, but correct terminology can be important.
  • NeekoNeeko Member Posts: 170
    What you have described is right, and in the case where two hosts have used the same source port the router will attempt to use the next available port number for whichever host reaches it second.
  • typeshtypesh Member Posts: 168
    Sounds good. Thanks a lot!!
Sign In or Register to comment.