I have setup a static ip address for eth0 with adb command ip addr add $ipAddress dev eth0 plus other commands to set the netmask, route and dns values.

My question is how to I go back to a non static IP address

I tried doing ifconfig eth0 dhcp but I get an error in adb saying

ifconfig: bad argument 'dhcp'

Right now the only way I can reset everything is if I reboot the device since the changes dont persist.

How can I reset them without a reboot?

  • If Android runs DHCP client on Ethernet interface, it's not removed by adding a static IP address to the interface. However you also changed the routing table and DNS. It means you need to force the DHCP client for a lease renewal. But Android's DHCP client runs in Java framework and there is no straightforward method to communicate with it (some service calls may work but I never tested). Also, usually there's no GUI settings to turn Ethernet on/off like WiFi and Mobile Data. So the simple approach is to replug the Ethernet cable. Or restart the device. Aug 12, 2020 at 19:25
  • @IrfanLatif I came across ifconfig eth0 default that seems to reset everything like it would on a reboot all routes, netmasks and dns values appear to be reset. Any input on using that command?
    – tyczj
    Aug 12, 2020 at 20:05

1 Answer 1


Solution without root privileges:

  • Disable WiFi

  • Run:

     adb shell settings put global wifi_connected_mac_randomization_enabled 1
  • Enable WiFi and connect to your network

You should have a new IP.

  • I have root privileges
    – tyczj
    Aug 17, 2020 at 12:31
  • It works also if you have root privileges.
    – St0rm
    Aug 17, 2020 at 12:37
  • /system/bin/sh: put: not found
    – CS QGB
    Dec 20, 2022 at 9:38
  • @CSQGB settings was missing in the command
    – St0rm
    Dec 20, 2022 at 9:43
  • @android:/data/local # put global wifi_connected_mac_randomization_enabled 1 /system/bin/sh: put: not found
    – CS QGB
    Dec 20, 2022 at 12:21

You must log in to answer this question.

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