How to open a particular port in ubuntu?

40,432

Run this on the commandline; it should solve issue: sudo iptables -A INPUT -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j ACCEPT

To do a specific port:

sudo iptables -A INPUT -p <tcp OR udp> <--dport OR --sport> <port> -j ACCEPT

INPUT is the chain for incoming traffic. -p is protocol (either tcp or udp --dport or --sport specify allowing for destination or source port. -j is "jump" and its where you ACCEPT, REJECT, or DROP the packet(s)

Details on iptables can be found by reading the man page. Since you're a beginner you'll probably find this useful: http://www.netfilter.org/documentation/HOWTO//packet-filtering-HOWTO.html

Share:
40,432

Related videos on Youtube

charlie
Author by

charlie

Fell in love with the "Gutsy Gibbon", and the romance continued through the "Hardy Heron"... Now, after many on and off flings, got into the "Quantal Quetzal" and moved on to the "Raring Ringtail"...and the bond intensifies with the "Saucy Salamander". Continued on the "Trusty Tahr", the "Utopic Unicorn", and the "Vivid Vervet" for as long as I could. Now on a hiatus, hoping to delve into the magical world again soon...

Updated on September 18, 2022

Comments

  • charlie
    charlie about 1 year

    My SoulSeek client Nicotine+ checks my open ports during initial configuration and promts that the one port number it needs is closed, cutting me off frmo about 50% of the users. Is there anyway I can open that particular port for the application to use?

    RUnning ubuntu desktop 13.04. I have not manually installed any firewalls, but not sure if its included in the default installation.

    • Mitch
      Mitch over 10 years
      Are you running Ubuntu Desktop or Server? Are running any Firewall?
    • charlie
      charlie over 9 years
      Desktop (Trusty) and no additional firewall installed
  • charlie
    charlie over 10 years
    @J Moore: Thanks, but where do I put in the port number? Also would help if you could put in a one liner about what these arguments are for?
  • charlie
    charlie over 10 years
    I tried the methods above, and though I think they should work, the client port-checking page: tools.slsknet.org/porttest.php?port=2234 always shows that the port is CLOSED. Any ideas?
  • sinekonata
    sinekonata over 7 years
    I don't think this is addressing the matter at all. Also clearly the op has little idea of how to execute what you just put forward.