/etx/systemd/resolved.conf は、ubuntu の DNS 解決サービス構成ファイルです。systemd は、ubuntu のシステムおよびサービス構成ディレクトリです。
ステップ 1—resolved.conf パラメータを変更する
管理者権限で /systemd/resolved.conf を開きます
sudo nano /etc/systemd/resolved.conf
次のように変更します。
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the resolved.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# Use 'systemd-analyze cat-config systemd/resolved.conf' to display the full config.
#
# See resolved.conf(5) for details.
[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
# Google: 8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
# Quad9: 9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
DNS=1.1.1.1
FallbackDNS=9.9.9.9
#Domains=
DNSSEC=allow-downgrade
DNSOverTLS=opportunistic
#MulticastDNS=no
#LLMNR=no
Cache=no-negative
#CacheFromLocalhost=no
DNSStubListener=yes
#DNSStubListenerExtra=
ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no
パラメータの具体的な意味については、ubuntu のマニュアルを参照してください。
ステップ2—DNSサービスを再起動します
systemctl restart systemd-resolved #重置DNS服务
systemctl enable systemd-resolved #开机自启动
solvectl は DNS コマンドです。ステータスを表示するには status パラメータを使用します。
Brief1—ubuntu システムコールライブラリsolvectl&systemctlの分析
分析サービスのためにresolvectlが呼び出されますが、ステータスの表示とパラメータのリセットのコマンドのみがPythonライブラリで実現できます。
systemctl はシステムコールであり、
メタコマンドとメタファイル
コマンドが順に存在します マシンコマンド—マシンコマンドの表示
ジョブコマンド—ジョブの表示、ジョブ
チェックのキャンセル、環境変数の変更システムおよびサービス管理コマンド— -
システム マネージャ (呼び出し) コマンド用に
システムを構成および実行します
step3——時間チョッパー
より効率的に作業するために、必ず次のコマンドを実行してください~~
サービスの運営
サービスを開始します: systemctl start vsftpd.service
サービスを閉じます: systemctl stop vsftpd.service
サービスを再起動します: systemctl restart vsftpd.service
サービスのステータスを表示します: systemctl status vsftpd.service
起動時にサービスを有効にします: systemctl enable vsftpd.service
起動時にサービスを無効にします: systemctl disable vsftpd.service
サービスが開始されているかどうかを確認します: systemctl is-enabled vsftpd.service
開始されたサービスのリストを表示します: systemctl list-unit-files|grep が有効になっています
起動に失敗したサービスのリストを表示します: systemctl --failed