Score:0

curl to localhost fails in 20.04

in flag

I have host machine 20.04 and guest VM box 22.04

I am trying to run the curl command and on both machine getting the same error.

Host running this:

sudo ufw status 
Status: active

To                         Action      From
--                         ------      ----
5000:5100/tcp              ALLOW       Anywhere                  
1433                       ALLOW       Anywhere                  
1434                       ALLOW       Anywhere                  
8080                       ALLOW       Anywhere                  
OpenSSH                    ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
80                         ALLOW       127.0.0.1                 
5000:5100/tcp (v6)         ALLOW       Anywhere (v6)             
1433 (v6)                  ALLOW       Anywhere (v6)             
1434 (v6)                  ALLOW       Anywhere (v6)             
8080 (v6)                  ALLOW       Anywhere (v6)             
OpenSSH (v6)               ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6) 

and yes there are repeated rules but I was getting the same error even before.

I have tried a combination of curl with localhost or 127.0.0.1 or :80 or :8080 and still got a similar error

curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused
sudo netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:1434          0.0.0.0:*               LISTEN      1514/sqlservr       
tcp        0      0 127.0.0.1:1431          0.0.0.0:*               LISTEN      1514/sqlservr       
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      200812/cupsd        
tcp        0      0 127.0.0.1:33060         0.0.0.0:*               LISTEN      1169/mysqld         
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1169/mysqld         
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      923/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1121/sshd: /usr/sbi 
tcp        0      0 0.0.0.0:1433            0.0.0.0:*               LISTEN      1514/sqlservr       
tcp6       0      0 ::1:631                 :::*                    LISTEN      200812/cupsd        
tcp6       0      0 ::1:1431                :::*                    LISTEN      1514/sqlservr       
tcp6       0      0 ::1:1434                :::*                    LISTEN      1514/sqlservr       
tcp6       0      0 :::22                   :::*                    LISTEN      1121/sshd: /usr/sbi 
tcp6       0      0 :::1433                 :::*                    LISTEN      1514/sqlservr       
udp        0      0 127.0.0.53:53           0.0.0.0:*                           923/systemd-resolve 
udp        0      0 0.0.0.0:631             0.0.0.0:*                           200814/cups-browsed 
udp        0      0 0.0.0.0:54075           0.0.0.0:*                           987/avahi-daemon: r 
udp        0      0 224.0.0.251:5353        0.0.0.0:*                           22568/chrome        
udp        0      0 224.0.0.251:5353        0.0.0.0:*                           22612/chrome --type 
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           987/avahi-daemon: r 
udp6       0      0 :::55564                :::*                                987/avahi-daemon: r 
udp6       0      0 :::5353                 :::*  

Also here I got nothing when trying to see if port 80 or 8080 is listen

sudo netstat -tnlp | grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1121/sshd: /usr/sbi 
tcp6       0      0 :::22                   :::*                    LISTEN      1121/sshd: /usr/sbi 
uss:~$ sudo netstat -tnlp | grep :80
uss:~$ sudo netstat -tnlp | grep :8080
mpboden avatar
do flag
Have you setup any services to listen on port 80 or 8080? The output of `sudo netstat -tnlp` shows that you haven't.
Rick avatar
in flag
can you be more specific about what services you re referring to? If you can share a link or some resources that would be helpful
Score:0
ch flag

Have you tried disabling the firewall and trying again ?

sudo ufw disable

Rick avatar
in flag
yes I did and still unable to curl
zx485 avatar
us flag
This does not provide an answer to the question. Once you have sufficient [reputation](https://askubuntu.com/help/whats-reputation) you will be able to [comment on any post](https://askubuntu.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/1309013)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.