The Computer Oracle

How can I clear the IP address of Ethernet interface without cycling the interface up/down or restarting it

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Breezy Bay

--

Chapters
00:00 How Can I Clear The Ip Address Of Ethernet Interface Without Cycling The Interface Up/Down Or Restar
00:24 Answer 1 Score 188
00:40 Accepted Answer Score 30
00:50 Answer 3 Score 19
01:01 Answer 4 Score 2
01:12 Thank you

--

Full question
https://superuser.com/questions/153559/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #networking

#avk47



ANSWER 1

Score 188


Use ip from iproute2. (You need to also specify the prefix length though.)

ip addr del 10.22.30.44/16 dev eth0

To remove all addresses (in case you have multiple):

ip addr flush dev eth0



ACCEPTED ANSWER

Score 30


As simple as ifconfig eth0 0.0.0.0. They should have put it in the manual.




ANSWER 3

Score 19


To remove all adreses from all interfaces i used for loop:

for i in $(ls /sys/class/net/) ; do
    /usr/sbin/ip addr flush $i &
done



ANSWER 4

Score 2


Perhaps you are just looking to get a new IP from the [DHCP-enabled] router? In this case call

dhclient eth0