In Ubuntu if DHCP is enabled, DHCP server will also supply a DNS server and gateway.
In some circumstances, you may want use a static DNS.
Question is: how to enable DHCP with static DNS servers?
Edit /etc/dhcp3/dhclient.conf
Add or replace a line
prepend domain-name-servers your.name.server.ipaddr;
where your.name.server.ipaddr is replaced by your desired name server.
You can list multiple servers in sequence by using a comma-separated
list. Don't forget the semi-colon at the end of the line.
This tells dhclient to prepend these servers to whatever list it gets
from the DHCP service when writing the /etc/resolv.conf. You'll see
them (listed before the others) in the /etc/resolv.conf after DHCP
completes. Normal resolution semantics then apply to this list, namely
these servers will be used first; if they fail to respond, the client
will proceed to following ones, but subsequent servers are not used if
any returns an actual result, even if it is NXDOMAIN (i.e. not found).
You can entirely supersede the servers provided by the DHCP service using
supersede domain-name-servers your.name.server.ipaddr;
You can also edit the 'request' line and select what information you want to get from DHCP.
阅读(1096) | 评论(0) | 转发(0) |