Hello, I hope you’re fine, me it’s great!
For 4 weeks, I received DDoS attacks, so since the attacks are redirected to the port that the server uses to connect to fivem, the server has no room to communicate with FiveM, I had a dedicated OVH, but it did not serve anything, so no one could log in, he had a Attempt 3
error message.
So I found the solution there are two weeks, but believe me, at the level of players I lost a lot. I recently learned that a person who made me a ransom lately, he asked me 100 € otherwise he continued to crash my server, since I did not have them impossible to give him, (and if you him give everyone will do the same). In short if I create this topic to help you face this situation.
Above I give you the solution, I hope that it will help you:
Requirements:
- Linux (preferably Debian 9)
- Have confidence in me: D
- An Ftp and a terminal to access the machine
- Have ROOT or SUDO access
- First install
ipset
, this will add country restrictions.
cmd: apt-get install ipset
- Then you will download this script.sh (4.6 KB)
1.1 Change port 22 to the port you use to connect [MANDATORY]
1.2 Then drag this file into the directory:/etc
1.3 Then in your terminal type:crontab -e
1.4 Download this file crontab.txt (29 Bytes) and add the contents of this file manually to the terminal
1.5 Type in your terminal:
cd /etc
./script.sh
Here is, we just added a restriction on all foreign countries, only French countries can connect, but some people can not connect the coup will add their ip manually, here is the command:
iptables -A INPUT -s 0.0.0.0 -j ACCEPT
(replace 0.0.0.0 with the IP you want to allow to connect)
But if you are not French how are you doing?
Answer: you go to this site: http://www.ipdeny.com/ipblocks/data/countries/
Try to think, to understand how the script works, and you add your countries, and you remove the useless countries: D
- Now that it is done will be necessary to avoid that each reboot of the machine will have to enter the IP of the players to authorize and your rules to you, for that install:
iptables-persistent
Here is the command apt-get install iptables-persistent
During the installation they will ask you if you want to integrate your current rules in the module, I advise you to accept to avoid retyping all your rules
Here is a tutorial to teach you how to use iptables-persistent: D
FR: https://doc.ubuntu-fr.org/iptables
EN: https://www.digitalocean.com/community/tutorials/how-to-implement-a-basic-firewall-template-with-iptables-on-ubuntu-14-04
Here is, if now I make this message, it is to help people, because me for 1 month I would have liked to help, but nobody does it. And especially because a person just announced that he was going to crash all the servers that have more than 70 players and he was going to ask them a ransom of 300 €, so stay on your guard, this technique helped me a lot and I hope it will help you ^^, I took 1 hour to write you that I hope you will appreciate: D, if there is need for help I am there, do not hesitate to answer this post , and to share it like that a maximum of people will help.
If that does not help you, it is possible that the person who attacks you stays in your country so to find it here is another tutorial:
- CMD:
apt-get install net-tools
- Shut down your FiveM server
- CMD:
netstat -paunt
Now if you see an IP go out a lot of times with TIMED OUT
or whatever you do:
- CMD:
iptables -A INPUT -s 0.0.0.0 -j DROP
(Replace 0.0.0.0 with the IP you have spotted - Restart your server
Normally this will correct this problem once, in any case for me it is set ^^, excuse me if you see mistakes, it’s Google Translation, I do not master enough English to write all that x)
NB: At each restart of the machine please do this otherwise no one can connect to your server! :
CMD: cd /etc
CMD: ./script.sh
Discord : iradium#0009 [I’m not a FiveM element]