Ubuntu의 DHCP 서버에서 DNS 무시

Ubuntu의 DHCP 서버에서 DNS 무시

파일 DNS에 정적으로 설정 했습니다 ./etc/resolvconf/resolv.conf.d/base

nameserver 8.8.8.8
nameserver 8.8.4.4

하지만 내 컴퓨터는 여전히 DHCP에서 DNS를 받습니다. 내 컴퓨터는 다음과 같습니다 /etc/resolv.conf.

nameserver 192.168.100.2 
nameserver 8.8.8.8
nameserver 8.8.4.4

DNS서버 에서 DHCP얻은 정보를 무시하는 방법은 무엇입니까 ?

답변1

다음 줄을 다음 줄에 추가할 수 있습니다 /etc/dhcp/dhclient.conf.

supersede domain-name-servers 8.8.8.8, 8.8.4.4;

그런 다음 네트워크를 다시 시작하거나 실행 dhclient하여 변경합니다.

에서 man dhclient.conf:

The supersede statement

       supersede [ option declaration ];

       If for some option the client should always  use  a  locally-configured
       value  or  values rather than whatever is supplied by the server, these
       values can be defined in the supersede statement.

답변2

그 안에 스크립트를 넣으세요 /etc/dhcp/dhclient-enter-hooks.d:

make_resolv_conf() { : ; }

실행 가능하게 만드세요. 완벽한. resolv.conf를 불변으로 만드는 것 외에도 이는 dhclient가 resolv.conf를 손상시키는 것을 방지하기 위해 내가 찾은 유일한 100% 신뢰할 수 있는 방법입니다.

관련 정보