LoginSignup
3
3

More than 5 years have passed since last update.

Alpine Linux で DNS設定が消えるのを解消する

Posted at

何度も setup-dns で設定しても /etc/resolv.conf 消されます。

/etc/network/interfaces いじったり
openresolv 入れて設定してみたり
NetworkManager 止めてみたり
あれこれやりましたがやっぱりダメでした・・・

そこで諦めてchattrを使おうとしましたが Alpine の busybox には入ってない?

本家からDLして追加しました。

chattrをインストール

cd /bin/
wget https://busybox.net/downloads/binaries/1.21.1/busybox-x86_64
chmod 755 busybox-x86_64
ln -s /bin/busybox-x86_64 chattr

immutable属性を付与

setup-dns -d localhost -n 8.8.8.8
chattr +i /etc/resolv.conf

補足

変更するにはいったんimmutable属性を外して編集する

chattr -i /etc/resolv.conf

setup-dns -d localhost -n 8.8.4.4
もしくは
vi /etc/resolv.conf

chattr +i /etc/resolv.conf

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3