IPv6 address is not working in Ubuntu

1

2

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

Alex F

Posted 2012-11-29T09:45:52.607

Reputation: 475

can you paste your /etc/xinetd.d/telnet setting here. – max – 2012-11-29T11:17:19.710

@max: /etc/xinetd.d/telnet: No such file or directory – Alex F – 2012-11-29T11:25:06.790

ok ubuntu right sorry my mistake... – max – 2012-11-29T12:00:44.943

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 – 2012-11-29T12:30:23.817

@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 – 2012-11-29T12:37:48.343

Answers

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
}                                                                               

Alex F

Posted 2012-11-29T09:45:52.607

Reputation: 475

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.

max

Posted 2012-11-29T09:45:52.607

Reputation: 3 329

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 – 2012-11-29T14:42:51.680

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.

TomH

Posted 2012-11-29T09:45:52.607

Reputation: 2 558

Echo service is active - connection with 127.0.0.1 or localhost works. – Alex F – 2012-11-29T11:17:20.343