Debian Open port 81

Solution 1:

Netstat:
From what you have said, sounds like the port might not actually be listening. If port 81 was listening on all interfaces you should see something like the following line from 'netstat -tapnl':

tcp        0      0 192.168.1.82:81       0.0.0.0:*               LISTEN      -               
tcp        0      0 192.168.131.1:81        0.0.0.0:*               LISTEN      -               
tcp        0      0 192.168.21.1:81        0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:81            0.0.0.0:*               LISTEN      -

The 4th Coloumn is the IP address that have something listening on them. With 127.0.0.1 being the loopback interface. You might also see 0.0.0.0:81 for all interfaces instead.

Iptables:
So if you did see it listening on 127.0.0.0 or 0.0.0.0 from the netstat output, you should be able to telnet to it from the same server if you have this common iptables rule from the 'sudo iptables -L -v' command:

1198K  183M ACCEPT     all  --  lo     any     anywhere             anywhere

Which if under the INPUT chain mean accept all incoming connections into the loopback interface. Also, notice the first two columns. This is how many packets / bytes are matching that rule, so you should see the counters changing with DROP or ACCEPT rules accordingly. It is a way to see if the rules are 'catching' the packets.

Conclusion:
Make sure lighttpd is actually running 'sudo ps aux | grep lighttpd' (assuming that is process name). If it isn't, start it with 'sudo /etc/init.d/lighttpd start'. Then if you still don't see it listening look in the logs at /var/log/lighttpd . Lastly, post your lighttpd configuration. If you are trying to start the process as a non root user you also won't be able to bind it to 81 because that is a privileged port (even though the process might run as another user).

The above assumes you have ssh access or something similar and are on the machine itself. That is the best place to start, eliminates and complexity of the router with its possible NAT. You can do NAT with iptables, but not sure if you can do it with the loopback interface, and that would be an odd thing to do if you can.

Solution 2:

Define "closed". If netstat -ltn shows 0.0.0.0:81 in the "Local Address" column, then lighttpd is listening (and hence the port isn't actually closed), and it's something firewall-related. If you know you're using a firewall management package, then modifying that to allow new inbound connections to port 81 is the way to go, otherwise you can try opening the port "by hand" with something like iptables -I INPUT 1 -p tcp --dport 81 -j ACCEPT (although if you are running a firewall manager of some sort, that change might get wiped out, and will definitely get wiped out on reboot). More information about your system can elicit more detailed and more useful answers.