Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 13554  / 2 Years ago, thu, november 25, 2021, 6:22:58

I want to create a minecraft server for me and my friends to connect to (port 25565). I already use ddclient, which updates the external ip so that the data sent to the hostname is forwarded to the external IP.



I want to remove iptables because it is not going to help with anything suited for what I am trying to do. Although, if I remove it is there any other way I can forward the traffic through my external IP? - Or would it forward by default? And may I add, I would not like to just set the default rule to ACCEPT all connections because this doesn't solve my issue.



I also know that if I keep Iptables, I will have to set up/modify an init script to update the rules every x minutes for the setup to work which will take even longer? But then I also realise that there for a reason - a firewall: To protect against hackers. Though, my ISP (Sky) does have a firewall that is default to BLOCK all connections, unless the port has been specified; in which I have forwarded the ports that are necessary for my server to run.



Would this be safe enough to run my server behind? And can I remove Iptables?



Thank you!


More From » networking

 Answers
7

It would be saver if you keep iptables and setup the right rules to open the Minecraft ports. I would proceed as follows:



nano /etc/iptables.rules


insert



# 1. Delete all existing rules
iptables -F
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
# 2. Accept established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# 3. Allow all outgoing traffic
-A OUTPUT -j ACCEPT
# 4. Allow Minecraft - default ports
-A INPUT -p tcp --dport 25565 -j ACCEPT
# 5. Reject everything else
-A INPUT -j REJECT
-A FORWARD -j REJECT


restart firewall with new rules



iptables-restore < /etc/iptables.rules


load each time the server starts



iptables-save > /etc/iptables.rules

[#26702] Friday, November 26, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nstitutencert

Total Points: 171
Total Questions: 126
Total Answers: 124

Location: Azerbaijan
Member since Fri, May 12, 2023
1 Year ago
nstitutencert questions
Fri, Dec 10, 21, 16:31, 2 Years ago
Tue, Apr 19, 22, 05:51, 2 Years ago
Wed, Jan 26, 22, 07:52, 2 Years ago
Sun, Aug 29, 21, 21:43, 3 Years ago
;