Howto: Battlefield 2142 and 2142CC on Linux
Opening ports in your firewall
Before you start installing your Battlefield 2142 server, it’s strongly recommended to open the correct ports in your firewall. This may save you some time when things don’t seem to work afterwards. The Battlefield 2142 server and the 2142CC daemon use the following ports by default:
| SERVICE | PORT(S) | PROTOCOL |
| Battlefield 2142 server | 17567 | UDP |
| GameSpy | 29900 | UDP |
| Voice over IP | 55123-55125 | UDP |
| 2142CC rcon | 4711 | TCP |
| 2142CC daemon | 4712 | TCP |
| Note: if your server is behind a (NAT) router you need to forward the ports on your router to the machine your Battlefield 2142 server is running on. Refer to your manufacturer’s documentation to find out how to do so. Also, a very good resource to get help on getting your router setup properly, is http://www.portforward.com |
In order to open these ports you need to refer to your distro’s firewall instructions. Most Linux distributions use IPTables. You can see if IPTables is enabled on your machine by typing (as root):
root@gameserver02 ~]# iptables -V
iptables v1.2.11
| Note: If you get an error message (or a command can not be found or something similar), IPTables is probably not configured on your machine. Most probably you will need to recompile your kernel with firewall (IPTables) support if you want to use a firewall on your system. Refer to your distro’s documentation if you want to enable firewall support. If you dont have a firewall available at this moment, it means that all your ports are open. This may be a security issue, but you can still proceed with the installation of the Battlefield 2142 server. You can skip the rest of this chapter and continue with ‘Creating a new user account’. |
This is a very basic firewall script for IPTables to work with a Battlefield 2142 server:
#! /bin/bash
$MyIP = 192.168.2.100
/sbin/iptables -A INPUT -p udp -d $MyIP --dport 17567 -m state --state NEW -j ACCEPT
/sbin/iptables -A INPUT -p udp -d $MyIP --dport 29900 -m state --state NEW -j ACCEPT
/sbin/iptables -A INPUT -p tcp -d $MyIP --dport 4711 -m state --state NEW -j ACCEPT
/sbin/iptables -A INPUT -p tcp -d $MyIP --dport 4712 -m state --state NEW -j ACCEPT
/sbin/iptables -A INPUT -p udp -d $MyIP --dport 55123-55125 -m state --state NEW -j ACCEPT
You can add these lines to your current firewall boot script or create a new file that gets executed once your system boots. To check if your firewall rules are loaded type (as root):
[root@gameserver02 ~]# iptables -L
This will output the currently loaded firewall rules. If the rules for Battlefield 2142 are there, you can proceed to the next chapter.
| << Introduction | Creating a new user account >> |


