![dhclient 几秒后断开连接](https://linux22.com/image/923008/dhclient%20%E5%87%A0%E7%A7%92%E5%90%8E%E6%96%AD%E5%BC%80%E8%BF%9E%E6%8E%A5.png)
我一直在与我的 ubuntu 16 lts 服务器的界面作斗争,以便在启动时连接到 wifi。目前,我使用 wpa_supplicant 和 dhclient 进行连接。如果我手动执行这两项操作,则可以毫无问题地连接。当我想从启动时启动这两项操作时,似乎 wpa_supplicant 工作正常,但 dhclient 不行。我已使用以下配置设置了服务:
[Unit]
Description= DHCP Client
Before=network.target
[Service]
Type=simple
ExecStart=/sbin/dhclient wlp58s0 -v
ExecStop=/sbin/dhclient wlp58s0 -r
[Install]
WantedBy=multi-user.target
看起来它加载正常,连接成功,但几秒后就断开了...
● dhclient.service - DHCP Client
Loaded: loaded (/etc/systemd/system/dhclient.service; enabled; vendor preset: enabled)
Active: inactive (dead) since mar 2020-04-07 16:13:06 CEST; 18min ago
Process: 1862 ExecStop=/sbin/dhclient wlp58s0 -r (code=exited, status=0/SUCCESS)
Process: 809 ExecStart=/sbin/dhclient wlp58s0 -v (code=exited, status=0/SUCCESS)
Main PID: 809 (code=exited, status=0/SUCCESS)
abr 07 16:12:55 RB1B0-190625AB dhclient[809]: DHCPOFFER of 192.168.0.33 from 192.168.0.1
abr 07 16:12:55 RB1B0-190625AB dhclient[809]: DHCPREQUEST of 192.168.0.33 on wlp58s0 to 255.255.255.255 port 67 (xid=0x42ec0a9b)
abr 07 16:12:55 RB1B0-190625AB dhclient[809]: DHCPOFFER of 192.168.0.33 from 192.168.0.1
abr 07 16:12:55 RB1B0-190625AB dhclient[809]: DHCPACK of 192.168.0.33 from 192.168.0.1
abr 07 16:12:55 RB1B0-190625AB dhclient[809]: DHCPACK of 192.168.0.33 from 192.168.0.1
abr 07 16:13:05 RB1B0-190625AB dhclient[809]: bound to 192.168.0.33 -- renewal in 42791 seconds.
abr 07 16:13:05 RB1B0-190625AB dhclient[809]: bound to 192.168.0.33 -- renewal in 42791 seconds.
abr 07 16:13:05 RB1B0-190625AB dhclient[1862]: Killed old client process
abr 07 16:13:05 RB1B0-190625AB dhclient[1862]: Killed old client process
abr 07 16:13:06 RB1B0-190625AB dhclient[1862]: DHCPRELEASE on wlp58s0 to 192.168.0.1 port 67 (xid=0x636812e7)
系统日志中有更多详细信息,看来绑定没问题
Apr 7 16:13:05 RB1B0-190625AB dhclient[809]: bound to 192.168.0.33 -- renewal in 42791 seconds.
Apr 7 16:13:05 RB1B0-190625AB dhclient[809]: bound to 192.168.0.33 -- renewal in 42791 seconds.
Apr 7 16:13:05 RB1B0-190625AB dhclient[1862]: Killed old client process
Apr 7 16:13:05 RB1B0-190625AB dhclient[1862]: Killed old client process
Apr 7 16:13:06 RB1B0-190625AB dhclient[1862]: DHCPRELEASE on wlp58s0 to 192.168.0.1 port 67 (xid=0x636812e7)
首先,似乎所有事情都有重复的消息。我认为这不正常,我一直在寻找可能的重复进程,但似乎并非如此。
另外,我粘贴了我的网络/接口
allow-hotplug wlp58s0
iface wlp58s0 inet dhcp
wpa-driver wext
#pre-up killall -q wpa_supplicant
wpa-roam /etc/wpa_supplicant.conf