Arch Linux ARM(というかSystemd)のresolv.confについて
普段ラズパイでArch Linux ARMを使っていると、たまに(というかしょっちゅう)インターネットに繋がらなくなる。
IPアドレス直接指定では問題なく接続できるが、名前解決が出来ない。
環境
/etc/systemd/network/eth0.network
[Match] Name=eth0 Host=test.morinezumiiii.jp [Network] DHCP=none DNS=('192.168.0.1','8.8.8.8','8.8.4.4') [Address] Address=192.168.0.80/24 [Route] Gateway=192.168.0.1/24
原因
原因はなんとなく分かっている。
Archを再起動すると、resolv.confがどこからか勝手に書き換えられているから。
でもそれがどこから書き換えているのかわからないので、解決方法がわからない。
ググってみると、同様にFedoraでresolv.confが勝手に書き換えられてしまって困っている人たちはちらほら見かけたが、Archとはちょっと原因が異なりそう(同じ?)
resolv.conf(つながるとき)
# This file is managed by systemd-resolved(8). Do not edit. # # Third party programs must not access this file directly, but # only through the symlink at /etc/resolv.conf. To manage # resolv.conf(5) in a different way, replace the symlink by a # static file or a different symlink. nameserver 8.8.4.4 nameserver 8.8.8.8
resolv.conf(つながらないとき)
# This file is managed by systemd-resolved(8). Do not edit. # # Third party programs must not access this file directly, but # only through the symlink at /etc/resolv.conf. To manage # resolv.conf(5) in a different way, replace the symlink by a # static file or a different symlink. nameserver 8.8.4.4 nameserver 2001:4860:4860::8844 <-- なんかできた nameserver 8.8.8.8 # Too many DNS servers configured, the following entries may be ignored. <-- なんかできた nameserver 2001:4860:4860::8888 <-- なんかできた
/etc/resolv.conf(シンボリックリンク)
/etc/resolv.confって、シンボリックリンクだったんですね。知らなかったよ。(白目)
$ ls -la /etc/resolv.conf lrwxrwxrwx 1 root root 32 Feb 8 16:52 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
解決方法
まだわかってない。もっとsystemd-networkdを勉強してみる。