Linux und 127/8 (war: Re: merkwürdiges ssh Verbindungsproblem)

Kai 'wusel' Siering wusel+ml at uu.org
Sun Jan 5 15:19:11 CET 2025


FTR:

Am 05.01.25 um 12:51 schrieb Kai 'wusel' Siering:
>> Und seit es IPv6 gibt ist
>> auch 127/8 auf dem lo interface bei Linux ;)
> $Früher, also mindestens zu Beginn des aktuellen Jahrtausends, konnte man das aber noch in 127.0.0.1/24 umkonfigurieren und z. B. 127.0.1.0/24 'normal' routen. Das ging 'plötzlich' nimmer. (Ja, es gab schon RFC1918 sowie TEST-NET-{1,2,3}, das ist nicht der Punkt.)

Hab's mal gerade mit 2 Debian-12-VMs nachgestellt: »nach außen« läßt der Linux Kernel Pakete aus 127/8 nicht mehr, trotz more specific route:

root at testvm01:~# ip route show ; ping -c 1 127.0.1.2 ; ping -c 1 127.0.1.1 ; echo ; ip -6 route show ; ping -c 1 3fff::2 ; ping -c 1 3fff::1
default via 192.168.5.33 dev eth0 onlink
127.0.1.0/24 dev eth1 proto kernel scope link src 127.0.1.1
192.168.5.0/24 dev eth0 proto kernel scope link src 192.168.5.236
ping: connect: Invalid argument
PING 127.0.1.1 (127.0.1.1) 56(84) bytes of data.
64 bytes from 127.0.1.1: icmp_seq=1 ttl=64 time=0.073 ms

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



root at testvm02:~# ip route show ; ping -c 1 127.0.1.2 ; ping -c 1 127.0.1.1 ; echo ; ip -6 route show ; ping -c 1 3fff::2 ; ping -c 1 3fff::1
default via 192.168.5.33 dev eth0 onlink
127.0.1.0/24 dev eth1 proto kernel scope link src 127.0.1.2
192.168.5.0/24 dev eth0 proto kernel scope link src 192.168.5.237
PING 127.0.1.2 (127.0.1.2) 56(84) bytes of data.
64 bytes from 127.0.1.2: icmp_seq=1 ttl=64 time=0.037 ms

--- 127.0.1.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.037/0.037/0.037/0.000 ms
ping: connect: Invalid argument



127/8 wird also special-cased irgendwo in Linux' Routingstack:

root at testvm01:~# ip addr add 192.168.5.1/30 dev eth1
root at testvm01:~# ping -c 1 -q 192.168.5.1 ; ping -c 1 192.168.5.2
PING 192.168.5.1 (192.168.5.1) 56(84) bytes of data.

--- 192.168.5.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.091/0.091/0.091/0.000 ms
PING 192.168.5.2 (192.168.5.2) 56(84) bytes of data.
64 bytes from 192.168.5.2: icmp_seq=1 ttl=64 time=0.838 ms

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



root at testvm02:~# ip addr add 192.168.5.2/30 dev eth1
root at testvm02:~# ping -c 1 -q 192.168.5.1 ; ping -c 1 192.168.5.2
PING 192.168.5.1 (192.168.5.1) 56(84) bytes of data.

--- 192.168.5.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.348/0.348/0.348/0.000 ms
PING 192.168.5.2 (192.168.5.2) 56(84) bytes of data.
64 bytes from 192.168.5.2: icmp_seq=1 ttl=64 time=0.085 ms

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

Ähnliches (Trauer-) Spiel übrigens auch bei 0/8, wobei dort (ohne ARP kein L2-Routing) die Anfragen »nur« versacken und nicht wirre Fehlermeldungen ergeben. Was für »current network« auch irgendwie doof ist.

Aber IPv4 ist ja eh' ein Auslaufmodell — auch für die nächsten 30 Jahre ;-)
-kai



More information about the Linux mailing list