
DNS 이름에 대한 정보를 찾을 때 DNS 클라이언트가 IP 번호가 존재하지 않는 경우에도 이를 반환하도록 하는 방법이 Linux에 있습니까?
테스트 환경을 만들고 있는데 존재하지 않는 도메인 이름을 확인할 수 있기를 원합니다.
호스트 파일에서 이 작업을 수행할 수 있다는 것을 알고 있지만 찾으려는 모든 도메인 이름에 대해 이 파일을 편집하고 싶지는 않습니다.
내 질문에 대한 추가 설명은 다음과 같습니다.
시나리오 1: 실제 IP 번호를 google.com
찾아 얻기 위해 DNS 에 핑을 보냅니다 .google.com
시나리오 2: ping nonexstiantdoamin.com
을 실행하면 조회가 실패하는 대신 로컬 IP 번호가 반환됩니다.
답변1
보세요DNS. -H
호스트를 추가할 수 있는 옵션이 있습니다 . 매뉴얼 페이지에서:
-H, --addn-hosts=<file>
Additional hosts file. Read the specified file as well as
/etc/hosts. If -h is given, read only the specified file. This
option may be repeated for more than one additional hosts file.
If a directory is given, then read all the files contained in
that directory.