I'm setting up a 2nd Plex server and I've decided to use port 32401 instead of port 32400 since I already have a Plex server running on that port.

My issue is that Plex wants [publicip]:32401 to point to [localip]:32400 but my router can only point public ports to the same local ports (so no [publicip]:32401 -> [localip]:32400).

Is there a way for Linux to listen to port 32401 and "reroute" it internally to port 32400? I've seen similar iptables commands but none fit my exact use case.


You can use this iptables rule

iptables -t nat -A OUTPUT -d LOCAL_IP -p tcp --dport 32401 -j DNAT --to-destination LOCAL_IP:32400

along with this kernel configuration

sysctl -w net.ipv4.conf.all.route_localnet=1

and all traffic for LOCAL_IP:32401 will be forwarded to LOCAL_IP:32400


I decided to RTFM and found my fix on the Arch Wiki's Plex page. By doing this command, I was able to reroute port 32401 to 32400:

iptables -t nat -A PREROUTING -p tcp --dport 32401 -j REDIRECT --to-port 32400

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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