特殊:Badtitle/NS100:StaticDnsWithDhcp:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Oneleaf留言 | 贡献
New page: {{From|https://help.ubuntu.com/community/StaticDnsWithDhcp}} {{Languages|php5}} category:UbuntuHelp
 
Wikibot留言 | 贡献
无编辑摘要
 
(未显示2个用户的3个中间版本)
第1行: 第1行:
{{From|https://help.ubuntu.com/community/StaticDnsWithDhcp}}
{{From|https://help.ubuntu.com/community/StaticDnsWithDhcp}}
{{Languages|php5}}
{{Languages|UbuntuHelp:StaticDnsWithDhcp}}
Parent: [[UbuntuHelp:InternetAndNetworking| 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 <code><nowiki>/etc/network/interfaces</nowiki></code>
In that file you find the entry for your interface. If your interface is eth0, then look for the following lines:
<pre><nowiki>
auto eth0
iface eth0 inet dhcp</nowiki></pre>
Add one line, so it looks like:
<pre><nowiki>
auto eth0
iface eth0 inet dhcp
dns-nameservers ip.address.of.nameserver</nowiki></pre>
Run
<pre><nowiki>
sudo invoke-rc.d networking restart</nowiki></pre>
To make the changes effective
If you do not use ifupdown, you need to edit <code><nowiki>/etc/dhcp3/dhclient.conf</nowiki></code>
Find the lines
<pre><nowiki>
#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;
</nowiki></pre>
And change them to
<pre><nowiki>
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;
</nowiki></pre>
Replace 1.2.3.4 and 1.2.3.5 with the addresses of your DNS servers.
Run
<pre><nowiki>
sudo invoke-rc.d networking restart</nowiki></pre>
To make the changes effective:


[[category:UbuntuHelp]]
[[category:UbuntuHelp]]

2007年12月6日 (四) 10:55的最新版本

{{#ifexist: :StaticDnsWithDhcp/zh | | {{#ifexist: StaticDnsWithDhcp/zh | | {{#ifeq: {{#titleparts:StaticDnsWithDhcp|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:StaticDnsWithDhcp|1|-1|}} | zh | | }}

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: