This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Ethernet Static IP to android platform

Hi

I have the blaze board to which ethernet interface (RJ45) is their. when i'm connecting it my LAN It showing the DHCP Ip. But I want to set the Static IP to my Board. I have checked the init.rc but i am not understanding how to disable the DHCP & set the Static IP on every boot. Can some one help me.

Regards,

sainath

  • Hi Sainath,

    Take a look at this article, it may prove useful for you.

    What are you trying to be achieved comes to  put the following lines in the init.rc or the init.omap4pandaboard.rc

    ( depending on your platform- more info in the link above)

    netcfg eth0 up

    ifconfig eth0 <ip> netmask <mask>
    route add default gw <ip> dev eth0
    setprop net.dns1 <ip>

     

    Regards,

    Boyko

  • Hi Boyko,

    I have added the above 4 lines. but its not working for me. I have seen other articles where there adding the UI support for ethernet to set the dhcp/ static ip to boards. But those patches are for ICS android.


    1. Are there any similar patches for android JB 4.1.2.

    2. My main aim is set static IP to the board. Adding the above mentioned steps din't helped me out.

    - using the command dhcpcd eth0 I'm able to get the IP & connect to external network through browser.

    But I want to set an static IP. Please help me out.

    Regards,

    Sainath


     

  • Well,

    doing it manually in ADB what does indicate that it doesn't work?

    Probably you don't have ifconfig. Try with the following line:( first try in adb then verify with netcfg that it did some change, if it does succeed you can put the line in the init script)

    ip addr add 192.168.1.100/24 dev eth0

     

    Regards,

    Boyko

  • Hi Boyko,

    I have ifconfig tool in my /system/bin.

    After entire booting sequence of android. I invoked the adb shell & done following settings

    netcfg eth0 up

    ifconfig eth0 < IP >  netmask < mask >

    route add default gw < IP > dev eth0

    setprop net.dns1 < DNS IP >

    These settings are effected & I can able get the static IP.

    After this  I have added above 5 settings in the /etc/init.rc & recompiled. But the output of netcfg is

    lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00
    ifb0     DOWN                                   0.0.0.0/0   0x00000082 a2:b3:15:f3:f5:49
    ifb1     DOWN                                   0.0.0.0/0   0x00000082 4a:ca:54:5a:25:5a
    sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
    ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
    eth0     UP                                     0.0.0.0/0   0x00001043 c6:ab:69:54:1d:43

    where it is not able to fetch the IP.

    Also added these 5 lines in the init.rc files related to board.

    Can you please tell me the exact procedure of setting the Static IP in android JB 4.1.2..?

    Regards,

    Sainath

  • Sainath,

    Have you tried the command I gave you? ( it requires su). After that check netcfg. If it works then changing the init script is a question of a race condition ( t.m this setting must be done after dhcp)

    Regards,

    Boyko

  • Hi Boyko,

    I have used the command you suggested ip addr add. All the setting I made for static IP purpose after the android boot up in the adb shell, i could able to get the static Ip. For confirmation i used ping from the board to the development system Ip. Ping is successful.

    As I to set these setting for every boot, I want get the above 4 line settings for static IP to be fixed on every bootup. 

    For this purpose in which  source files of android jb 4.1.2 I need to keep the those setting which I used in adb shell for static Ip.