Results 1 to 6 of 6

Thread: Apache listens on port 80, but netstat shows nothing

  1. #1
    Join Date
    2014-Jan
    Posts
    4

    Question Apache listens on port 80, but netstat shows nothing

    Hello,

    I'm having this very strange behavior. Am I making a mistake ?

    netstat and lsof show no port 80 open :
    root@kali:~# netstat -anpe --inet
    Connexions Internet actives (serveurs et ├ętablies)
    Proto Recv-Q Send-Q Adresse locale Adresse distante Etat User Inode PID/Program name
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 9690 3159/sshd
    tcp 0 64 192.168.25.141:22 192.168.25.1:1292 ESTABLISHED 0 9702 3177/1
    udp 0 0 0.0.0.0:68 0.0.0.0:* 0 6569 2075/dhclient
    udp 0 0 0.0.0.0:18569 0.0.0.0:* 0 6539 2075/dhclient

    root@kali:~# lsof -i -n
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    dhclient 2075 root 5u IPv4 6569 0t0 UDP *:bootpc
    dhclient 2075 root 20u IPv4 6539 0t0 UDP *:18569
    dhclient 2075 root 21u IPv6 6540 0t0 UDP *:62285
    sshd 3159 root 3u IPv4 9690 0t0 TCP *:ssh (LISTEN)
    sshd 3159 root 4u IPv6 9692 0t0 TCP *:ssh (LISTEN)
    sshd 3177 root 3u IPv4 9702 0t0 TCP 192.168.25.141:ssh->192.168.25.1:1292 (ESTABLISHED)
    apache2 3300 root 4u IPv6 11219 0t0 TCP *:http (LISTEN)
    apache2 3318 www-data 4u IPv6 11219 0t0 TCP *:http (LISTEN)
    apache2 3320 www-data 4u IPv6 11219 0t0 TCP *:http (LISTEN)
    apache2 3321 www-data 4u IPv6 11219 0t0 TCP *:http (LISTEN)
    apache2 3322 www-data 4u IPv6 11219 0t0 TCP *:http (LISTEN)
    apache2 3323 www-data 4u IPv6 11219 0t0 TCP *:http (LISTEN)
    apache2 3330 www-data 4u IPv6 11219 0t0 TCP *:http (LISTEN)


    (as you can see, it's open in IPv6)

    But connection from a browser on the host machine shows a page, and telnet localhost works :
    root@kali:~# telnet localhost 80
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    get
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>501 Method Not Implemented</title>
    </head><body>
    <h1>Method Not Implemented</h1>
    <p>get to /index.html not supported.<br />
    </p>
    <hr>
    <address>Apache/2.2.22 (Debian) Server at 127.0.1.1 Port 80</address>
    </body></html>
    Connection closed by foreign host.


    Before rebooting, lsof showed it, but netstat didn't.

    Any idea?

    Thank you for any answer!

  2. #2
    Join Date
    2013-Mar
    Posts
    354
    Open your browser and type: localhost. See if you get a messege from apache2.

    Use nmap to locate the services listenning on the ports. Use -p- to scan all ports.

    If nmap locates it, it is there.

  3. #3
    Join Date
    2014-Jan
    Posts
    4
    Hello maverick35, thank you for your answer.

    My question was not about if the port is open, because I know it is. The telnet localhost 80 shows it.

    I was wondering why netstat didn't show it. It's rather annoying, if you can't trust tools like netstat or lsof, how can you perform troubleshooting ?

  4. #4
    Join Date
    2014-Jan
    Posts
    4
    Hello Maverick35, thank you for your answer,

    I know port 80 is open since I can connect to it with the very same test you did, but with telnet

    What I'd like to know is why netstat does not show it. It's pretty annoying, for it's a tool that I'm often use for troubleshooting, and it seems I can't rely on it.

  5. #5
    Join Date
    2013-Mar
    Posts
    10
    Apache uses ipv6 sockets to handle ipv4 and ipv6 connections, so it's pretty normal to see just the ipv6 listening. If you really want to you can configure it to use different sockets

  6. #6
    Join Date
    2014-Jan
    Posts
    4
    Hey that's a very cool answer thank you sir! I'll have to check how the system can listen to IPv4 packet on a IPv6 port :-)

Similar Threads

  1. Weird connections with netstat -n and netstat -ct
    By Attilafx in forum General Archive
    Replies: 0
    Last Post: 2014-07-28, 18:52
  2. Netstat or similar
    By Black12493 in forum General Archive
    Replies: 1
    Last Post: 2013-06-13, 14:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •