Privacy notice This website only uses technically necessary cookies. Statistics, marketing and external services are not loaded without JavaScript. Learn more in our Privacy Policy.
Privacy notice This website uses only technically necessary cookies. Statistics, marketing and external services are not loaded without JavaScript. Read more in our Privacy Policy.
Informacja o prywatności Ta strona używa wyłącznie technicznie niezbędnych plików cookie. Statystyka, marketing i usługi zewnętrzne nie są ładowane bez JavaScript. Więcej w naszej Polityce prywatności.
Information sur la confidentialité Ce site n’utilise que des cookies techniquement nécessaires. Les services de statistiques, de marketing et les services externes ne sont pas chargés sans JavaScript. Plus d’informations dans notre Politique de confidentialité.
Avviso sulla privacy Questo sito usa solo cookie tecnicamente necessari. I servizi statistici, di marketing ed esterni non vengono caricati senza JavaScript. Maggiori informazioni nella nostra Informativa sulla privacy.
Aviso de privacidad Este sitio web solo usa cookies técnicamente necesarias. Los servicios de estadística, marketing y externos no se cargan sin JavaScript. Más información en nuestra Política de privacidad.
Privacymelding Deze website gebruikt alleen technisch noodzakelijke cookies. Statistiek-, marketing- en externe diensten worden zonder JavaScript niet geladen. Meer hierover in onze Privacyverklaring.
Privatlivsinformation Denne hjemmeside bruger kun teknisk nødvendige cookies. Statistik-, marketing- og eksterne tjenester indlæses ikke uden JavaScript. Læs mere i vores Privatlivspolitik.

Halloween at Nexthosting: 10% off game servers with the code – until November 1

Back to the blog
Nexthosting Guide

Ready-to-Use iptables Rules: DDoS Protection for Rust Server Operators

Guide for Rust server operators: three protection layers, ready-to-use iptables and Fail2Ban rules, monitoring steps and a provider checklist.

Sep 7, 2026 123 views
Ready-to-Use iptables Rules: DDoS Protection for Rust Server Operators

Effective DDoS protection for a Rust server needs three layers at the same time: upstream mitigation at the network operator, a game firewall with a Rust profile, and local hardening with iptables and Fail2Ban. The reason lies in the protocol: Rust runs over UDP and the RakNet protocol, so a pure Layer 7 filter as used against classic web attacks is not sufficient. If you want a stable gaming experience, you should choose a hosting provider with dedicated game profiles for Rust.


In short:

  • Comprehensive DDoS protection for Rust servers consists of upstream mitigation, a game firewall with a Rust profile, and local hardening with iptables and Fail2Ban.
  • Network scrubbing at the hosting provider filters large attacks before they reach the server, while a dedicated firewall recognizes the game traffic pattern and repels attacks.
  • When configuring iptables and Fail2Ban, you need to know your ports so you can specifically limit connection attempts and effectively block repeat attackers.
  • Real Layer 4 protection requires paid offerings; free solutions such as Cloudflare are hardly suitable for UDP-based games like Rust.
  • A fast-developing attack can be recognized by rising latency, irregular packet loss or suspicious connection behavior, and acting early makes recovery easier.

Table of contents

Which protection layers do you need against DDoS attacks on Rust servers?

A single protection mechanism is never enough against a serious attack. The question is not “which tool,” but which layer takes on which task.

Network or upstream mitigation is the first line of defense, as explained in detail in external security articles, for example in the security archive of JOMOX Media. It absorbs large volumes of traffic before they even reach your server, usually via anycast scrubbing networks that distribute the attack across multiple data centers. In a UDP flood of several hundred gigabits per second, no local rule will help you anymore, no matter how well it is configured.

The game firewall sits one layer above and distinguishes legitimate player traffic from attack patterns. In its own documentation on the Application Firewall, OVHcloud explicitly describes a Rust profile that allows per-IP-address rules and recommends “Drop” as the default policy. This is an important difference from generic Layer 3/4 scrubbing: a game profile knows the typical phases of a Rust session, from the handshake to ongoing gameplay, and can therefore reduce false positives.

