4

I'm curious about which program invokes dhclient on Debian squeeze?

I suspect it's NetworkManager but it's not true. Since I have removed it (apt-get remove NetworkManager) and rebooted the computer.

The dhclient program runs as usual. See:

~$ 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

I also grep for dhclient in /etc but there are no sufficient hints (not found the caller).

How is the dhclient program being invoked on Debian Squeeze?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
robertchen
  • 441
  • 2
  • 6
  • 13

3 Answers3

8

It's coded in ifupdown.

http://packages.debian.org/stable/ifupdown

Download the souce and

make inet.c

Check the function 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;
}
robertchen
  • 441
  • 2
  • 6
  • 13
3

ifupdown (config file: /etc/network/interfaces).

hobbs
  • 223,387
  • 19
  • 210
  • 288
2

You have to disable dhcp and set a static ip address for your interface instead

This can be done in /etc/network/interfaces

Change:

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet dhcp

To:

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
  address 192.168.0.1
  netmask 255.255.255.0

After a reboot the dhclient should be gone.

philippe lhardy
  • 3,096
  • 29
  • 36
christophrus
  • 1,170
  • 2
  • 14
  • 27