1

Telnet connection with echo service succeeds for localhost and 127.0.0.1 host names, but fails with ::1 host name:

alex@u120432:~$ telnet localhost 7
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
123
123
^]

telnet> q
Connection closed.
alex@u120432:~$ telnet ::1 7
Trying ::1...
telnet: Unable to connect to remote host: Connection refused
alex@u120432:~$ 

My own program trying to talk using IPv6 address fails as well. Why IPv6 address is rejected?

OS: Ubuntu 12.04 32 bit.

Additional information:

For any TCP/UDP server-client programs (not only telnet + echo) I tried different host names. Assuming that computer IP address is 10.90.185.73 (fe80::21b:21ff:fe5e:28af), I tested the following options:

localhost - works
127.0.0.1 - works
::1 - Connection refused
10.90.185.73 - works
computer-name - works
::ffff:10.90.185.73 - works
fe80::21b:21ff:fe5e:28af - Connection refused
5
  • can you paste your /etc/xinetd.d/telnet setting here.
    – max
    Nov 29, 2012 at 11:17
  • @max: /etc/xinetd.d/telnet: No such file or directory
    – Alex F
    Nov 29, 2012 at 11:25
  • ok ubuntu right sorry my mistake...
    – max
    Nov 29, 2012 at 12:00
  • Run netstat -ntlp and you'll probably find your service to be listening on IPv4 only. Change your echo service to bind to IPv6 as well.
    – gertvdijk
    Nov 29, 2012 at 12:30
  • @gertvdijk - "Change your echo service to bind to IPv6 as well" - how exactly can I do this? Echo service itself it not so interesting to me, my problem is that any program doesn't work with IPv6 address.
    – Alex F
    Nov 29, 2012 at 12:37

3 Answers 3

2

The problen is solved by adding flags = IPv6 line to \etc\xinetd.d\echo file:

service echo
{
    disable     = no
    type        = INTERNAL
    id      = echo-stream
    socket_type = stream
    protocol    = tcp
        flags           = IPv6  
    user        = root
    wait        = no
}                                                                               


service echo
{
    disable     = no
    type        = INTERNAL
    id      = echo-dgram
    socket_type = dgram
    protocol    = udp
        flags           = IPv6  
    user        = root
    wait        = yes
}                                                                               
1

I think this will work for you... First install xinetd using this command.

root@localhost:~#apt-get install xinetd

Then change to this directory

root@localhost:~# cd /etc/xinetd.d/

create on file named as telnet

open that file(telnet) and copy this content to that file

service telnet
 { disable     = no
   flag        = REUSE
   socket_type = stream
   wait        = no
   user        = root
  server       = /usr/sbin/in.telnetd
log_on_failure += USERID
}

Then restart the xinetd service using this command

root@localhost:~# service xinetd restart

Thats it.

Now check the telnet

root@localhost:~# telnet 127.0.0.1
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Ubuntu 12.04 LTS
localhost login: max
Password: 
Last login: Thu Nov 29 20:00:24 IST 2012 from localhost on pts/3
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

 * Documentation:  https://help.ubuntu.com/

max@localhost:~$ exit
logout
Connection closed by foreign host.
root@localhost:~# telnet ::1
Trying ::1...
Connected to ::1.
Escape character is '^]'.
Ubuntu 12.04 LTS
localhost login: max
Password: 
Last login: Thu Nov 29 20:01:26 IST 2012 from localhost on pts/5
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

 * Documentation:  https://help.ubuntu.com/

max@localhost:~$ exit
logout
Connection closed by foreign host.
1
  • Thanks. The first part is already done - echo service is active and replies to 127.0.0.1 address. telnet ::1 is not working. More important, my own program doesn't work with IPv6 address...
    – Alex F
    Nov 29, 2012 at 14:42
0

The address isn't rejected, the connection is, because there is no server listing on the echo port at that address.

Most likely the echo server is being managed by xinetd and there will be a /etc/xinetd.d/echo-stream file which specifies what ports and addresses it should listen on - reading man xinetd.conf should help you learn how you can IPv6 enable it.

1
  • Echo service is active - connection with 127.0.0.1 or localhost works.
    – Alex F
    Nov 29, 2012 at 11:17

You must log in to answer this question.

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