5

I wish to change the Ethernet IP Address of the Raspberry Pi3 board that is running Android Things OS. Currently it automatically fetches an IP Address available in the connected network. But I wish to assign a fixed/static IP to the device. Is it possible to set a static IP using ADB?

halfer
  • 19,824
  • 17
  • 99
  • 186
Kishan
  • 231
  • 1
  • 11
  • @AxelH Raspberry Pi is just the board. The OS running in it is Android Things. Need to change the OS Network settings. So i guess its related to Android Things OS. – Kishan Feb 06 '17 at 06:57
  • My bad, the tag description wasn't clear for me (about "thing"). I agree there is not much information about it but you could configurated the modem to set the IP [based on the MAC](http://superuser.com/q/892667) based on the modem you have. This will work as well (and I believe you don't want to used different network (because this could end in a conflict of adress) – AxelH Feb 06 '17 at 07:18
  • @AxelH thanks for the suggestion. can you please elaborate a little more. I m finding it little confusing. – Kishan Feb 06 '17 at 07:39
  • Instead of trying to force you RasPi to ask for a specific IP, you can gave him the same IP based on his MAC adress (depending on the modem it is linked to). The modem will recognize the MAC and gave him the IP, it should be reserved so a dynamic IP chould not take it (but this need to be confirmed) limiting the risk of conflicting adress (if an other device already use the one you forced) – AxelH Feb 06 '17 at 07:45
  • Ok got it. Will work upon it. Thanks for your help – Kishan Feb 06 '17 at 07:49
  • I have write the idea of this comment into a answer. If this works for you, you can accept it but I would wait since someone could know the "android-thing" answer ;) – AxelH Feb 06 '17 at 07:55

2 Answers2

4

I don't know the solution based on Android-things.

But I usually try to prevent the use of fixed IP (unless the device runs forever) set in the device itself.

I prefer to use the DHCP of the modem to set the IP based on the MAC adress. This prevent some conflict.

You can see more information on this post

Community
  • 1
  • 1
AxelH
  • 14,325
  • 2
  • 25
  • 55
  • Thank you @AxelH. Setting IP based on the MAC address in the router made it work for me. As of now i can proceed with this solution. I hope in the future there comes out a better solution without the need of touching the router settings – Kishan Feb 06 '17 at 09:59
  • @Kishan You are welcome, stay open to native solution (this could be helpful if someone doesn't have access to the router). – AxelH Feb 06 '17 at 10:01
  • In general this is a better practice than fix the IPs on the device, the only reason to do it on the device is if you do not have access to the router (which can happen) – shalafi Feb 06 '17 at 16:33
1

You can set a static IP usually through your router settings. Try accessing your router settings usually through the web browser at:

http://192.168.0.1/

Assuming you have never accessed this the username is usually admin, and the password is password. You can check the router name online to find the default username and password.

Navigate the menus to find a page which shows you he connected devices. See pic for an example.

Picture.

Every routers interface is different.

If you have a setting that says DHCP see if you can change it to a reserved IP so that the IP address assigned doesn't change.

Remember different routers have different interfaces so you must do some searching about yours to find the setting.

You can do this from any computer connected to your internet, doesn't have to be on the raspberry to make the changes.