1

I'm trying to open port 8080 so I can use a web panel application (McMyAdmin) I have installed on my Ubuntu server. I'm rather new to Linux / SSH in general but I'm getting there thanks to various guides and a couple of friends! I was wondering if someone can tell me what I've done wrong when trying to open port 8080. It seems to show up okay when I check the rules with -nL but not when I use -vL. I'm unsure what the actual difference between vL and nL is, too, so if anyone can give me an understanding of that, it'd be great!

EDIT: Looking over everything, it doesn't look like port 80 is open either, I'm going to presume I need to do something about that as well...

name@server:/etc/iptables$ sudo iptables -nL
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
REJECT     all  --  127.0.0.0/8          0.0.0.0/0            reject-with icmp-port-unreachable
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            state NEW icmptype 8
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:25565
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:8080
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
LOG        all  --  0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 5 LOG flags 0 level 7 prefix "iptables_INPUT_denied: "
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable

Chain FORWARD (policy DROP)
target     prot opt source               destination
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

name@server:/etc/iptables$ sudo iptables -vL
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination
0     0 ACCEPT     all  --  lo     any     anywhere             anywhere
0     0 REJECT     all  --  !lo    any     127.0.0.0/8          anywhere             reject-with icmp-port-unreachable
0     0 ACCEPT     icmp --  any    any     anywhere             anywhere             state NEW icmp echo-request
0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             state NEW tcp dpt:ssh
0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             state NEW tcp dpt:25565
61  3096 ACCEPT     tcp  --  any    any     anywhere             anywhere             state NEW tcp dpt:http-alt
862 69185 ACCEPT     all  --  any    any     anywhere             anywhere             state RELATED,ESTABLISHED
21  1648 LOG        all  --  any    any     anywhere             anywhere             limit: avg 3/min burst 5 LOG level debug prefix "iptables_INPUT_denied: "
21  1648 REJECT     all  --  any    any     anywhere             anywhere             reject-with icmp-port-unreachable

Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination
0     0 REJECT     all  --  any    any     anywhere             anywhere             reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT 16 packets, 2992 bytes)
pkts bytes target     prot opt in     out     source               destination
  • Can you edit your question and include the output from netstat -an | grep 8080. – EightBitTony Mar 18 '16 at 10:27
3

You can read about the iptables command using man iptables.

Doing that shows,

   -v, --verbose
          Verbose output.  This option makes the list command show the interface name, the rule options (if any), and the TOS masks.  The
          packet and byte counters are also listed, with the suffix 'K', 'M' or 'G' for 1000,  1,000,000  and  1,000,000,000  multipliers
          respectively  (but  see  the -x flag to change this).  For appending, insertion, deletion and replacement, this causes detailed
          information on the rule or rules to be printed. -v may be specified multiple times to possibly emit more detailed debug  state‐
          ments.

   -n, --numeric
          Numeric  output.  IP addresses and port numbers will be printed in numeric format.  By default, the program will try to display
          them as host names, network names, or services (whenever applicable).

So, the -n shows numbers rather than service names. -v isn't the opposite of -n, but it shows names (which is the default) and a lot more data.

Essentially, they're both showing you the same thing which is that you have this entry (the first is numeric, the second is named).

ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080

61 3096 ACCEPT tcp -- any any anywhere anywhere state NEW tcp dpt:http-alt

http-alt is the service name for port 8080. Basically, those two entries are the same line in different formats.

As well as 'opening the port' (which just really means, allowing traffic through the iptables firewall) you need software ready to accept traffic on the port in question. Is McMyAdmin configured to listen on port 8080?

The netstat command (among others) can be used to see which processes are listening on which ports. netstat -an lists all ports (-a) and shows numbers (-n) which makes it useful in combination with grep. For example, netstat -an | grep 8080 will list if any processes are using port 8080. You would expect to see something like this,

tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN

The actual numbers may vary. You can use -p to show which process is using the port, although it only shows all of them if you run it as root.

So, sudo netstat -anp | grep 8080 would give something like,

tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4856/some-process-name

If you don't get any output, there's nothing using or listening on port 8080, so you could just use sudo netstat -anp and look through the list of processes and see if the one you expect to be there is and which port it is LISTENing on.

  • Wow, thanks for the fast reply! And here I am at work - was expecting it to be hours before I get a response like most sites! ;) And definitely thank you for explaining the differences, I'll have to check man more often in future. My understanding is that McMyAdmin should be configured to listen on port 8080. Is there any simple way to check that it is indeed listening? – Daniel T Mar 18 '16 at 10:32
  • I've made some edits, also if you check under the question I've asked for output from netstat -an | grep 8080 to be added to the original question, when you can. – EightBitTony Mar 18 '16 at 10:38
  • You nailed it! Nothing was listening. I've restarted the server now and restarted the program and the web panel is showing up. Thank you so much for helping! – Daniel T Mar 18 '16 at 18:25

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.