Inforce Computing Forums

inforce computing forums to discuss about inforce products

Static IP Address

Questions and discussions related to Inforce 6601™ development kit

by doleszki » Fri Sep 06, 2019 4:21 pm

The hard wired Ethernet device which is presented as eth0 in Android is configured for DHCP by default. I do not see any settings options in Network Settings that allow me to change the configuration for eth0 to a static IP address.

If I use ifconfig on the android shell I can get it a static ip address configured but it's not persistent across reboots. Additionally, if the network that the device is plugged into has a DHCP server, the DHCP client on Android will take over the IP address in short order.

I tried adding in my ifconfig commands in /persist/ but they do not work. I confirmed my script is written correctly by running it after boot. I think that after the script runs the network manager wipes the settings during the boot process.
Posts: 2
Joined: Wed Sep 04, 2019 1:31 pm

by ashwin » Wed Sep 11, 2019 3:30 am

You can try adding the commands to the init script.

Best Regards,
Posts: 66
Joined: Wed Jul 01, 2015 10:07 pm

by doleszki » Mon Oct 07, 2019 11:25 am

As stated in the original post, adding statements to the init script didn't work as the settings got overwritten by some network management service. I figured out how to do it by creating an ipconfig.txt file that is placed at /data/misc/ethernet/ipconfig.txt. Users can refer to for code to write their own ipconfig.txt files.

I also had to update the firewall rules to let users other than root route out from the device.
$ ip rule add from all lookup main pref 99
Does the trick but again I couldn't figure out the right init file to put it in so that it didn't get overwritten by the android services.

I ended up just changing the code in netd to let all users route out. This is probably not the best solution but it got me going for the time being.

Code: Select all
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index 26e8407..a4e5978 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -701,7 +701,7 @@ WARN_UNUSED_RESULT int addDirectlyConnectedRule() {
     mask.netId = FWMARK_NET_ID_MASK;
-                        fwmark.intValue, mask.intValue, IIF_NONE, OIF_NONE, UID_ROOT, UID_ROOT);
+                        fwmark.intValue, mask.intValue, IIF_NONE, OIF_NONE, INVALID_UID, INVALID_UID);
 // Add an explicit unreachable rule close to the end of the prioriy list to make it clear that[/list]
Posts: 2
Joined: Wed Sep 04, 2019 1:31 pm



Contact Us.