我很好奇哪个程序会在Debian squeeze上调用dhclient?
我怀疑是NetworkManager,但这不是真的。因为我已经删除了它(apt-get remove NetworkManager)并重新启动了计算机。
dhclient程序照常运行。请参见:
~$ ps aux|grep dhclient
root 2042 0.0 0.0 2332 532 ? Ss 09:47 0:00 dhclient -v -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0我还在/etc中对dhclient执行grep,但是没有足够的提示(没有找到调用者)。
如何在Debian Squeeze上调用dhclient程序?
发布于 2013-02-07 12:40:27
它是用ifupdown编码的。
http://packages.debian.org/stable/ifupdown
下载源码并
make inet.c
检查函数dhcp_up():
static int dhcp_up(interface_defn *ifd, execfn *exec) {
{
if (!execute("[[ifconfig %iface% hw %hwaddress%]]", ifd, exec)) return 0;
}
if ( execable("/sbin/dhclient3") ) {
if (!execute("dhclient3 -pf /var/run/dhclient.%iface%.pid -lf /var/lib/dhcp3/dhclient.%iface%.leases %iface%", ifd, exec)) return 0;
}
else if ( execable("/sbin/dhclient") ) {
if (!execute("dhclient -v -pf /var/run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases %iface%", ifd, exec)) return 0;
}
else if ( execable("/sbin/pump") && mylinuxver() >= mylinux(2,1,100) ) {
if (!execute("pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]]", ifd, exec)) return 0;
}
else if ( execable("/sbin/udhcpc") && mylinuxver() >= mylinux(2,2,0) ) {
if (!execute("udhcpc -n -p /var/run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] [[-c %client%]]", ifd, exec)) return 0;
}
else if ( execable("/sbin/dhcpcd") ) {
if (!execute("dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] [[-l %leasetime%]] %iface%", ifd, exec)) return 0;
}
return 1;
}发布于 2013-02-06 11:17:29
ifupdown (配置文件:/etc/network/interfaces)。
发布于 2013-02-06 11:13:54
您必须禁用dhcp并为您的接口设置静态ip地址
这可以在/etc/network/interfaces中完成
更改:
# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet dhcp至:
# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0重新启动后,dhclient应该会消失。
https://stackoverflow.com/questions/14720571
复制相似问题