Where are IP addresses stored on and Android device? In what location on disk, or otherwise; how are they stored?

  • 3
    IP addresses of what? – dantis Jul 17 '14 at 13:46
  • 3
    What's the actual problem you're trying to solve? – Dan Hulme Jul 17 '14 at 13:54
  • I want to store a persistent static IP address for my ethernet interface, to survive during reboot. – JohnyTex Jul 17 '14 at 14:05
  • And what speaks against using the configuration menu? Doesn't that work, or doesn't it survice a reboot? – Izzy Jul 17 '14 at 14:20
  • There is no static ip configuration choice in my prefs. – JohnyTex Jul 17 '14 at 14:22

Under Settings, Wi-Fi, , Modify Network, Advanced Options, IP Settings, you should have a choice of Static or DHCP. Choosing Static adds input boxes for IP address, Gateway, Network prefix, and DNS.

If you don't have this, I suggest trying a third-party app such as WiFi Manager.

Finally, if you're really talking about where in the filesystem this is stored, it's in /data/misc/wifi/ipconfig.txt, and is managed by the WifiConfigStore class. This is not a public API and is only used from class WifiStateMachine. However, you can find out the format of this file by viewing the source: WifiConfigStore.java.

  • Good effort. However this seems device- or version-dependent because there is no files in my such directory. – JohnyTex Nov 1 '16 at 9:39
  • Your original question doesn't include what version you're interested in, but if it did, I'd be happy to look into the specifics. However, 2+ years after my answer, the latest Android Nougat on my device still has the above file (and others) in /data/misc/wifi/. Note that if you don't have root access on your device, you cannot see, list, or access in any way, the files in /data and below, neither via shell nor file explorer apps. To an unprivileged shell or app, it will appear as though those folders and files don't exist, while in fact they do. – Paul Ratazzi Nov 1 '16 at 16:02
  • I am on Android 4.4.4 . I have root so I was able to expore the location, but couldn't find anything (text-readable, maybe binary?) there. – JohnyTex Nov 1 '16 at 16:25
  • Hmm. I have a disadvantage of no longer having a physical 4.4.4 device to experiment with. I have only a Genymotion 4.4.4 VM which won't help since VMs are never connected to "real" WiFi, only virtual nets. They still have /data/misc/wifi but there's no config there except for wpa_supplicant.conf and softap.conf. This is expected, since the n/w config is "wired." In all the physical devices I currently have (5.1 and 7.0), the above directory contains ipconfig.txt, networkHistory.txt, and a bunch of other things. – Paul Ratazzi Nov 1 '16 at 18:32
  • 1
    The fact that you have an empty /data/misc/wifi leads me to believe that the vendor of your device may have customized this aspect of the device in some way. Having now looked back at the comment discussion on the original question, I suspect this is the case, since you stated you don't have the same menu items as everyone else seems to. Note that the devices I'm working with are all stock Android. – Paul Ratazzi Nov 1 '16 at 18:33

I have found the answer myself. At least for the device I am using here. All settings are stored in an Sqlite database as a file on the filesystem. Check out this thread on how to manipulate that database:

Is it safe to edit settings.db in Android

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.