androidadbstatic-ip-address

Setting static IP adress to Android device


Is there any way to set a static IP address to Android device if the device is connected to a network via ethernet cable using ethernet to USB adapter?

I tried connecting to device via ADB and then changing IP address using $ ifconfig eth0 x.x.x.x command, but I got ifconfig:ioctl 8916: Permission denied as an answer.


Solution

  • Nope, there is no way to set it on common devices. You need rooted device, which allows you to run ifconfig eth0, thats the only way (valid up to Android 13). By default eth0 will obtain IP using DHCP, if there is no DHCP available - it just won't work. In "your" network you may assign some particular IP for particular MAC (also ensure that MAC address of ethernet isn't randomized like for Wi-Fi starting Android 10, but it shouldn't be on Linux level)