Assign static IP to ethernet card from OTG
I would like to assign a static IP to an ethernet card, connected to the Android device via OTG cable. It should be done programmatically, but I can't find any reference regarding ethernet cards in android. Any ideas? Thank you If its a rooted device you can try with this Process process = Runtime.getRuntime().exec(new String[] { "su", "-c", "netcfg eth0 192.168.0.123"}); process.waitFor(); And also you can use ifconfig instead of netcfg . 来源: https://stackoverflow.com/questions/23397803/assign-static-ip-to-ethernet-card-from-otg