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.
Solution 3
How are you trying to access it? i.e. what address are you entering in the address bar? are you use localhost
, or 127.0.0.1
or an external address or domain?
Related videos on Youtube
Pedro
Senior Developer, that love to use new stuff Follow my Twitter @pcamacho
Updated on September 17, 2022Comments
-
Pedro over 1 year
I install lighttpd in one server using port 81.
The problem is that the port is closed, and I don't know how to open the port.
Regards,
Pedro -
womble over 14 yearsExcellent question.
-
Pedro over 14 yearsthe external address. I make telnet www.ssss.xxx 81 from remote server and nothing, connection refused
-
Araejay over 14 years@pcamacho what sort of internet connection is this? A home DSL line? Or in a datacentre? What's your firewall set up? Can you access a webserver on port 80?
-
Pedro over 14 yearsyes I can connect using telent www.xxx.yy 80 it's one Dedicated Debian Server that I run several websites in Apache Vhosts
-
Pedro over 14 yearsI also tryed: iptables -A INPUT -p tcp --dport 81 -j ACCEPT but then when I do: netstat -ltn The Port 81 is not listed!
-
Pedro over 14 yearsdon't work! :( Port still closed
-
womble over 14 yearsIf you're going via another router, you'll need to open up the firewall on that device as well. It sounds like the machine itself isn't at fault (you can test this by trying to connect to localhost:81)
-
Pedro over 14 yearsI try but can't connect with telnet localhost 81 and telnet 127.0.0.1 81
-
netfed over 4 yearsTo see what programs are listening, use the command lsof -i -P