본문 바로가기
OLD/OS

[CentOS] DNS 설정

by Hoft 2014. 3. 9.

보통

/etc/resolve.conf 파일의 내용을 수정하여 DNS를 설정


ex)

[root@localhost etc]# vi resolv.conf 



1

2

3

 # Generated by NetworkManager
nameserver 168.126.63.1
nameserver 168.126.63.2



[root@localhost ~]# /etc/rc.d/init.d/network restart


network 재시작을 하고나서 dns를 못찾는 것을 확인하고,


[root@localhost ~]# ping www.google.com
ping: unknown host www.google.com


resolv.conf 파일의 내용을 다시 보면 다음과 같다


1

2

3

4

5

6

7

8

9

 # Generated by NetworkManager


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com


이 경우 나와있는 안내와 같이

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
파일의 내용안에 DNS를 넣어줘야 한다.



1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

 DEVICE=eth0
TYPE=Ethernet
UUID=6437e7ce-8f1c-40fd-9f41-462ff3c2f727
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.219.219
GATEWAY=192.168.219.1
NETMASK=255.255.255.0
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:16:EC:17:BA:06
PEERDNS=yes
PEERROUTES=yes
DNS1=168.126.63.1
DNS2=168.126.63.2




















resolv.conf 파일의 내용이 ifcfg-eth0 파일의 내용을 참조하게 되어있다.







'OLD > OS' 카테고리의 다른 글

[CentOS] 네트워크 인터페이스 설정  (0) 2014.03.09
[FreeBSD] 인터페이스 설정  (0) 2013.10.21
[Ubuntu] 우분투 IPv6라우터로 사용하기.  (0) 2013.10.21

댓글