/etc/hosts:

127.0.0.1       localhost
127.0.1.1       kato i7

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

$ systemd-resolve --status
Global
         DNS Servers: 10.2.2.3
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 2 (enp4s0)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Remark: I have no idea where these ##.172.in-addr.arpa come from.

$ systemd-resolve fpc
fpc: 10.2.2.1%enp4s0
     10.2.2.250%enp4s0
     fe80::4687:fcff:fe9e:4ac7%2%enp4s0

-- Information acquired via protocol DNS in 1.6ms.
-- Data is authenticated: yes

Remark: ah, here it still has the network-name along with the ipv6

$ systemd-resolve -t A fpc
fpc IN A 10.2.2.1 # interface enp4s0
fpc IN A 10.2.2.250 # interface enp4s0

-- Information acquired via protocol DNS in 2.2ms.
-- Data is authenticated: yes

$ systemd-resolve -t AAAA fpc
fpc IN AAAA fe80::4687:fcff:fe9e:4ac7 # interface enp4s0

-- Information acquired via protocol DNS in 2.1ms.
-- Data is authenticated: yes

Remark: ah, here it also has the network-name along with the ipv6

$ dig @10.2.2.3 -t A fpc

; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @10.2.2.3 -t A fpc
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57577
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;fpc.                           IN      A

;; ANSWER SECTION:
fpc.                    0       IN      A       10.2.2.1

;; Query time: 0 msec
;; SERVER: 10.2.2.3#53(10.2.2.3)
;; WHEN: Fri Dec 06 17:11:19 CET 2019
;; MSG SIZE  rcvd: 48

Remark: As I said, upstream DNS 10.2.2.3 doesn't know about the second
10.2.2.250 address.

$ dig @10.2.2.3 -t AAAA fpc

; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @10.2.2.3 -t AAAA fpc
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 924
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;fpc.                           IN      AAAA

;; Query time: 0 msec
;; SERVER: 10.2.2.3#53(10.2.2.3)
;; WHEN: Fri Dec 06 17:12:03 CET 2019
;; MSG SIZE  rcvd: 21

Remark: As I said, upstream DNS 10.2.2.3 doesn't know about inet6 link
local addresses.

$ dig @127.0.0.53 -t A fpc

; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @127.0.0.53 -t A fpc
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7210
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;fpc.                           IN      A

;; ANSWER SECTION:
fpc.                    0       IN      A       10.2.2.1
fpc.                    0       IN      A       10.2.2.250

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Fri Dec 06 17:15:14 CET 2019
;; MSG SIZE  rcvd: 64

Remark:  systemd-resolved DOES obtain this info elsewhere than from
upstream DNS.

$ dig @127.0.0.53 -t AAAA fpc

; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @127.0.0.53 -t AAAA fpc
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45149
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;fpc.                           IN      AAAA

;; ANSWER SECTION:
fpc.                    0       IN      AAAA    fe80::4687:fcff:fe9e:4ac7

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Fri Dec 06 17:16:16 CET 2019
;; MSG SIZE  rcvd: 60

Remark:  systemd-resolved DOES obtain this info elsewhere than from
upstream DNS.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1853669

Title:
  systemd resolves own hostname to link local ipv6 address

Status in systemd package in Ubuntu:
  Incomplete

Bug description:
  I've got an ethernet-device that only has a configured ipv4 address,
  and some auto-generated link-local (aka "scope link") ipv6 address.

  Any tool doing a DNS query (and /lib/systemd/systemd-resolved is the
  DNS-server listening on 127.0.0.53) for this host's hostname gets back
  two addresses: the correct ipv4 address, and a broken ipv6 address.

  Unlike on ipv4,  it is possible for the same ipv6-address to be
  assigned to multiple devices, and therefore the address is only valid
  in the context of the eth-device.

  Now, if "ifconfig" shows "inet6 fe80::4687:fcff:fe9e:4ac7  prefixlen 64  
scopeid 0x20<link>"
  then "fe80::4687:fcff:fe9e:4ac7" is NOT a connectable address, and syscall 
connect() typically fails with EINVAL.

  To make it a valid address, it needs to be suffixed with a "%" and the device 
name, like:
  fe80::4687:fcff:fe9e:4ac7%enp4s0

  Either the resolver can return the link name attached to the address
  separated with a "%" char, or it needs to ignore link-local inet6
  addresses.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1853669/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to