The proxy layer, if used, hides the real server IP and pre-filters part of the traffic before it is even forwarded to the game process. And finally, server-side hardening (iptables rules, conntrack limits, Fail2Ban) takes effect against smaller disruption attempts and script-kiddie attacks.

Important to know: Cloudflare's free tier primarily handles Layer 7 and is therefore hardly suitable for UDP-based games like Rust. A Hetzner tutorial explicitly points out that real Layer 4 protection requires paid products such as Spectrum. If you only enable a generic web interface firewall, you will hardly protect your Rust setup effectively.

How do you set up iptables and Fail2Ban for your Rust server?

Before you write any rule: know your ports. By default, Rust uses one UDP port for the game protocol (often 28015) and another one for RCON. The underlying RakNet protocol uses a cookie mechanism when establishing a connection, similar to a SYN cookie in TCP, to reject simple spoofing attempts early.

  1. Set rate limiting with iptables. A simple rule limits incoming connection attempts per time window, for example following the pattern Hetzner shows in its own guide: an upper limit of 7 requests per 30 seconds per source IP, combined with a DROP for everything above that.
  2. Keep an eye on the conntrack table. The Linux connection tracking (conntrack) fills up rapidly during a flood attack. Raise the table limit as a precaution and monitor it with conntrack -C, otherwise your server collapses at your own firewall.
  3. Configure Fail2Ban for repeat offenders. Create a dedicated filter that watches your Rust server log (log path depends on your setup, often in the RustDedicated directory) and define a ban duration of several hours for repeated connection drops from the same IP.
  4. Put a proxy or load balancer in front, if available. This lets you filter part of the load before it reaches the actual game process, and buys you time to react.
  5. If you suspect a major attack, secure pcap dumps immediately. A short tcpdump capture during the attack gives your host the raw data to adjust the mitigation rules in a targeted way.

Pro tip: Test your iptables rules first with a low threshold on a test server. Limits that are too aggressive otherwise block legitimate players when they reconnect after a brief connection drop, which feels like a server problem even though your own firewall is the culprit.

An interesting additional approach from defense research is the principle of proof of work: the client has to solve a small computational puzzle before the actual connection. This is not a standard mechanism for Rust, but the concept shows up in some experimental mitigation projects on GitHub, for example in this proof of concept for DDoS defense, which demonstrates how filter logic can be implemented technically at the application level.

How do you recognize an ongoing attack and respond correctly?

An attack rarely announces itself with a warning message; it shows up in metrics. Rising latency despite a normal player count, a sudden increase in the connection rate from a few IPs, unusual packet loss or many incomplete handshakes are the classic early indicators.

Automated countermeasures take effect fastest at this point:

  • Temporary, tighter rate-limit rules that reset automatically once the attack ends.
  • An IP allowlist for known community members so regular players get through even under load.
  • Traffic rerouting through the host's scrubbing network as soon as certain thresholds are exceeded.

Community reports from the uMod forum show a recurring pattern: operators who hand a pcap capture to support early get suitable mitigation rules much faster than those who provide only a vague description of the problem. A short capture with the timestamp of the attack's start is often more valuable to support than any written description.

Communicate openly with your community during an attack, for example via Discord. A short status update prevents false assumptions about “broken servers” and keeps players on board instead of them drifting off to another server. Local Fail2Ban rules reliably help against freeloaders and minor disruption attempts, but according to Hetzner they do not replace real upstream scrubbing in a volumetric attack.

Provider selection checklist: what should a Rust host offer?

Before you sign a contract, check these four points specifically:

  1. Upstream capacity and scrubbing network. Ask how large the network is and how attack traffic is distributed, instead of relying on general marketing statements.
  2. Existing game profiles for Rust. A provider with a preconfigured understanding of RakNet recognizes legitimate game phases more reliably than a generic firewall.
  3. 24/7 monitoring and pcap support from the support team. Without this, you lose valuable time during a real attack.
  4. Customizable mitigation profiles. You should be able to fine-tune rules yourself instead of waiting on a ticket for every adjustment.

You can ask about these criteria directly in any first conversation with a host, without having to read the technical fine print beforehand.

Best practices for server infrastructure and network topology

The network topology often decides how resilient your setup is even before the first attack. Separate the Rust process from other services such as databases or web panels, ideally on separate systems or at least in separate network segments. That way, an attack on the game port does not automatically take down your backup system or your panel as well.

Where possible, use a dedicated uplink with sufficient capacity headroom instead of squeezing out the last available percent of bandwidth. A server that already runs close to its limit during normal operation tips over much faster at a small increase in load.

Also segment access to management interfaces such as RCON or the control panel with dedicated firewall rules, ideally restricted to known IP addresses. An attacker who floods the game port but has no access to RCON at least cannot additionally tamper with your server configuration.

If you run several Rust servers in parallel, you should not have them all run on the same public IP. Distributed IPs make it harder for attackers to hit several servers at once with a single campaign. Also document your network topology in writing; it speeds up communication with support enormously when things really need to move fast.

How do you secure your Rust server after a successful attack?

Even with good protection, an attack can get through, for example via a previously unknown amplification vector. What matters then is how quickly you return to normal operation without losing save data.

Automated daily backups are the minimum; for active communities, a shorter interval is worthwhile, for example every few hours during peak playing times. Do not store backups exclusively on the same physical system as the running server, otherwise the backup is of little use if the underlying hardware is affected.

After an attack, a short post-mortem is worthwhile: when did it begin, which metrics raised the alarm first, how long did recovery take? These notes help you respond faster to the next incident. Also check whether configuration files or plugins were modified during the attack, especially if an exploit attempt was running in parallel. A recovery plan that can only restore the bare server files but does not cover player data or economy databases is incomplete. And communicate the incident transparently to your community: a short recap after the attack has been weathered builds more trust than silence.

Author's opinion: when which solution really makes sense

Many operators spend time on iptables fine-tuning before they have even evaluated a host with a game firewall. That is the wrong order. Upstream mitigation and game profiles should always come before local rule tuning, because they absorb the large attacks against which iptables has no chance anyway. Managed scrubbing pays off as soon as repeated attacks disrupt gameplay, not only after the tenth incident. And set realistic expectations: this is about operational reliability, not absolute immunity.

— Erik

How Nexthosting supports Rust servers with built-in protection

If you have to click through the firewall documentation of several providers before your own server is even running, you lose time that is better spent on your community. On the Rust product page, Nexthosting offers ready-configured servers with NVMe storage, built-in DDoS protection and a server location in Germany, without you having to set up scrubbing rules or game firewalls from scratch yourself. You can find details on single-core performance and hardware, such as X3D processors, in an article on performance optimization for Rust servers. If you also want to clarify questions about data protection and server location in Germany, there is a checklist on data protection in hosting. Some providers offer support for custom adjustments to mitigation profiles, so that configurations fit the respective server setup better.

Sources

The measures described here are based on publicly documented practice, not on guesswork. For Rust servers, Nexthosting relies on NVMe storage, a server location in Germany and DDoS protection that is already built in; you can find concrete details on the Rust server page.

For technical depth, it is worth looking at primary sources:

FAQ

Which DDoS protection is the best for Rust servers?

The most effective approach is a combination of upstream mitigation by the host, a game firewall with a Rust profile, and local hardening with iptables and Fail2Ban. In our experience, a single measure alone is not enough against larger UDP floods.

Is there a German PvE Rust server?

Yes, numerous community operators host PvE Rust servers on infrastructure located in Germany, available from various hosting providers.

What is DDoS protection, exactly?

DDoS protection refers to technical measures that shield a server from targeted overload attacks using massive, often spoofed traffic. For Rust servers, this usually combines network scrubbing at the provider with game-specific firewall rules.

How much does DDoS protection for Rust servers cost?

The cost depends heavily on the provider and the scope of the mitigation, and no concrete, universally valid prices can be given responsibly. With many hosts, basic DDoS protection is already included in the server price, while extended game firewall profiles sometimes have to be configured separately.