Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.