Quick Answer: How to Open Ports on Linux?

Quick Answer: How to Open Ports on Linux?
Contents

If you want to open an incoming TCP port, type the following:

  • iptables -I INPUT -p tcp –dport 12345 –syn -j ACCEPT. If you want to open a UDP port (perhaps for DHT in Tixati), type the following:
  • iptables -I INPUT -p udp –dport 12345 -j ACCEPT.
  • service iptables save.

How do I open a port on Ubuntu?

Ubuntu and Debian

  1. Issue the following command to open port 1191 for TCP traffic. sudo ufw allow 1191/tcp.
  2. Issue the following command to open a range of ports. sudo ufw allow 60000:61000/tcp.
  3. Issue the following command to stop and start Uncomplicated Firewall (UFW). sudo ufw disable sudo ufw enable.

How do you check which ports are open in Linux?

How to check the listening ports and applications on Linux:

  • Open a terminal application i.e. shell prompt.
  • Run any one of the following command: sudo lsof -i -P -n | grep LISTEN. sudo netstat -tulpn | grep LISTEN. sudo nmap -sTU -O IP-address-Here.
Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.