AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / ubuntu / Perguntas / 1475085
Accepted
CB_Ron
CB_Ron
Asked: 2023-06-28 04:57:23 +0800 CST2023-06-28 04:57:23 +0800 CST 2023-06-28 04:57:23 +0800 CST

Servidor Ubuntu 22.04, como determino qual servidor DNS está em uso na linha de comando?

  • 772

Já li o link aqui . Eu tentei isso da resposta aceita nmcli device status , mas recebo este resultado sudo: nmcli: command not found. Então eu li este link. Eu tentei isso systemd-resolve --status | grep 'DNS Servers' , mas eu recebo este resultado sudo: systemd-resolve: command not found.

Alguém conhece um comando que funcione em 22.04?

networking
  • 1 1 respostas
  • 70 Views

1 respostas

  • Voted
  1. Best Answer
    mpboden
    2023-06-28T06:49:21+08:002023-06-28T06:49:21+08:00

    Com o Ubuntu Server 22.04, a rede é gerenciada com systemd-networkd (não NetworkManager). Defina suas configurações de rede com o Netplan

    A resolução de nomes DNS é fornecida por um serviço chamado systemd-resolved. Ele oferece resolução de DNS por meio de uma interface D-Bus, o serviço NSS de resolução (nss-resolve(8)) e um ouvinte de stub de DNS local em 127.0.0.53. Se você executar o comando , cat /etc/resolv.confverá que ele lista 127.0.0.53 como o servidor DNS. Este é o resolvedor de stub local.

    $ 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 localdomain
    

    Ao executar o comando , ls -l /etc/resolv.confvocê verá que ele se vincula a um arquivo que define o resolvedor de stub local:

    $ ls -l /etc/resolv.conf
    lrwxrwxrwx 1 root root 37 Mar 20 10:16 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
    

    Este é um comportamento normal. Ele armazena em cache as consultas de DNS localmente para resolver. Se uma consulta não estiver no cache, ela consultará todos os servidores DNS de uplink que foram entregues via DHCP ou definidos manualmente em seu arquivo de configuração Netplan. Para ver quais são seus servidores DNS de uplink, execute resolvectl status:

    $ resolvectl status
    Global
           Protocols: -LLMNR -mDNS -DNSOverTLS
                      DNSSEC=no/unsupported
    resolv.conf mode: stub
    
    Link 2 (eth0)
    Current Scopes: none
         Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS
                    DNSSEC=no/unsupported
    
    Link 3 (eth1)
    Current Scopes: none
         Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS
                    DNSSEC=no/unsupported
    
    Link 4 (bond0)
        Current Scopes: DNS
             Protocols: +DefaultRoute +LLMNR -mDNS
                        -DNSOverTLS DNSSEC=no/unsupported
    Current DNS Server: 192.168.10.1
           DNS Servers: 192.168.10.1
            DNS Domain: localdomain
    
    • 2

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Existe um comando para listar todos os usuários? Também para adicionar, excluir, modificar usuários, no terminal?

    • 9 respostas
  • Marko Smith

    Como excluir um diretório não vazio no Terminal?

    • 4 respostas
  • Marko Smith

    Como descompactar um arquivo zip do Terminal?

    • 9 respostas
  • Marko Smith

    Como instalo um arquivo .deb por meio da linha de comando?

    • 11 respostas
  • Marko Smith

    Como instalo um arquivo .tar.gz (ou .tar.bz2)?

    • 14 respostas
  • Marko Smith

    Como listar todos os pacotes instalados

    • 24 respostas
  • Martin Hope
    Flimm Como posso usar o docker sem sudo? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    led-Zepp Como faço para salvar a saída do terminal em um arquivo? 2014-02-15 11:49:07 +0800 CST
  • Martin Hope
    ubuntu-nerd Como descompactar um arquivo zip do Terminal? 2011-12-11 20:37:54 +0800 CST
  • Martin Hope
    TheXed Como instalo um arquivo .deb por meio da linha de comando? 2011-05-07 09:40:28 +0800 CST
  • Martin Hope
    Ivan Como listar todos os pacotes instalados 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    David Barry Como determino o tamanho total de um diretório (pasta) na linha de comando? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher "Os seguintes pacotes foram retidos:" Por que e como resolvo isso? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford Como os PPAs podem ser removidos? 2010-07-30 01:09:42 +0800 CST

Hot tag

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve