Answer the question
In order to leave comments, you need to log in
How to close all ports in iptables except 25565?
Hello! I have a game server and on it it is necessary to close absolutely all ports except 25565 in iptables.
25565 on it.
Port 25565 is needed to connect players to the server. How to do it?
Answer the question
In order to leave comments, you need to log in
iptables -A INPUT -p tcp -m tcp -m multiport ! --dports 25565 -j DROP
sudo iptables -A INPUT -p tcp -s subnet/mask --dport 25565 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 25565 -m conntrack --ctstate ESTABLISHED -j ACCEPT
PS subnet/mask - address or address pool of your
PPS server if you like, at the end you can put an explicit deny all: sudo iptables -P INPUT DROP
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question