OS(운영체제)/리눅스(Linux)
Ubuntu 서버 resolv.conf 초기화되는 문제 해결
hippo 데브옵스
2024. 4. 1. 12:09
- Ubuntu에서 /etc/resolv.conf 파일이 초기화되는 현상이 발생 → Ubuntu 기본 세팅
- /etc/resolv.conf 초기화되지 않도록 하기 위해 조치사항
1. apt install 패키지 설치를 위해 /etc/resolve.conf에 nameserver 8.8.8.8 추가
$ vi /etc/resolv.conf
...생략...
nameserver 8.8.8.8
2. resolvconf 패키지 설치
$ apt install resolvconf -y
3. resolvconf 확인
- /etc/resolvconf 디렉토리 확인
- /run/resolveconf/resolv.conf 파일에 소프트링크
$ ls -al /etc/resolv.conf lrwxrwxrwx 1 root root 29 Apr 1 02:44 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
4. head 파일 수정
- resolve.conf 파일은 위에서부터 읽어들임
- nameserver 8.8.8.8이 /etc/resolv.conf 파일의 최하단에 위치하면 다른 nameserver 설정의 IP을 먼저 DNS 서버로 사용하고, 위 DNS가 비정상일 경우에 8.8.8.8을 통해 질의함
$ vi /etc/resolv.conf ...생략... nameserver 8.8.8.8
5. 서버 재부팅 후 재확인 → 정상적으로 유지 확인
$ vi /etc/resolv.conf
...생략...
nameserver 8.8.8.8
참고 자료 : [Solved][Ubuntu18.04] 서버 재부팅시 resolv.conf 초기화되는 문제 해결 :: Devader (tistory.com)