How to set static IP address for ethernet interface i.mx8m mini EVK android 9.0?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set static IP address for ethernet interface i.mx8m mini EVK android 9.0?

4,978 Views
chiragdesai
Contributor I

We have I.MX8M MINI EVK with Android 9.0 OS.

We are using Ethernet interface only. Now whenever I connect Ethernet cable it acquires IP automatically from DHCP server. I also tried ethernet application provided by NXP(Freescale) to set ethernet IP address and it works but the application is signed and can only run through root privileges.

In our application we can not sign it and don't want to run it with root privileges. Although we have server through which we can run some commands with root access. I tried to set the IP address using below commands.

ifconfig eth0 192.168.0.109 netmask 255.255.255.0

ip addr add 192.168.0.109/24 broadcast 192.168.0.255 dev eth0

Could not set the static IP address using above commands, It seems that some service is again changes the IP address received from DHCP server.

Please help me.

0 Kudos
3 Replies

2,486 Views
Anishamd
Contributor I

Hi,
Did you find an answer to your problem, did you find a way to set IP address. 
If so can you kindly share how did you do it.


Thanks and regards
Anisha

0 Kudos

4,750 Views
shivanipatel
Senior Contributor II

Hi chiragdesai‌,

We have tried to set the static IP using an ethernet application (ethernet.apk) provided by NXP and we are able to set the static IP. It does not require root privileges. We have tried with "userdebug" as well as "user" build variant i.e. we have built the Android source with below commands.

  • For user build-variant
    • source build/envsetup.sh
    • lunch evk_8mm-user
    • make -j4
  • For userdebug build-variant
    • source build/envsetup.sh
    • lunch evk_8mm-userdebug
    • make -j4

So, the root privileges are not required to set the static IP using the ethernet application for both the build variants.

We have used Android Version 9.0.0.2.3.0. We are using the fsl_imx_demo ethernet application to set the static IP. (${ANDROID_SOURCE}/vendor/nxp-opensource/fsl_imx_demo/Ethernet)

Are you using the same ethernet application? 

Can you please share the apk screenshot while setting the IP address? Are there any permissions or root accessed asked in GUI? If yes please share the screenshot of the same.

Regards,

Shivani

0 Kudos

4,750 Views
chiragdesai
Contributor I

shivanipatel‌,

Thanks for your response.

Ethernet application works fine in our system too. Ethernet application is signed and can be run only with root privileges. You can check AOSP code and confirm that the app is signed.

Android also provides EthenrnetManager class but can be used by signed application only.

We do not want to sign our application and hence can not use EthernetManager class. We can run ipconfig / ip addr command with some other application which has root access. But these commands are not working.

So I am looking for the commands to set static Ethernet IP address on Android 9.0.

0 Kudos