I'm trying to understand something related to network ports, as it's not quite clear to me.
The question is, why can't you use the same port number for both incoming and outgoing traffic?
This question arose due to some advice on NAT port forwarding.
From what I can tell, IP packet headers contain fields for source address and destination address, which I'd imagine would be all you'd need to know to determine whether the packet was incoming or outgoing.
I realise this is a simple question. If there are learning resources you could point me to that you think would be useful in building up a deeper understanding of networking from the fundamentals up, I'd appreciate the links, even if there's a lot to learn.
Thanks.
Best Answer
You can, and some protocols do (isakmp), but it's not very flexible. There are two drawbacks:
Ultimately, using well-known ports for destination and ephemeral ports for source gives the most flexibility.