우분투 DNS 바꾸기

확인

현재 설정을 다음의 명령으로 알아볼 수 있다.

$ sudo nslookup server 
Server:		12.34.56.78
Address:	12.34.56.78#53

** server can't find server: NXDOMAIN
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 12.34.56.78

변경

먼저 네트워크 장비의 이름 확인

$ cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s25
iface enp0s25 inet static
    address 192.168.0.6
    netmask 255.255.255.0
    gateway 192.168.0.1
    dns-nameservers 168.126.63.1 168.126.63.2 8.8.8.8 8.8.4.4
    up ethtoo -s enp0s25 wol g

장비 이름이 enp0s25 이므로

 echo "nameserver 8.8.8.8" | sudo resolvconf -a enp0s25.inet

재확인

$ sudo nslookup server
Server:		8.8.8.8
Address:	8.8.8.8#53

** server can't find server: NXDOMAIN
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8

역링크