oxen-io / lokinet

Lokinet is an anonymous, decentralized and IP based overlay network for the internet.
https://lokinet.org/
GNU General Public License v3.0
1.76k stars 220 forks source link

Sort out nameserver mess on Linux #1613

Open jagerman opened 3 years ago

jagerman commented 3 years ago

All too often linux users install lokinet and it "doesn't work" because they are using god knows what for DNS.

We need to fix this for as many of the things that god knows as we can divine.

jagerman commented 3 years ago

E.g. here's output from a systemd-networkd that doesn't work (I suspect because systemd is preferring the Link 3 DNS servers to the global one):

Global
         DNS Servers: 127.3.2.1
          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 11 (lokitun0)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 4 (docker0)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 3 (wlp2s0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.178.1
          DNS Domain: ~.
                      fritz.box
jagerman commented 3 years ago

Eventually:

systemd-resolve --interface=wlp2s0 --set-dns=127.3.2.1

worked but there must be a better way. (systemd-resolve is the old name of resolvectl)

jagerman commented 3 years ago

I think that we might be able to change the systemd-resolv file to match lokitun* devices, and set:

DNS=127.3.2.1
Domains=~.

to make it take priority, but will take some investigation to figure out how well this works.

necro-nemesis commented 3 years ago

Possibly look at the implication on RPM if the intent is to support that in future. I'm pretty certain most of the problems with RPM atm is DNS related. Not sure if the daemon trudges away in futility if it can't get responses from bootstrapped nodes or if it attempts to re-initialize. Behavior seems to be no DNS joy. try try try try reset try try try try wash rinse repeat. Fedora 33 on uses systemd-resolved by default.

majestrate commented 3 years ago

maybe we should just bite it and marry systemd's stuff so we can autodns everything better.

jagerman commented 3 years ago

We do have systemd's stuff in place, but it isn't working as expected.

majestrate commented 3 years ago

i mean yes we do have some systemd tentacles embedded into the code but i am referring to doing things like lokinet talking to resolved / networkd directly and setting dns that way

majestrate commented 3 years ago

initial systemd-resolved support added in https://github.com/oxen-io/loki-network/pull/1615

necro-nemesis commented 3 years ago

Any additional dependencies to build this branch?

majestrate commented 3 years ago

Any additional dependencies to build this branch?

none that i know of

jagerman commented 3 years ago

Any additional dependencies to build this branch?

Just libsystemd-dev (or whatever that may be called in RPM land -- perhaps systemd-devel?), but that was already an optional dependency.