2

I have an old Ubuntu server (13.04), and want to open a port for this online game server style software for a mate. I need a port open, and to tell it that port (I know how to tell the game that port).

For the sake of argument, let the port I want to open be 12345.

How do I do such, with no access to a GUI, only a Bash shell. Both how to open the port, and how to fiddle with the firewall so that port is visible to the world.

Thanks!

EDIT: I can port forward it internally (iptables esque), but I don't know what firewalling software I have installed. Is there an easy way to find that out? Also, how do I port forward the router as well, all from the terminal. Sorry for the earlier lack of detail

  • The port is opened by the program, so start the server program using port 12345 with UDP and/or TCP. What firewall software do you use on the server? None, ufw, shorewall or something else? How are your server connected to internet? Directly or through a router with IPv4 with/without a NAT and firewall, with IPv6? Please add information about this so we can help you to answer your question. Using IPv6 would have been easier. ;-) – Anders Jun 23 '13 at 12:16
  • So to clarify: using the answer provided by @tomodachi below should have opened the port, and should be accessible on your LAN. To open the port on your router and enable port forwarding you will need to login to your router (usually done through web interface). The specific instructions will vary by router model/brand, but look for "applications" or "port forward" in your router settings. – amc Jun 23 '13 at 18:22
  • Great. How do I get to get to the router settings all in shell (I do have "links" to view web pages in terminal)? – Benji Marshall Jun 24 '13 at 9:09
5
sudo iptables -A INPUT -i eth0 --proto tcp --dport 12345 -j ACCEPT

this will allow incoming traffic to the network interface eth0 for tcp port 12345. You didn't specify if you were referring to tcp or udp.

You can list the rule with:

sudo iptables -L -n
  • Awesome, but that is only part of my battle. Thanks for the help so far, can you look at my edit to OP where I explain what also needs doing. Thank you so far, though. – Benji Marshall Jun 23 '13 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.