Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to open TCP port in Ubuntu 10.10 ?

share|improve this question

migrated from stackoverflow.com Oct 13 '10 at 7:57

This question came from our site for professional and enthusiast programmers.

    
Belongs either on superuser.com or askubuntu.com. –  BoltClock Oct 13 '10 at 7:45
1  
For what do you want to open the port? To host a service? to use for outgoing traffic? What do you want to achieve? –  S.Hoekstra Oct 13 '10 at 8:07

4 Answers 4

sudo iptables -A INPUT -p tcp --dport (port number) -j ACCEPT
share|improve this answer
    
No,no. I need to open port in system, for application like torrent client or apache server. –  Romka Oct 13 '10 at 7:47
    
@Romka no no, thats not how you ask a question, more info needed, this answer is correct –  SSH This Jan 23 '13 at 22:37

Shooting in the darkness:

sudo ufw allow 80

Now there is a rule in your ubuntu firewall allowing external access to your 80 port. If you want more specific rule see man ufw. If you are on non-routable IP address you have to forward port in your router. If you provide more context to your question, then I can adjust this answer.

share|improve this answer
2  
This doesn't work under Ubuntu 12.10... nmap localhost -p80 still displays CLOSED –  weberc2 Jan 11 '13 at 23:31
    
sudo ufw enable would be required first on a default Ubuntu install, since ufw is disabled by default. –  Chris Moschini Apr 8 at 4:07

Your question needs a lot more detail:

  • What do you mean by "open a port"? Do you want to do it in a program? Just run a program?
  • What is your network configuration? LAN structure, Internet uplink, OSes involved, which router/switch...
  • Do you have any firewalls / NAT in place? On your system, elsewhere in the network?

That said, if you have the "typical" home setup (one or more computers hooked up to a combined switch/router with Internet uplink via DSL or cable): Typically the switch/router/modem combo has a built-in firewall. You'll probably need to open a port there. Usually these devices have a web interface for configuration, look into your manuals.

share|improve this answer

I suggest Netcat: The very basic way to do that (via Netcat) is:

nc -l <port_number>

Example:

nc -l 12569
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.