How to Open Ports in Ubuntu/Linux

There are two ways to open/enable ports in ubuntu.

  1. sudo ufw allow <port_number>
    Check the ufw status to know whether it is enabled or not
    sudo ufw status
    if it is not enabled then run
    sudo ufw enable
  2. sudo iptables -A INPUT -p tcp –dport <port_number> -j ACCEPT
    check the ports using
    sudo iptables -nvL

Leave a Reply

Your email address will not be published.