iptables and multiple ports

80,575

Solution 1

You have to use --match multiport in the rule for defining more ports

#iptables -A INPUT -p tcp  --match multiport --dports 110,143,993,995 -j ACCEPT

Solution 2

You need to specify the -m multiport module before using the dports options

Share:
80,575

Related videos on Youtube

Zenet
Author by

Zenet

studying...

Updated on September 18, 2022

Comments

  • Zenet
    Zenet almost 2 years

    This doesn't work for me:

    # iptables -A INPUT -p tcp --dports 110,143,993,995 -j ACCEPT
    
    iptables v1.4.7: unknown option `--dports'
    Try `iptables -h' or 'iptables --help' for more information.
    

    However in the man page, there is an option --dports... any ideas?

    • cyberx86
      cyberx86 over 12 years
      Quick guess would be that you need to use the multiport module: -m multiport --dports 110,143,993,995 ...