0

I was doing some dhcp tasks for homework, and in one exercise I needed to release the IP on one client, to then in the server with tcpdump capture the packages describing the whole DHCP communication.
This worked just fine of course, the thing is that my client got assigned 2 IPs, the old one and the new one.

I don't really need to know this for my tasks but I was just curious about why an interface can have double IPs, and how could I release just one of them.

I'll show you the ip a output of the client for further info

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:8d:c0:4d brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
       valid_lft 81584sec preferred_lft 81584sec
    inet6 fe80::a00:27ff:fe8d:c04d/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:e8:5c:2a brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.10/24 brd 192.168.100.255 scope global dynamic eth1
       valid_lft 16802sec preferred_lft 16802sec
    inet 192.168.100.11/24 brd 192.168.100.255 scope global secondary dynamic eth1
       valid_lft 19310sec preferred_lft 19310sec
    inet6 fe80::a00:27ff:fee8:5c2a/64 scope link 
       valid_lft forever preferred_lft forever

PS

I wondered if maybe the old IP just wouldn't work now, and maybe ip a was just showing a kind of "history", but both IPs work. But still, I don't know why this is allowed.

2
  • What DHCP client software were you using on this system? Commented Oct 20, 2019 at 19:21
  • I think that you are talking about dhclient maybe? That's how I got the configuration Commented Oct 20, 2019 at 19:33

1 Answer 1

2

I was just curious about why an interface can have double IPs

An interface can have any number of IP addresses it needs, from zero to hundreds.

Though it is unusual for a DHCP client to ever take more than one lease. Maybe you have two DHCP clients running at the same time? (For example, systemd-networkd and NetworkManager?)

Alternatively, maybe you ran the DHCP client twice and deleted its lease file between runs?

and how could I release just one of them.

As mentioned, you probably have two DHCP clients, each managing its own address. If that is the case, then stop only a single client.

Finally, you can simply remove the addresses without releasing the DHCP lease, using ip addr del. But this won't help if the DHCP client which assigned it is still running, and it of course won't free it up on the DHCP server:

ip addr del 192.168.100.11/24 dev eth1
2
  • nope, I just have 1 DHCP server, but maybe I did something wrong. Regarding your last command that you said, if that way you are not releasing the IP on the server, how could I delete the lease if I have double IP? In both client and server @grawity Commented Oct 20, 2019 at 19:13
  • 1
    Yes, I was talking about DHCP clients. Commented Oct 20, 2019 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .