I'm on OSX Mountain Lion 10.8.3, and I've freshly rebooted my Mac.
I want to start a service (like Apache on port 80), but there is already something going on with port 80:
telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Wait, I hear you say, you can find that with lsof or netstat. Except there is nothing there
netstat -an | grep LISTEN | grep '\.80'
*comes back blank*
lsof -i :80 | grep LISTEN
*comes back blank
So from what I know about unix systems, I figure this must be a packet forwarding rule then? I.e. packets are being forwarded from inbound port 80 to something else, which is listening on that service.
ipfw show
65535 0 0 allow ip from any to any
Hmm, nothing unusual there
pfctl -s nat
No ALTQ support in kernel
ALTQ related functions disabled
Nothing unusual there
My question is, how can I display any packet forwarding rules... On Linux I might just do iptables -L -t NAT, or iptables -L. Or alternatively, can any OSX experts help me diagnose this problem?
lsof
grep you used would come back blank; port numbers are mapped to/etc/services
names. Trylsof -i | grep http
...-i :port
format, only if you grep. What will be a problem is thatlsof
needs root privs to see other users' processes, so you should usesudo lsof -i :80
(and I'd try it without thegrep
, just to make sure...)lsof -i :80
while still connected in that Telnet session? And apart from trying http://localhost/, maybe typing something at that Telnet prompt reveals something...? (Again, I know: even if you figure it out that way, it would not be the answer to your question...)