netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ipv6 ::1 and lo dev
@ 2021-08-18 16:59 Oleg
  2021-08-18 17:47 ` Thorsten Glaser
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg @ 2021-08-18 16:59 UTC (permalink / raw)
  To: netdev

  Hello.

I try to replace ::1/128 ipv6 address on lo dev with ::1/112 to
access more than 1 address(like with ipv4 127.0.0.1/8). But i get
worked only address which is set on the dev. For example:

~# ip a show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
~# ping -c1 -w1 127.0.0.2
PING 127.0.0.2 (127.0.0.2) 56(84) bytes of data.
64 bytes from 127.0.0.2: icmp_seq=1 ttl=64 time=0.095 ms

--- 127.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.095/0.095/0.095/0.000 ms

~# ping -c1 -w1 ::2
PING ::2(::2) 56 data bytes

--- ::2 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

Replace ::1/128 with ::1/112 and try again:

~# ip -6 a flush dev lo
~# ip -6 a add dev lo local ::1/112 scope host
~# ip a show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/112 scope host 
       valid_lft forever preferred_lft forever
~# ping -c1 -w1 ::2
PING ::2(::2) 56 data bytes

--- ::2 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

So, this don't work. How can i get the same behaviour for ipv6
loopback addresses as with ipv4?

Thanks!

-- 
Олег Неманов (Oleg Nemanov)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ipv6 ::1 and lo dev
  2021-08-18 16:59 ipv6 ::1 and lo dev Oleg
@ 2021-08-18 17:47 ` Thorsten Glaser
  2021-08-18 20:17   ` Willy Tarreau
  2021-08-19  9:16   ` Oleg
  0 siblings, 2 replies; 5+ messages in thread
From: Thorsten Glaser @ 2021-08-18 17:47 UTC (permalink / raw)
  To: Oleg; +Cc: netdev

On Wed, 18 Aug 2021, Oleg wrote:

> I try to replace ::1/128 ipv6 address on lo dev with ::1/112 to
> access more than 1 address(like with ipv4 127.0.0.1/8). But i get

AIUI this is not possible in IPv6, only :: and ::1 are reserved,
the rest of ::/96 is IPv4-compatible IPv6 addresses.

I never understood why you’d want more than one address for loopback
anyway (in my experience, the more addresses a host has, the more
confused it’ll get about which ones to use for what).

bye,
//mirabilos
-- 
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

*************************************************

Mit dem tarent-Newsletter nichts mehr verpassen: www.tarent.de/newsletter

*************************************************

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ipv6 ::1 and lo dev
  2021-08-18 17:47 ` Thorsten Glaser
@ 2021-08-18 20:17   ` Willy Tarreau
  2021-08-18 21:15     ` Stephen Hemminger
  2021-08-19  9:16   ` Oleg
  1 sibling, 1 reply; 5+ messages in thread
From: Willy Tarreau @ 2021-08-18 20:17 UTC (permalink / raw)
  To: Thorsten Glaser; +Cc: Oleg, netdev

On Wed, Aug 18, 2021 at 07:47:37PM +0200, Thorsten Glaser wrote:
> On Wed, 18 Aug 2021, Oleg wrote:
> 
> > I try to replace ::1/128 ipv6 address on lo dev with ::1/112 to
> > access more than 1 address(like with ipv4 127.0.0.1/8). But i get
> 
> AIUI this is not possible in IPv6, only :: and ::1 are reserved,
> the rest of ::/96 is IPv4-compatible IPv6 addresses.
> 
> I never understood why you'd want more than one address for loopback
> anyway (in my experience, the more addresses a host has, the more
> confused it'll get about which ones to use for what).

It's because you've probably never dealt with massive hosting :-)
Sometimes binding a full /24 (or smaller) on the loopback, be it
for listening addresses or to be used as sources to connect to
next hops, is extremely useful.

