由于某种原因我的小型计算机没有IP地址,所以我执行了sudo ifdown eth2
以下命令sudo ifup eth2
。接下来是一场长达 5 分钟的恩怨对决,我的客户端与服务器战斗,看谁更顽固。最后它终于得到了一个 IP 地址,但不是它一直请求的 IP 地址。什么会导致这种战斗,我该如何重新配置来避免它?
dhclient.conf
遵循日志输出。
Nov 5 14:23:36 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 6 (xid=0x1c08c5d8)
Nov 5 14:23:42 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 12 (xid=0x1c08c5d8)
Nov 5 14:23:54 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 7 (xid=0x1c08c5d8)
Nov 5 14:23:56 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x1c08c5d8)
Nov 5 14:23:56 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:23:56 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x1c08c5d8)
Nov 5 14:23:56 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x19021763)
Nov 5 14:23:56 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x19021763)
Nov 5 14:23:56 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:23:56 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x19021763)
Nov 5 14:23:59 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x19021763)
Nov 5 14:23:59 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x19021763)
Nov 5 14:24:04 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x19021763)
Nov 5 14:24:04 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x19021763)
Nov 5 14:24:11 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x37e59f2f)
Nov 5 14:24:11 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x37e59f2f)
Nov 5 14:24:11 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:24:11 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x37e59f2f)
Nov 5 14:24:14 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x37e59f2f)
Nov 5 14:24:14 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x37e59f2f)
Nov 5 14:24:17 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x37e59f2f)
Nov 5 14:24:17 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x37e59f2f)
Nov 5 14:24:24 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x41702f49)
Nov 5 14:24:27 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 6 (xid=0x41702f49)
Nov 5 14:24:27 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x41702f49)
Nov 5 14:24:27 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:24:27 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x41702f49)
Nov 5 14:24:30 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x41702f49)
Nov 5 14:24:30 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x41702f49)
Nov 5 14:24:33 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x41702f49)
Nov 5 14:24:33 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x41702f49)
Nov 5 14:24:41 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x43246040)
Nov 5 14:24:41 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x43246040)
Nov 5 14:24:41 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:24:41 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x43246040)
Nov 5 14:24:44 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x43246040)
Nov 5 14:24:44 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x43246040)
Nov 5 14:24:51 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x43246040)
Nov 5 14:24:51 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x43246040)
Nov 5 14:25:00 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x6caca5f6)
Nov 5 14:25:01 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x6caca5f6)
Nov 5 14:25:01 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:25:01 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x6caca5f6)
Nov 5 14:25:04 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x6caca5f6)
Nov 5 14:25:04 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x6caca5f6)
Nov 5 14:25:11 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x6caca5f6)
Nov 5 14:25:11 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x6caca5f6)
Nov 5 14:25:19 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x1f6963d4)
Nov 5 14:25:19 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x1f6963d4)
Nov 5 14:25:19 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:25:19 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x1f6963d4)
Nov 5 14:25:22 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x1f6963d4)
Nov 5 14:25:22 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x1f6963d4)
Nov 5 14:25:30 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x7c056f7e)
Nov 5 14:25:31 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x7c056f7e)
Nov 5 14:25:31 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:25:31 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x7c056f7e)
Nov 5 14:25:34 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x7c056f7e)
Nov 5 14:25:34 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x7c056f7e)
Nov 5 14:25:39 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x7c056f7e)
Nov 5 14:25:39 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x7c056f7e)
Nov 5 14:25:48 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0xab17b6d)
Nov 5 14:25:48 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0xab17b6d)
Nov 5 14:25:48 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:25:48 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0xab17b6d)
Nov 5 14:25:51 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0xab17b6d)
Nov 5 14:25:51 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0xab17b6d)
Nov 5 14:25:54 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0xab17b6d)
Nov 5 14:25:54 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0xab17b6d)
Nov 5 14:25:58 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0xab17b6d)
Nov 5 14:25:58 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0xab17b6d)
Nov 5 14:26:07 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x7c7ee3b0)
Nov 5 14:26:07 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x7c7ee3b0)
Nov 5 14:26:07 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:26:07 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x7c7ee3b0)
Nov 5 14:26:10 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x7c7ee3b0)
Nov 5 14:26:10 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x7c7ee3b0)
Nov 5 14:26:18 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x7a8ec50)
Nov 5 14:26:18 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x7a8ec50)
Nov 5 14:26:18 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:26:18 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x7a8ec50)
Nov 5 14:26:21 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x7a8ec50)
Nov 5 14:26:21 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x7a8ec50)
Nov 5 14:26:29 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x53e10240)
Nov 5 14:26:29 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x53e10240)
Nov 5 14:26:29 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:26:29 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x53e10240)
Nov 5 14:26:32 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x53e10240)
Nov 5 14:26:32 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x53e10240)
Nov 5 14:26:40 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x3920325e)
Nov 5 14:26:40 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x3920325e)
Nov 5 14:26:40 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:26:40 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x3920325e)
Nov 5 14:26:43 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x3920325e)
Nov 5 14:26:51 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x296d0094)
Nov 5 14:26:51 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x296d0094)
Nov 5 14:26:51 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:26:51 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x296d0094)
Nov 5 14:26:54 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x296d0094)
Nov 5 14:26:54 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x296d0094)
Nov 5 14:26:58 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x296d0094)
Nov 5 14:26:58 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x296d0094)
Nov 5 14:27:09 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x62ff65c6)
Nov 5 14:27:09 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x62ff65c6)
Nov 5 14:27:09 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:27:09 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x62ff65c6)
Nov 5 14:27:12 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x62ff65c6)
Nov 5 14:27:12 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x62ff65c6)
Nov 5 14:27:19 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x62ff65c6)
Nov 5 14:27:19 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x62ff65c6)
Nov 5 14:27:31 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x3c915dc9)
Nov 5 14:27:31 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x3c915dc9)
Nov 5 14:27:31 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:27:31 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x3c915dc9)
Nov 5 14:27:34 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x3c915dc9)
Nov 5 14:27:35 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x3c915dc9)
Nov 5 14:27:39 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x3c915dc9)
Nov 5 14:27:39 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x3c915dc9)
Nov 5 14:27:49 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x68eff7c8)
Nov 5 14:27:49 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x68eff7c8)
Nov 5 14:27:49 nvidia dhclient: DHCPOFFER of 172.20.40.71 from 172.20.40.1
Nov 5 14:27:49 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x68eff7c8)
Nov 5 14:27:52 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x68eff7c8)
Nov 5 14:27:52 nvidia dhclient: DHCPNAK from 172.20.40.1 (xid=0x68eff7c8)
Nov 5 14:27:56 nvidia dhclient: DHCPREQUEST of 172.20.40.71 on eth2 to 255.255.255.255 port 67 (xid=0x68eff7c8)
Nov 5 14:28:04 nvidia dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3 (xid=0x53f01e35)
Nov 5 14:28:06 nvidia dhclient: DHCPREQUEST of 172.20.44.15 on eth2 to 255.255.255.255 port 67 (xid=0x53f01e35)
Nov 5 14:28:06 nvidia dhclient: DHCPOFFER of 172.20.44.15 from 172.20.40.1
Nov 5 14:28:06 nvidia dhclient: DHCPACK of 172.20.44.15 from 172.20.40.1
Nov 5 14:28:06 nvidia dhclient: bound to 172.20.44.15 -- renewal in 1733 seconds.
这是dhclient.conf
(删除了大部分注释行):
# Configuration file for /sbin/dhclient, which is included in Debian's
# dhcp3-client package.
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
send dhcp-requested-address 172.20.44.15;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers,
dhcp6.fqdn, dhcp6.sntp-servers;
答案1
这是每次都会发生的事情吗?
看起来 dhcp 服务器尝试将地址 172.20.44.71 提供给您的接口 eth0,但遭到拒绝。然后,当服务器提供地址 172.20.44.15 时,就会有一个 DHCPACK 接受该地址。
在你的配置文件中,有这样一行:
发送 dhcp 请求地址 172.20.44.15;
您真的需要/想要使用这个 IP 地址吗?您是否尝试过删除这条线并进行一些测试?