How to force dhclient to run?
I usually run with eth0 config'd statically from info in /etc/network/interfaces, but sometimes need to use a dhcp acquired config. Running dhclient just tells me it's now an upstart job and suggests running reload, but reload dhclient responds 'Unknown job: dhclient.'
How can I make it run?
2 Answers
Configuring an interface to use DHCP (client), just put this in your /etc/network/interfaces:
auto eth0
iface eth0 inet dhcpto avoid NetworkManager managing it. Restart NetworkManager to pick up on that:
# service network-manager restartIf you need to run dhclient manually after configuring it yourself using ifconfig or ip commands, you just can and I don't see how upstart is involved here.
For example:
Have it configured manually in /etc/network/interfaces:
auto eth0
iface eth0 inet manualThen the interface is down by default,
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr b4:b5:2f:xx BROADCAST MULTICAST MTU:1500 Metric:1so, bring it up with
# ifconfig eth0 up
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr b4:b5:2f:xx UP BROADCAST MULTICAST MTU:1500 Metric:1and start dhclient:
# dhclient eth0
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr b4:b5:2f:xx inet addr:192.168.0.134 Bcast:192.168.0.255 Mask:255.255.255.0 While everything gertvdijk says is true, the warning message is also real:
# dhclient eth0
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service smbd reload
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the reload(8) utility, e.g. reload smbd
#It doesn't keep the command from working though.
2