哪个程序在debian squeeze上调用dhclient?

时间:2013-02-06 02:23:10

标签: debian dhcp

我很好奇哪个程序在Debian挤压时调用了dhclient?

我怀疑它是NetworkManager,但事实并非如此。 由于我已将其删除(apt-get删除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

我也在dhclient中查看/etc,但没有足够的提示(找不到来电者)。

如何在Debian Squeeze上调用dhclient程序?

3 个答案:

答案 0 :(得分:8)

它在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;
}

答案 1 :(得分:3)

ifupdown(配置文件:/etc/network/interfaces)。

答案 2 :(得分:2)

您必须禁用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应该消失了。