리눅스
우분투에서 DNS 서버를 정적으로 설정하는 방법
변군이글루
2015. 3. 9. 09:41
반응형
우분투에서 DNS 서버를 정적으로 설정하는 방법
/etc/resolv.conf에 DNS 설정 후 재부팅(네트워크 재시작)하게 되면 DNS 설정이 살아진다.
vim /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
고정으로 DNS 설정을 위해서는 /etc/network/interfaces 파일에 “dns-nameservers”로 설정해야 한다.
vim /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.2.247
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameservers 192.168.100.204 8.8.8.8 168.126.63.1
# The secondary network interface
auto eth1
iface eth1 inet static
address 192.168.56.103
netmask 255.255.255.0
resolv.conf 파일이 다시 생성되는 것을 방지하기 위해 /etc/resolv.conf 파일을 읽기 전용으로 설정합니다.
chattr +i /etc/resolv.conf
재부팅 후
cat /etc/resolv.conf
$ 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 192.168.100.204
nameserver 8.8.8.8
nameserver 168.126.63.1
이제 Ubuntu에서 정적 DNS 설정이 완료되었습니다. 새로운 DNS 서버가 적용되고 인터넷 연결에 해당 DNS 서버가 사용될 것입니다.
728x90
반응형