<< netty/MemcacheClient.java at master · netty/netty · GitHub | 首页 | Java nio的一个严重BUG,导致cpu 100% - 代码之美 - 博客频道 - CSDN.NET >>

How To: Make Sure /etc/resolv.conf Never Get Updated By DHCP Client

Option # 3: Configure dhclient.conf

/etc/dhclient.conf or /etc/dhcp/dhclient.conf file contains configuration information for dhclient. You can turn on or off DNS update and other options for specific interface or all interface using this file. The man pages for DHCLIENT.CONF and DHCP-OPTIONS point out that in dhclient.conf, you should add this:

supersede domain-name-servers 202.54.1.2, 199.2.3.4;

OR

prepend domain-name-servers 1.2.3.4, 1.2.3.5;

Here is a sample config for you:

       timeout 60;
       retry 60;
       reboot 10;
       select-timeout 5;
       initial-interval 2;
       reject 192.33.137.209;
       interface "eth0" {
           send host-name "laptop-area51.nixcraft.net.in.home";
           send dhcp-client-identifier 00:30:48:33:BC:32;
           send dhcp-lease-time 3600;
           supersede domain-search "net.in.home", "cyberciti.biz", "vpx.nixcraft.net.in";
           prepend domain-name-servers 8.8.8.8, 127.0.0.1;
           request subnet-mask, broadcast-address, time-offset, routers,
                domain-search, domain-name, domain-name-servers, host-name;
           require subnet-mask, domain-name-servers;
       }
 #ifdown eth0 && ifup eth0
 
Ubuntu Static Dns With Dhcp :

Parent: Internet and Networking

The default setup of Ubuntu does not make it easy to use static DNS servers while using DHCP. If you use the standard ubuntu way of networking (ifupdown), you can edit /etc/network/interfaces

In that file you find the entry for your interface. If your interface is eth0, then look for the following lines:

auto eth0
iface eth0 inet dhcp

Add one line, so it looks like:

auto eth0
iface eth0 inet dhcp
dns-nameservers ip.address.of.nameserver

Run

sudo invoke-rc.d networking restart

To make the changes effective

If you do not use ifupdown, you need to edit /etc/dhcp3/dhclient.conf

Find the lines

#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, host-name,
        netbios-name-servers, netbios-scope;

And change them to

prepend domain-name-servers 1.2.3.4, 1.2.3.5;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, host-name,
        netbios-name-servers, netbios-scope;

Replace 1.2.3.4 and 1.2.3.5 with the addresses of your DNS servers.

Run

sudo invoke-rc.d networking restart

To make the changes effective:

阅读全文……

标签 : ,



发表评论 发送引用通报