因此,每次我重新启动 ubuntu 服务器(虚拟 10.04,通过 Xencenter)时,我都必须调用 dhclient 才能访问互联网:
http://img813.imageshack.us/i/dhclient.png/
我需要更改什么才能自动访问互联网?抱歉发布图片,我正在使用 Xencenter,因此无法复制/粘贴控制台输出
编辑::
daniel@workwork:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.69.136
netmask 255.255.255.0
network 192.168.69.0
broadcast 192.168.69.255
gateway 192.168.69.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.69.120
dns-search workwork.com.au
daniel@workwork:~$ ifconfig
eth0 Link encap:Ethernet HWaddr ae:11:14:22:0a:03
inet6 addr: fe80::ac11:14ff:fe22:a03/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:85 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10496 (10.4 KB) TX bytes:13086 (13.0 KB)
Interrupt:32 Base address:0x6000
eth1 Link encap:Ethernet HWaddr b2:2c:40:f2:a0:fa
inet addr:192.168.69.167 Bcast:192.168.69.255 Mask:255.255.255.0
inet6 addr: fe80::b02c:40ff:fef2:a0fa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13448 errors:0 dropped:0 overruns:0 frame:0
TX packets:3100 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7679428 (7.6 MB) TX bytes:282286 (282.2 KB)
Interrupt:36 Base address:0xa100
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:179 errors:0 dropped:0 overruns:0 frame:0
TX packets:179 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:36905 (36.9 KB) TX bytes:36905 (36.9 KB)
daniel@workwork:/var/lib/dhcp3$ cat dhclient.leases
lease {
interface "eth1";
fixed-address 192.168.69.167;
filename "boot\\x86\\wdsnbp.com";
option subnet-mask 255.255.255.0;
option routers 192.168.69.1;
option dhcp-lease-time 28800;
option dhcp-message-type 5;
option domain-name-servers 192.168.69.120,192.168.69.121;
option dhcp-server-identifier 192.168.69.120;
option dhcp-renewal-time 14400;
option dhcp-rebinding-time 25200;
option domain-name "workwork.com.au";
renew 5 2011/03/18 07:36:53;
rebind 5 2011/03/18 11:35:39;
expire 5 2011/03/18 12:35:39;
}
lease {
interface "eth1";
fixed-address 192.168.69.167;
filename "boot\\x86\\wdsnbp.com";
option subnet-mask 255.255.255.0;
option routers 192.168.69.1;
option dhcp-lease-time 28800;
option dhcp-message-type 5;
option domain-name-servers 192.168.69.120,192.168.69.121;
option dhcp-server-identifier 192.168.69.120;
option dhcp-renewal-time 14400;
option dhcp-rebinding-time 25200;
option domain-name "workwork.com.au";
renew 5 2011/03/18 08:51:58;
rebind 5 2011/03/18 12:24:16;
expire 5 2011/03/18 13:24:16;
}
daniel@workwork:/var/lib/dhcp3$ cat dhclient.eth0.leases
daniel@workwork:/var/lib/dhcp3$
ifconfig eth1
之前和之后dhclient
http://img692.imageshack.us/i/prepost.png/
答案1
您可能需要查看租约(在我的 Ubuntu 上,它们存储在 中/var/lib/dhcp3
;查找*.lease
文件);我猜是您的某个配置设置(可能是 DNS 服务器)有误,并且dhclient
正在根据 DHCP 租约进行更正。您可以查看已保存的租约,并/etc/network/interfaces
在需要时使用它进行更新。
以下是租赁记录样本dhclient
:
lease {
interface "eth1";
fixed-address 10.211.55.15;
option subnet-mask 255.255.255.0;
option routers 10.211.55.1;
option dhcp-lease-time 1800;
option dhcp-message-type 5;
option domain-name-servers 10.211.55.1;
option dhcp-server-identifier 10.211.55.1;
option domain-name "localdomain";
renew 3 2011/03/16 23:17:44;
rebind 3 2011/03/16 23:32:10;
expire 3 2011/03/16 23:35:55;
}
答案2
/etc/network/interfaces
你的文件是什么样子的?
对于 DHCP,您的接口应按如下方式配置:
auto eth0
iface eth0 inet dhcp
如果这不起作用,则某些操作可能以错误的顺序开始;您可以通过dhclient
向 中添加命令来解决这个问题/etc/rc.local
。