Bobcares

FiveM OVH DDoS | Setting Up IPtables

by | Dec 8, 2023

Learn how to boost security with FiveM OVH DDoS with iptables. Our OVH Support team is here to help you with your questions and concerns.

FiveM OVH DDoS | Setting Up IPtables

Running a FiveM server can be a great experience, but it comes with its fair share of challenges, especially when it comes to security.

Today, we will look at how an iptables setup can block different attacks and boost server performance during difficult times. However, our experts would like to point out that iptables alone are not enough to stop DDoS attacks.

FiveM OVH DDoS | Setting Up IPtables

Also, be cautious when implementing these rules on the server. It is also a good idea to use these rules with OVH’s infrastructure for optimal results.

Protecting Against UDP Attacks


iptables -t raw -A PREROUTING -p udp -m hashlimit --hashlimit-name periplimit --hashlimit-mode srcip,dstport --hashlimit-srcmask 32 --hashlimit-upto 50/sec --hashlimit-burst 5 --hashlimit-htable-expire 300000 -j ACCEPT
iptables -t raw -A PREROUTING -p udp -j DROP

These rules will stop UDP attacks, including floods, connection floods, and OVH bypasses. The hashlimit module helps regulate the incoming UDP traffic and offers an additional layer of protection.

Allowing SSH and UDP Traffic


iptables -t raw -A PREROUTING -p tcp --dport 22 -j ACCEPT
iptables -t mangle -A PREROUTING -p tcp --dport 22 -j ACCEPT
iptables -t mangle -A PREROUTING -p udp -j ACCEPT

Here, we whitelist SSH traffic on port 22, a crucial step for secure server management. Additionally, we ensure that UDP traffic is accepted, as it was filtered in the raw chain.

Filtering SYN Packets to Prevent TCP Floods


iptables -t mangle -A PREROUTING -p tcp --syn -m state --state NEW -m hashlimit --hashlimit-name periplimit --hashlimit-mode srcip,dstport --hashlimit-srcmask 32 --hashlimit-upto 300/sec --hashlimit-burst 1 --hashlimit-htable-expire 300000 -j ACCEPT

This rule focuses on rate-limiting and filtering new state SYN packets, providing a defense against TCP floods. We can adjust the parameters if needed, and consider the alternative rule provided if the initial one doesn’t yield the desired results.

Handling Related and Established Connections


iptables -t mangle -A PREROUTING -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

Ensuring the acceptance of related and established connections is crucial for maintaining the functionality of ongoing sessions.

Default Rule: Drop Everything Else

iptables -t mangle -P PREROUTING DROP

This rule acts as the last line of defense, dropping any traffic that doesn’t match the specified rules.

Additional Recommendations and Updates

  • Always test these rules on a separate server before implementing them on your main FiveM server to avoid unintended disruptions.
  • For potential UDP issues, consider experimenting with the following theorized rate-limit rule:


    iptables -t raw -A PREROUTING -p udp -m hashlimit --hashlimit-name periplimit --hashlimit-mode srcip,dstport --hashlimit-srcmask 32 --hashlimit-upto 300/sec --hashlimit-burst 2 --hashlimit-htable-expire 300000 -j ACCEPT
    iptables -t raw -A PREROUTING -p udp -j DROP

Dealing with OVH Firewall Bug:


iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP

To address a bug in the OVH Firewall, we have to block malformed ACK connections using these iptables rules.

Enhancing the security and performance of our FiveM server requires a proactive approach. By using these iptables rules and with updates and improvements, we can create a strong defense against various attacks.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

At the end of the day, our Support Experts introduced us to boosting security with FiveM OVH DDoS with iptables.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

3 Comments

  1. nn

    Thanks fot this guide ill test it out right away

    Reply
  2. nanster

    not trying to be rude but this doesnt work at all

    Reply
    • Krishna Priya

      Hello,
      Our experts are available to assist you with your concerns. We would be delighted to discuss this with you via our live chat feature. Simply click on the icon located in the bottom right corner to get started.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF