Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux 查看與修改 DNS 設定:resolv.conf、nslookup、dig 三大工具實戰

編輯:關於 Linux

DNS(Domain Name System)負責域名解析。生產環境建議配置主從兩組 DNS。本文介紹三種查看 DNS 的方法與修改設定步驟。

查看 DNS 設定

  1. 檢視 /etc/resolv.conf
    cat /etc/resolv.conf
    # nameserver 192.168.xxx.xxx
  2. 使用 nslookup
    nslookup 127.0.0.1 | grep Server
    # Server: 192.168.xxx.xxx
  3. 使用 dig
    dig
    # 輸出包含 SERVER: 192.168.xxx.xxx#53(192.168.xxx.xxx)

修改 DNS

編輯 /etc/resolv.conf(或永久生效請修改網路介面設定檔 /etc/sysconfig/network-scripts/ifcfg-eth0 加入 DNS1=、DNS2=):

nameserver 8.8.8.8
nameserver 114.114.114.114

修改即時生效,無需重啟服務。

Copyright © Windows教程網 All Rights Reserved