
OpenWrtルーターのコマンドラインを使用してDNS設定を変更するにはどうすればよいですか?これらのファイルは「UCI システム」のドキュメント:
/etc/config/ddns
/etc/config/ipset-dns
しかし、dnsmasqもインストールされているようです
しかし、ルーターのDNSサーバーを変更できるかどうかはわかりません
私の最終目標は、1 日に数時間カスタム DNS サーバーを追加し、その後元の DNS に戻す cron ジョブを追加することです。
次のコマンドを見つけました。誰か説明できますか?
uci set network.wan.dns='<list of space-separated DNS server IPs>'
uci commit network
reload_config
そして
uci set network.wan.peerdns='0'
uci del network.wan.dns
uci add_list network.wan.dns='9.9.9.9'
uci add_list network.wan.dns='149.112.112.112'
uci commit
答え1
OpenWRTのドキュメントにはこの設定の例が記載されています。https://openwrt.org/docs/guide-user/base-system/dhcp_configuration
# Configure DNS provider
uci set network.wan.peerdns="0"
uci set network.wan.dns="8.8.8.8 8.8.4.4"
uci set network.wan6.peerdns="0"
uci set network.wan6.dns="2001:4860:4860::8888 2001:4860:4860::8844"
uci commit network
service network reload