dhclient 说它绑定到地址 - 但 ifconfig 没有

dhclient 说它绑定到地址 - 但 ifconfig 没有

我开始dhclient于:

syslog:

...
Dec 27 03:26:03 HOST dhclient[13412]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 3 (xid=0x859ef640)
Dec 27 03:26:03 HOST dhclient[13435]: DHCPREQUEST of 192.168.1.199 on enp4s0 to 255.255.255.255 port 67 (xid=0x40f69e85)
Dec 27 03:26:03 HOST dhclient[13435]: DHCPOFFER of 192.168.1.199 from 192.168.1.1
Dec 27 03:26:03 HOST dhclient[13435]: DHCPACK of 192.168.1.199 from 192.168.1.1
Dec 27 03:26:03 HOST dhclient[13435]: bound to 192.168.1.199 -- renewal in 1045201 seconds.

看起来好像有效,但ifconfig没有显示地址:

ifconfig enp4s0
enp4s0    Link encap:Ethernet  HWaddr 00:08:a2:48:48:48
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::208:a2ff:fe0c:f648/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1189 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:135707 (135.7 KB)  TX bytes:2264 (2.2 KB)
          Memory:dfd00000-dfd1ffff
  • 有办法解决吗?
  • 对于我当前的测试,192.168.1.199 会回答ping,但有时不会。

- 编辑 -

cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto enp4s0
iface enp4s0 inet manual
  • dhclient手动启动

- 编辑 -

 ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
7: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:08:a2:48:48:48 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global enp4s0
       valid_lft forever preferred_lft forever
    inet 192.168.1.199/24 brd 192.168.1.255 scope global secondary enp4s0
       valid_lft forever preferred_lft forever
    inet6 fe80::208:a2ff:fe0c:f648/64 scope link
       valid_lft forever preferred_lft forever

答案1

感谢@Johan Myréen 我通过命令意识到ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
7: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:08:a2:48:48:48 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global enp4s0
       valid_lft forever preferred_lft forever
    inet 192.168.1.199/24 brd 192.168.1.255 scope global secondary enp4s0
       valid_lft forever preferred_lft forever
    inet6 fe80::208:a2ff:fe0c:f648/64 scope link
       valid_lft forever preferred_lft forever

由于某种原因,该接口enp4s0有一个基本的中学地址,其中dhcpip 位于中学由于某种未知原因的地址。

虽然我不知道原因 - 有助于解决这个问题的是调用

ip addr flush dev enp4s0

哪个刷新接口 - 然后我开始清洁当分配DHCP地址

相关内容