IPFire - Open NAT Call of Duty Modern Warfare multiple PlayStation 5

This is a quick guide on how to setup IPFire so that multiple PlayStation 5 consoles can play Call of Duty at the same time with an open NAT connection.

Call of Duty on the PlayStation 5 uses UDP port 3074. To get an open NAT connection all you have to do is port forward UDP port 3074 to your PlayStation 5's local IP.

However, when you have two (or more) PlayStation 5's and you and someone else wish to play COD together at the same time, you cannot port forward UDP port 3074 to both consoles (You can create the rule but it wont work) and play simultaneously with an open NAT. One will work and one won't, or there will be connectivity issues resulting in both unable to play.

This is normal port forwarding behavior. If you think about what port forwarding does you will understand why. It is a rule that tells your router to send all incoming external traffic inbound for UDP port 3074 to a single local IP.

Incoming external traffic: UDP 3074---> send to ---> 10.0.0.2

Now, lets say we created 2 port forwarding rules for port UDP 3074 to two devices

Incoming external traffic: UDP 3074---> send to ---> 10.0.0.2

Incoming external traffic: UDP 3074---> send to ---> 10.0.0.3

You have created a conflict, you are telling your router to forward all external traffic inbound for UDP port 3074 to internal IP 10.0.0.2, and also to 10.0.0.3. It cannot do this because by definition all traffic can only go to one IP. What will happen in most cases is the internal IP (gaming console) that establishes the connection matching its port forward rule first will prevent the other from achieving a connection on UDP port 3074, this will exhibit itself as the other console being unable to connect to the Call of Duty servers.

So how do we get around this problem?

The only way around this is to make COD use a different UDP port, unfortunately the game client doesn't allow us to do that but what we can do is use NAT rules on IPFire / Linux to achieve this for us. My preference is to make all consoles use a custom UDP port and not the default UDP 3074.

To assist with this explanation, I have 2x PlayStation 5's set with the following LAN IP's.

(1) PlayStation 5 with IP 10.0.0.2

(2) PlayStation 5 with IP 10.0.0.3

I am going to make (1) use UDP port 30001 instead of 3074 by using the following iptables command

iptables -t nat -I POSTROUTING -s 10.0.0.2 -p udp -m udp --sport 3074 -j MASQUERADE --to-ports 30001

For the other console, I am going to make it use UDP port 30002 instead of 3074.

iptables -t nat -I POSTROUTING -s 10.0.0.3 -p udp -m udp --sport 3074 -j MASQUERADE --to-ports 30002

You will need to SSH into your IPFire box and then edit /etc/sysconfig/firewall.local with a text editor such as nano. And add the above rules to the start and reload section.

#!/bin/sh
# Used for private firewall rules
# See how we were called.
case "$1" in
start)
## add your 'start' rules here
iptables -t nat -I POSTROUTING -s 10.0.0.2 -p udp -m udp --sport 3074 -j MASQUERADE --to-ports 30001
iptables -t nat -I POSTROUTING -s 10.0.0.3 -p udp -m udp --sport 3074 -j MASQUERADE --to-ports 30002
;;

stop)
## add your 'stop' rules here
;;

reload)
$0 stop
$0 start
## add your 'reload' rules here
iptables -t nat -I POSTROUTING -s 10.0.0.2 -p udp -m udp --sport 3074 -j MASQUERADE --to-ports 30001
iptables -t nat -I POSTROUTING -s 10.0.0.3 -p udp -m udp --sport 3074 -j MASQUERADE --to-ports 30002
;;
*)

Once done, the changes will apply each time the firewall rules are loaded. After saving the file, remember to reload the rules with the command, 

/etc/sysconfig/firewall.local reload

The next step is to now create the port forward rules using the GUI.


Create a similar port forward rule for the other console.

You should now be able to have 2 PlayStation 5 consoles play Call of Duty Modern Warfare at the same time and both report having an open NAT in game.

Comments

Popular posts from this blog

My top tweaks for gaming in Windows 10

Ubuntu 23.10 - How to build a kernel package from kernel.org

How to fix OBS Intel Quick Sync MFX_ERR_NOT_FOUND error in Ubuntu