Linux服务udhcpc (相对于调用ip up和udhcpc的/etc/init.d/S40network服务的本地DHCP )的响应性在提示符登录前后有所不同。
当通过/etc/init.d/rcS (引导序列)调用时,udhcpc不分配IP地址:
udhcpc: no lease, failing但是,一旦登录,使用根帐户,S40network restart将很快通过udhcpc提供一个IP地址。
/etc/inittab是正常的和基本的:
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
#
# Note: BusyBox init doesn't support runlevels. The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id == tty to run on, or empty for /dev/console
# runlevels == ignored
# action == one of sysinit, respawn, askfirst, wait, and once
# process == program to run
# Startup the system
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts
::sysinit:/bin/mkdir -p /dev/shm
::sysinit:/bin/mount -a
::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS
# Put a getty on the serial port
ttyPS0::respawn:/sbin/getty -L ttyPS0 0 vt100 # GENERIC_SERIAL
# Stuff to do for the 3-finger salute
#::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r我们该怎么解释?
发布于 2020-11-03 15:39:37
我遇到了与您相同的问题,在引导期间它会失败,但是如果在启动之后手动调用它,我会很好地工作。在检查各种日志时,我意识到在接口出现时,udhcpc似乎正在初始化,因此,最初的几个发现实际上并没有在接口上运行。
理想情况下,我会使udhcpc在界面稳定之后才能启动,但由于我不知道如何实现,所以我只增加了udhcpc的尝试次数。通常情况下,它会在4-5次尝试后得到一个IP,但我将限制增加到10次,以覆盖任何边缘情况。
将下面的第二行添加到/etc/network/interfaces
iface eth0 inet dhcp
udhcpc_opts -t 10 #sets max retries to 10
#rest of config paramshttps://unix.stackexchange.com/questions/439559
复制相似问题