equivalent for ifconfig dev 0.0.0.0

On Linux, the old ifconfig command and its old Linux kernel API is limited to one IPv4 address per interface (and so interface aliases, which are really additional addresses rather than interfaces, are used to work around this limitation). This explains why to remove the IPv4 address, the method was to set it to (not really add) 0.0.0.0.

With iproute2 tools, if you want to remove any address from an interface (always a good idea for a bridge port) without caring what address(es) are there, you can use ip address flush, which is a bulk removal command:

ip address flush - flush protocol addresses

This command flushes the protocol addresses selected by some criteria.

[...]

Warning: This command and other flush commands are unforgiving. They will cruelly purge all the addresses.

[...]

So in the end you can use:

ip address flush dev eth0

(you could add -4 to limit the effect to IPv4).


There are other uses. For example this command:

  ip address flush to 10.1.0.0/16

would remove from any interface any address matching the block 10.1.0.0/16 whatever its netmask.

# ip -s -s address flush to 10.1.0.0/16
2: lxcbr0    inet 10.1.3.1/24 brd 10.1.3.255 scope global lxcbr0
       valid_lft forever preferred_lft forever
158: eth0    inet 10.1.1.1/8 scope global eth0
       valid_lft forever preferred_lft forever

*** Round 1, deleting 2 addresses ***
*** Flush is complete after 1 round ***