GTA Online Solo Public Session Tutorial (GNU/Linux)

Looking for a guide like this but for Windows? Click here.
After R* successfully fixed the gigantic exploit, this method does not seem to work anymore. The main reason is because the main peer-to-peer traffic from the game seems to be relayed through R* servers (actually, Amazon EC2 instances). If I find a fix, I will update the article accordingly.
introduction
In this blog post you'll learn how to make a solo public session in GTA Online on GNU/Linux. It's slightly different from what you need to do on Windows, but, to be perfectly honest, it's even easier, and works better, at least for me.
First of all, you should have a properly working GTA V installation on your distro of choice. If you've bought the game on Steam, using a nice combination of Proton and a Wine, you should get the game running with little to no issues at all. But if you have the game on Epic Games, you'll need to use the Lutris and Wine combination. This is what I'm using right now and it works very well. The only downside is that the performance is slightly worse on Linux than on Windows.
if you want to play alone..
Now let's move on to the first actual step. You need to have iptables
installed on your PC. This piece of firewall should be already installed on your distro, but if it is not, do it now. You can check your installation using the iptables --version
command. The output has to be similar to this:
[arch@computer ~]$ iptables --version
iptables v1.8.7 (legacy)
Awesome. Now let's setup the firewall rules and learn how to activate and disable them. I'm trying to be as simple as possible.
Let's edit the file called /etc/iptables/iptables.rules
first with your editor of choice. Below you can see how does a default config file looks like.

Before creating the rules, let's see which ports should we filter/block and why. The first one and most important is 6672. GTA mainly uses this port to connect players in sessions to each other. We also have to block the port range 61455-61458, because this game is weird, and sometimes the peer-to-peer traffic is going through these ports instead of 6672.
If you only want to play alone, your to-do is very simple. Add these two lines to your config file: -A OUTPUT -p udp -m udp --dport 6672 -j DROP
-A OUTPUT -p udp -m udp --dport 61455:61458 -j DROP
After pasting the code snippets, the final config file should look like this:

Now activate the firewall using this command: sudo iptables-restore /etc/iptables/iptables.rules
Open GTA as usual and go to a normal public session. It should load quickly now, and you have to be alone in the session.
And, if you want to play in a normal session just disable the firewall with: sudo iptables --flush
if you want to play with some friends..
I assume that you want to play this game with one or more than one person. Not going to lie, this game is really friend-oriented and sure, you can play it alone, but it will get boring eventually, and it's just so much better to have at least 1 person to play with.
Follow the steps as stated in the first section of the guide. I promise, I will make this part just as easy as the part before.
Allowing friends to play is super easy. Keep the existing firewall rules, but allow their IP address through it. So oversimplified: your firewall will block all traffic coming from port 6672 and the 61455-61458 port range, but you whitelist one or some IP addresses where traffic through those ports is allowed. I hope this makes sense.
Add the following line to the /etc/iptables/iptables.rules
file as many times as needed:-A OUTPUT -d friendsIP -p udp -m udp --dport 6672 -j ACCEPT
Important! Make sure to replace the friendsIP section with their public IP address. An easy way to find it is to search for "what is my ip" in Duckduckgo or Google. The IP address will look like this: 123.123.123.123. The final config should look something like this:

And now enable the firewall: sudo iptables-restore /etc/iptables/iptables.rules
Join a public session and invite them, they should be able to join your session.
Join a public session and invite them, they should be able to join your session.
And again, it is super easy to disable the firewall in case you want to play in a normal, populated lobby: sudo iptables --flush
One more thing: it is very likely that their IP will change over time, so you will probably need to change them eventually.
final thoughts
This is it. One more thing is that I recommend you to save the iptables config file's content to somewhere else too, just in case a software update decides to overwrite it, you won't have to write down all that stuff again. Hope you found this useful. Contact email: blog[at]perjel.hu.