Willy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ipv6 ::1 and lo dev
  2021-08-18 20:17   ` Willy Tarreau
@ 2021-08-18 21:15     ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2021-08-18 21:15 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: Thorsten Glaser, Oleg, netdev

On Wed, 18 Aug 2021 22:17:55 +0200
Willy Tarreau <w@1wt.eu> wrote:

> On Wed, Aug 18, 2021 at 07:47:37PM +0200, Thorsten Glaser wrote:
> > On Wed, 18 Aug 2021, Oleg wrote:
> >   
> > > I try to replace ::1/128 ipv6 address on lo dev with ::1/112 to
> > > access more than 1 address(like with ipv4 127.0.0.1/8). But i get  
> > 
> > AIUI this is not possible in IPv6, only :: and ::1 are reserved,
> > the rest of ::/96 is IPv4-compatible IPv6 addresses.
> > 
> > I never understood why you'd want more than one address for loopback
> > anyway (in my experience, the more addresses a host has, the more
> > confused it'll get about which ones to use for what).  
> 
> It's because you've probably never dealt with massive hosting :-)
> Sometimes binding a full /24 (or smaller) on the loopback, be it
> for listening addresses or to be used as sources to connect to
> next hops, is extremely useful.
> 
> Willy

In the large scale routing world addresses are assigned to loopback
interface because it keeps routing protocols happy. If interface goes
down loopback stays around.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ipv6 ::1 and lo dev
  2021-08-18 17:47 ` Thorsten Glaser
  2021-08-18 20:17   ` Willy Tarreau
@ 2021-08-19  9:16   ` Oleg
  1 sibling, 0 replies; 5+ messages in thread
From: Oleg @ 2021-08-19  9:16 UTC (permalink / raw)
  To: Thorsten Glaser; +Cc: netdev

On Wed, Aug 18, 2021 at 07:47:37PM +0200, Thorsten Glaser wrote:
> On Wed, 18 Aug 2021, Oleg wrote:
> 
> > I try to replace ::1/128 ipv6 address on lo dev with ::1/112 to
> > access more than 1 address(like with ipv4 127.0.0.1/8). But i get
> 
> AIUI this is not possible in IPv6, only :: and ::1 are reserved,
> the rest of ::/96 is IPv4-compatible IPv6 addresses.

This is a big mistake of standards and, i think, we shouldn't conform to
standards in this area. Because standards conflicts with real life practice
(and needs) here.

I think, we can safely use ::/104 as analog of 127.0.0.1/8, because, AFAIK,
0.0.0.0/8 isn't used now in practice and thus there are no problems with
ipv4-mapped ipv6 addresses.

In any case, we should allow users to get an expected behaviour for lo dev
address - as with 127.0.0.1/8. I.e. when i remove ::1/128 and set ::1/104
i expect that ping ::2, ::3 and etc will work(may be only if some parameter for
"ip a add" is specified).

Unfortunately i can't suggest any patch, because my kernel programming level
is about 0 :-). May be anybody can do it?

> I never understood why you’d want more than one address for loopback
> anyway (in my experience, the more addresses a host has, the more
> confused it’ll get about which ones to use for what).

Besides already mentioned cases i say you about my 2 cases:

1. We have a service which serve many tunnels to different machines
  (think of it as many ssh -R X:127.0.0.N:Y to our service servers). Each
  machine is mapped to address:port(thus it constant between sessions).
  And we use many addresses from 127.0.0.1/8 :-).
2. We have many qemu VMs on several hardware hosts. We assign an address
  to every VM from 127.0.0.1/8 for comfort use of telnet/vnc. E.g. we
  have in /etc/hosts something like this(where third column is for
  host machine index and fourth column is for VM index):

  ...
  127.0.1.2       www1.vm
  127.0.1.3       www2.vm
  127.0.1.4       www3.vm
  127.0.1.5       dns1.vm
  127.0.1.5       dns2.vm
  127.0.1.6       mail1.vm
  ...

  and run qemu with:

  -serial telnet:dns1.vm:23,server,nowait -vnc dns1.vm:0

  This /etc/hosts syncronized between hardware hosts and if one if it fail
  we can migrate all VMs from it to another one and their addresses aren't
  intermixed.

-- 
Олег Неманов (Oleg Nemanov)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-19  9:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 16:59 ipv6 ::1 and lo dev Oleg
2021-08-18 17:47 ` Thorsten Glaser
2021-08-18 20:17   ` Willy Tarreau
2021-08-18 21:15     ` Stephen Hemminger
2021-08-19  9:16   ` Oleg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).