본문 바로가기

리눅스

[리눅스] 우분투 22.04 systemd-resolved 데몬(서비스) 비활성화

728x90

우분투 22.04 systemd-resolved 데몬(서비스) 비활성화

테스트 환경

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

systemd-resolved 서비스 상태 확인

systemctl status systemd-resolved
$ systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-05-19 16:52:02 KST; 15h ago
       Docs: man:systemd-resolved.service(8)
             man:org.freedesktop.resolve1(5)
             https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
             https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
   Main PID: 840 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 4578)
     Memory: 8.6M
        CPU: 579ms
     CGroup: /system.slice/systemd-resolved.service
             └─840 /lib/systemd/systemd-resolved

May 19 16:52:01 uk-221 systemd[1]: Starting Network Name Resolution...
May 19 16:52:02 uk-221 systemd-resolved[840]: Positive Trust Anchors:
May 19 16:52:02 uk-221 systemd-resolved[840]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
May 19 16:52:02 uk-221 systemd-resolved[840]: Negative trust anchors: home.arpa 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa>
May 19 16:52:02 uk-221 systemd-resolved[840]: Using system hostname 'uk-221'.
May 19 16:52:02 uk-221 systemd[1]: Started Network Name Resolution.
netstat -nlp | grep systemd-resolve
$ netstat -nlp | grep systemd-resolve
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      866/systemd-resolve
udp        0      0 127.0.0.53:53           0.0.0.0:*                           866/systemd-resolve
unix  2      [ ACC ]     STREAM     LISTENING     29752    866/systemd-resolve  /run/systemd/resolve/io.systemd.Resolve

resolv.conf 심볼릭 링크 확인

$ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Apr 21 10:00 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
$ cat /etc/resolv.conf
# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad
search .

systemd-resolved 서비스 비활성화 및 중지

systemctl disable systemd-resolved
$ systemctl disable systemd-resolved
Removed /etc/systemd/system/dbus-org.freedesktop.resolve1.service.
Removed /etc/systemd/system/multi-user.target.wants/systemd-resolved.service.
systemctl stop systemd-resolved

심볼릭 링크 삭제

rm /etc/resolv.conf

resolv.conf 파일 생성 및 편집

cat <<EOF > /etc/resolv.conf
nameserver 168.126.63.1
nameserver 8.8.8.8
nameserver 1.1.1.1
EOF
728x90