0

I have a 2 networks, connected via a NAT/router.

PC(A, 192.168.0.2) in network A (with router 192.168.0.1), sends a UDP paket to a pc (B, 10.0.0.2) in the other network B (with router 10.0.0.1). In network A the packet has source ip/port 192.168.0.2:2000 and dst 10.0.0.2:5000, in network B its becomes src ip/port 10.0.0.1:6000 (because 6000 is free for whatever reason, just for the example sake) and dst 10.0.0.2:5000.

Now PC A sends another udp packet from source ip/port 192.168.0.2:2000 to another PC in network B. The source port in network A is the same, but will it also be the same in network B (6000 in this example)? I assume yes, but I am not sure.

Does it depend on the dst ip/port as well? And if no, does it mean 1 pc, even 1 src port in network A, can use up all "router ports" in network B? (I hope it takes at least 65536 network A src ports to fill up the "router ports" in network B)

By "router ports" I mean the hashtable entry, so in case PC B sends to A (via router port 6000) the packet is delivered.

1 Answer 1

0

Its complicated. It depends of router configuration. Several types of NAT could be possible. - static NAT - dynamic NAT - and port redirection (is not the same as NAT)

Usually a router do NAT from local network (A) to wide area network (B), and port redirection is for traffic from B to A.

Because UDP not establishes a socket, the router should do several strategies for mapping UDP NATed packets. This is the reason the router uses port 6000.

Usually router don't use the source port in A as source port in B, may be you can configure, but is not recomended because that info (port) is useful to make the NAT, the router probably uses (by default) the pair ip-port to map packets between networks.

Known the router model could help for a more specific answer.

You can see more info about linux NAT posibilities using iptables here:

If linux can do it, a router should do it also, but it depends on the model..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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