How to open a range ports in debian?

Hi, I don’t cant open a range ports. For exemple: range: 10000/20000 UPD and open port 5060/UDP, how to make?

Tks, sorry my english!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello, @thiago.tda

As per @xMudrii reply you can use UFW in order to do that.

UFW, or Uncomplicated Firewall, is an interface to iptables that is geared towards simplifying the process of configuring a firewall. While iptables is a solid and flexible tool, it can be difficult for beginners to learn how to use it to properly configure a firewall. If you’re looking to get started securing your network and are not sure which tool to use, UFW may be the right choice for you.

You can check our full tutorial here for Debian 10:

Allowing Specific Port Ranges

You can specify port ranges with UFW. For example, some applications use multiple ports instead of a single port.

For example, to allow X11 connections, which use ports 6000-6007, use these commands:

sudo ufw allow 6000:6007/tcp sudo ufw allow 6000:6007/udp

Hope that this helps! Regards, Alex

Hi @thiago.tda,

If you are trying to open a range ports for firewall follow one of solutions.

In case you are using IPTABLES:

  1. sudo iptables -A INPUT -p udp -m udp --dport 5060 -j ACCEPT
  2. sudo iptables -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT

It is very probably that you are using IPTABLES so I recommend you to go with it.

If you somehow use ufw following will help:

  1. sudo ufw allow 5060/udp
  2. sudo ufw allow 10000:20000/udp

Good luck :)