Search code examples
linuxtelnetports

Unable to telnet to localhost


While trying to telnet to localhost I get the below error

telnet localhost 32768
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying ::1...
telnet: connect to address ::1: Network is unreachable

Solution

  • If you run

    netstat -ln

    it will probably reveal that your server listens to 0.0.0.0, which only allows IPv4 to connect. If the software listens to :: (IPv6 ANY) instead, it will allow both IPv4 and IPv6 to connect unless it tells the kernel otherwise with socksetopt() call (See man ipv6(7) IPV6_V6ONLY)