1

I started dhclient with:

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.

Looks like it worked, but ifconfig doesn't show the address:

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
  • Is there a way to fix it?
  • For my current test, 192.168.1.199 answer to ping, but sometimes it doesn't.

-- Edit --

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

auto enp4s0
iface enp4s0 inet manual
  • I start dhclient manually

-- Edit --

 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
  • Check whether the enp4s0 interface is configured to take ipv4 from dhcp or static IP is assigned to the interface. – Abhik Bose Dec 27 '17 at 9:13
  • It's manual - I start dhclient manually – hudac Dec 27 '17 at 9:15
  • 1
    What does ip addr say? Why are you running dhclient on the DHCP server (192.168.1.1)? – Johan Myréen Dec 27 '17 at 9:16
  • I posted the output of ip addr. This is not the dhcp server, that's just the default ip before getting a new one from dhclient – hudac Dec 27 '17 at 10:11
  • 1
    Now we can see that the host does indeed have 192.168.1.199 as it's IP address, but as a secondary. The original 192.168.1.1 is still there as primary. Where does it get this "default" address from? – Johan Myréen Dec 27 '17 at 10:46
1

Thanks to @Johan Myréen I realized through the command 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

That for some reason the interface enp4s0 has a primary and secondary addresses, where the dhcp ip is on the secondary address for some unknown reason.

Though I don't know the reason - what helps solve this issue is calling

ip addr flush dev enp4s0

Which flush the interface - then I start clean when allocating the dhcp address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.