1. ソフトウェアの取得とインストール
# ファイルをダウンロード
wget https://github.com/pymumu/smartdns/releases/download/Release43/smartdns.1.2023.08.11-1937.x86_64-linux-all.tar.gz
# 解凍し、インストールを実行
tar xf smartdns.1.2023.08.11-1937.x86_64-linux-all.tar.gz
cd smartdns
chmod +x ./install
./install -i
2. 設定ファイルの編集(サンプル)
# vim /etc/smartdns/smartdns.conf
#####################################
# 🚪 リスニング設定
#####################################
bind :53
bind-tcp :53
#####################################
# 🧠 キャッシュ設定(信頼性重視)
#####################################
cache-size 65536
cache-persist yes
cache-file /tmp/smartdns.cache
# ダイナミックな変更対応(推奨)
serve-expired yes
serve-expired-ttl 86400
serve-expired-reply-ttl 30
# ドメイン事前取得
prefetch-domain yes
#####################################
# 🚫 セキュリティ設定
#####################################
bogus-nxdomain 0.0.0.0/8
#####################################
# 🌐 IPv6(非推奨の場合あり)
#####################################
force-AAAA-SOA yes
dualstack-ip-selection no
#####################################
# ⚡ レスポンス速度確認(企業向けは無効化推奨)
#####################################
#speed-check-mode ping,tcp:80,tcp:443
#####################################
# 🌏 上流 DNS サーバー(階層構造)
#####################################
# 🇨🇳 国内 DNS(優先)
server 223.5.5.5
server 119.29.29.29
# 🇨🇳 国内代替
server 114.114.114.114
# 🌍 外部 DNS(保護・失敗時の代替)
server-tls 8.8.8.8:853
server-tls 1.1.1.1:853
#####################################
# 🏢 内部ドメイン(最優先)
#####################################
# 特定ドメイン
address /wiki.example.com/10.10.10.99
address /reg.example.com/10.10.10.100
# 👉 内部ネットワークが存在する場合(推奨)
#address /.corp.example.com/10.10.10.1
#####################################
# 🧩 オプション:内部 DNS リダイレクト(AD/社内DNS)
#####################################
#server 10.10.10.1 -group intranet
#nameserver /.corp.example.com/intranet
#####################################
# 📊 ログ出力
#####################################
log-level info
log-file /var/log/smartdns.log
3. サービスの起動
systemctl enable --now smartdns
4. 解析機能のテスト
# テストツールをインストール
dnf install bind-utils -y
# サービス設定の確認
nslookup -querytype=ptr smartdns
# ドメイン解決のテスト
dig -t A wiki.example.com
nslookup reg.example.com
参考資料:
https://pymumu.github.io/smartdns/