Search code examples
centosiptables

IPTables Range of Ports


Hey guys in my iptables file I have the following line:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 20000:25000 -j ACCEPT

Because I'm trying to open a range of ports that will need to be open for multiple (Yes THAT many multiple) different minecraft servers.

I know the issue is the IPTables because when I stopped them, I was able to get on the server (Port 20004) But with them on, I can't connect, did I format it right? I even did just

-A INPUT -m state --state NEW -m tcp -p tcp --dport 20004 -j ACCEPT

The second one copying the exact SSH port 22 rule, except the port obviously, any ideas? Thanks!


Solution

  • Did you issue an

    -F INPUT
    

    first, if relevant?

    You have asked for ideas. If you've not tried this one, you might. IPtables bugs sometimes are not trivial to isolate, are they? However, it can help if you start from a known state, which the -F achieves.

    Good luck.