debian10关于dhcp renew失败的修复


简介

更换了新的宿主机之后,发现debian的dhcp 在renew的环节中会出现问题
以下是修复方案

dhclient进程

系统的dhclient进程命令为

/sbin/dhclient -4 -v -i -pf /run/dhclient.ens192.pid -lf /var/lib/dhcp/dhclient.ens192.leases -I -df /var/lib/dhcp/dhclient6.ens192.leases ens192

会出现可以接受发送renew的相关包,就是没用

而自己使用

/sbin/dhclient ens192

则可以正确的续约

处理方式

加入系统开机任务项即可

vim /lib/systemd/system/rc.local.service编辑这个文件

#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

[Install]
WantedBy=multi-user.target

vim /etc/rc.local
写入以下内容

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/sbin/dhclient ens192
exit 0

开机启动

systemctl daemon-reload && systemctl enable rc-local.service

结果失败离场

方法二

错错错!!!

安装的时候选用时区为china
的确是这样
cat /var/lib/dhcp/dhclient.leases
发现用的时间是utc
而我把timezone改成了本地时区
猜测是开机后用的还是utc,没有读这个,而后来的就使用的是用户的时区了。

更新

发现是vmtools的锅,只要安装了vmtools,dhclient就不能开机正常,所以就不安装vmtools吧,先狗着

最后

今天突然发现一台centos8.2也出现了这问题,就想到了可能是我的主机设置上出了什么问题
发现是esxi在设置时区的时候我设置成了Asia/china
把esxi vsphere全部改成UTC然后ntp同步一下就完事了

查了下资料,


文章作者: xyzz
文章链接: http://www.xyzzpwn.top
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 xyzz !
 上一篇
safari关于不安全链接的解决办法 safari关于不安全链接的解决办法
简介换了vsphere和esxi后,系统证书需要重新生效,发现chrome很好搞定vsphere,能用不安全的链接登陆esxi。safari是可以登陆vsphere不能打开esxi。这里记录了修复的过程 过程 首先在keyschains里面
2020-10-17
下一篇 
树莓派自控风扇 树莓派自控风扇
简介树莓派4b的自控风扇 主要信息系统: Debian-Pi-Aarch64 2020-06-22-v2020-2.0-U4-Release BaseOS Plus++三极管:S8050 NPN连接线:杜邦线公对母,母对母 连接方式风扇正极
2020-09-29
  目录