Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does TCP care if the port changes on a SYN/ACK that comes back compared to the destination port asked for?

I.E. If i have a port forward turning 80 into 8080, and the client sends a SYN on 80 and gets a SYN/ACK from server:8080 will it drop that packet?

share|improve this question
up vote 1 down vote accepted

The answer is yes. If the SYN/ACK reply to a SYN packet to port 80 comes back from port 8080 (instead of from the expected port 80), then TCP will drop the reply packet. The reason is that if the source port in the SYN/ACK does not match the original destination port of the SYN, then as far as TCP is concerned, the incoming SYN/ACK packet is not related to the original SYN packet it sent out.

When a client's connection to a server is DNAT-ed from port 80 to 8080 by a router, all replies to that client will have the reverse transformation done to them by the router. That is, the source port on all replies will be transformed from 8080 to 80. Thus, to the client, it looks like the server is actually listening on port 80.

share|improve this answer

That port forwarding rule will automatically change the responding source port to port 80. The client will never know port 8080 exist.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .