netcat is blocked, telnet gets connection

Posted on

Problem :

I’m trying to install an svn server on my linux machine (ubuntu 9.04). I copied a line to start svnserve to the inetd.conf file and restarted inetd. But I’m not able to connect with an svn client to the server. I always get the error message

connection refused

Now comes the strange part: If I call

netcat localhost 3690

the connection is refused, too. But if I call

telnet localhost 3690

I get some responses from svnserve.

Any ideas what could be the cause of this – and how I can make my svnserver work?

Some more details:

  • I installed inetutils-inetd (Version 2:1.6-1)
  • netstat gives me the line

    tcp6 0 0 :::3690 :::* LISTEN

  • If I disable all the “special IPv6 addresses” in /etc/hosts, telnet stops to work and gives me a “connection refused”, too.

  • I tried to activate the daytime service of inetd (port 13). Same behaviour: netcat isn’t able to connect, telnet is.
  • As far as I can see there is no firewall (ufw is installed but not enabled).

Solution :

Netcat only does IPv4, and the server is only listening on IPv6.

Try setting this kernel option, then killing and restarting inetd:

sysctl net.ipv6.bindv6only=0

(And change the inetd service line to tcp. About time you start using v6)

I found the answer myself…

The problem was this line in the inetd.conf:

svn stream tcp nowait subversion /usr/bin/svnserve svnserve -i -r /home/svn

After switching the keyword tcp to tcp4 everything works fine. Now netstat gives me this output:

tcp        0      0  *               LISTEN

Leave a Reply

Your email address will not be published. Required fields are marked *