简介
更换了新的宿主机之后,发现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同步一下就完事了
查了下资料,