0

I came across the answer at the link below when troubleshooting why my debian server has suddenly stopped making ports visible to other devices on my network and I can't figure out why.

Opening port not working

I have the same netstat output and the answer says the ports should be bound to the network interface or the network ip address instead of the localhost. However, it doesn't actually say how to do this. Can someone please explain what to do here?

Edit: my netstat output is listed below. Essentially I was using this machine to run a bunch of services on my local network (xrdp, vsftpd, emby, plex, apache). It was all working until it was powered off for a couple months but now nothing can be accessed from other devices. A port scan only shows up port 22 being open and I can still ssh in from other devices. I'm pretty stumped as to what's happened as nothing to my knowledge changed.

steve@Server:/$ sudo netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      683/sshd: /usr/sbin 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      657/cupsd           
tcp        0      0 127.0.0.1:32600         0.0.0.0:*               LISTEN      1170/Plex Tuner Ser 
tcp        0      0 127.0.0.1:35323         0.0.0.0:*               LISTEN      1003/Plex Plug-in [ 
tcp        0      0 192.168.0.107:40605     0.0.0.0:*               LISTEN      2638/rygel          
tcp        0      0 127.0.0.1:41505         0.0.0.0:*               LISTEN      2122/Plex Plug-in [ 
tcp        0      0 192.168.0.107:48807     0.0.0.0:*               LISTEN      2607/qbittorrent    
tcp        0      0 127.0.0.1:48807         0.0.0.0:*               LISTEN      2607/qbittorrent    
tcp        0      0 127.0.0.1:38089         0.0.0.0:*               LISTEN      1170/Plex Tuner Ser 
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      747/mariadbd        
tcp        0      0 127.0.0.1:35661         0.0.0.0:*               LISTEN      2638/rygel          
tcp        0      0 127.0.0.1:33583         0.0.0.0:*               LISTEN      1170/Plex Tuner Ser 
tcp        0      0 127.0.0.1:32401         0.0.0.0:*               LISTEN      844/Plex Media Serv 
tcp6       0      0 ::1:3350                :::*                    LISTEN      695/xrdp-sesman     
tcp6       0      0 :::22                   :::*                    LISTEN      683/sshd: /usr/sbin 
tcp6       0      0 ::1:631                 :::*                    LISTEN      657/cupsd           
tcp6       0      0 ::1:35033               :::*                    LISTEN      2638/rygel          
tcp6       0      0 :::3389                 :::*                    LISTEN      764/xrdp            
tcp6       0      0 :::8096                 :::*                    LISTEN      658/EmbyServer      
tcp6       0      0 fe80::3edd:d094:c:48807 :::*                    LISTEN      2607/qbittorrent    
tcp6       0      0 ::1:48807               :::*                    LISTEN      2607/qbittorrent    
tcp6       0      0 :::5900                 :::*                    LISTEN      2636/gnome-remote-d 
tcp6       0      0 :::36559                :::*                    LISTEN      2791/apache2        
tcp6       0      0 :::32400                :::*                    LISTEN      844/Plex Media Serv 
tcp6       0      0 :::80                   :::*                    LISTEN      812/apache2         
tcp6       0      0 fe80::3edd:d094:c:41877 :::*                    LISTEN      2638/rygel          
tcp6       0      0 :::21                   :::*                    LISTEN      679/vsftpd          
2
  • Please list the services and port mapping on your machine. Jul 11, 2022 at 8:12
  • 1
    And service bond to IP, not network interface, ports are part (with IP) of layer 3 of OSI model Jul 11, 2022 at 8:13

3 Answers 3

1

So I fixed it in the most satisfying way - accidentally. I was looking up with ufw didn't automatically start on boot, despite it being set up to, and someone else mentioned a conflict with firewalld and that disabling it fixed the issue. It also did for me, and must have been also keeping my ports blocked for some reason.

0

Good day;

You haven't specified what service or software you're running that has the need to bind ports so I can't be specific, however, the configuration option to set the listen IP address usually resides in the service/package configuration file e.g. when running apache2 there is an option called Listen in the /etc/apache2/apache2.conf that you can tell what IP and port it should listen to.

If we assume you're running apache2, you have to enter the following in the /etc/apache2/apache2.conf:

Listen 0.0.0.0:8000

Hope it helps.

13
  • Thanks, I tried editing apache2.conf and ports.conf that it lists but no luck unfortunately. I've posted some more information in my original question, including my netstat output.
    – Steve
    Jul 11, 2022 at 9:14
  • It appears that the apache2 process is only listening on tcp6 although according to this link it shouldn't be a problem, however, can you share the apache2.conf and ports.conf content? Are you sure you've set Listen 0.0.0.0:80 and not Listen 80?
    – Sinux
    Jul 11, 2022 at 9:24
  • This is what I put in the conf file: # Include list of ports to listen on Include ports.conf Listen 0.0.0.0:80
    – Steve
    Jul 11, 2022 at 9:33
  • You can add the Listen <YOUR_IP_ADDR>:80 to make sure it's listening on your specified socket, in addition as per @Romeo Ninov answer, you can disable IPv6 and remove lines related to IPv6 from /etc/hosts and then restart the service using systemctl restart apache2
    – Sinux
    Jul 11, 2022 at 9:41
  • If you run wget http://127.0.0.1/ -O - on the server what happens? Does it successfully connect? Does it return the raw HTML for your website as expected?
    – Sinux
    Jul 11, 2022 at 9:42
0

WHat I can see from netstat output your services listen to IPv6 IPs. One sample way is to disable IPv6 and restart the network and daemons (or entire computer). Also in /etc/hosts remove lines which are related to IPv6.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .