Operations 15 min read

How to Set Fixed IP for Dual Ethernet Ports on RK3568 Android Boards

This guide explains two practical methods—editing the binary ipconfig.txt file and porting the open‑source ifplugd daemon—to automatically assign a fixed IP address to the second Ethernet port on an RK3568 Android development board when a cable is connected.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Set Fixed IP for Dual Ethernet Ports on RK3568 Android Boards

The RK3568 EVB1 board provides two Ethernet ports, but the default Android UI only configures eth0. For scenarios where eth1 must obtain a predetermined IP as soon as a cable is plugged in, this article presents two simple solutions.

1. Modify ipconfig.txt

Android stores Ethernet configuration in the binary file /data/misc/ethernet/ipconfig.txt. By generating a custom file that contains entries for both eth0 and eth1, the built‑in UI can recognize and apply the settings. /data/misc/ethernet/ipconfig.txt Hex dump of the generated file (truncated for brevity):

00000000 00 00 00 03 00 0C 69 70 41 73 73 69 67 6E 6D 65 ......ipAssignme
00000010 6E 74 00 06 53 54 41 54 49 43 00 0B 6C 69 6E 6B nt..STATIC..link
... (additional lines omitted) ...
00000120 69 64 00 04 65 74 68 31 00 03 65 6F 73 -- -- -- id..eth1..eos

When opened as ASCII the relevant sections appear as:

ipAssignment STATIC  linkAddress
192.168.40.34    gateway          192.168.40.1 dns 0.0.0.0 dns 0.0.0.0
proxySettings NONE id eth0 eos  ipAssignment STATIC  linkAddress
192.168.2.125    gateway          192.168.2.1 dns 0.0.0.0 dns 0.0.0.0
proxySettings NONE id eth1 eos

Key parameters extracted:

| Interface | IP Address      | Gateway       |
|-----------|------------------|---------------|
| eth0      | 192.168.40.34   | 192.168.40.1 |
| eth1      | 192.168.2.125    | 192.168.2.1  |

Push the file to the board and reboot:

adb root
adb remount
adb push /data/misc/ethernet/ipconfig.txt /data/misc/ethernet/ipconfig.txt

After a reboot, bringing eth1 up automatically assigns the IP 192.168.2.125 without affecting the UI configuration of eth0.

Note: This method has only been verified on the RXW3568 board running Android 11; other platforms or Android versions have not been tested.

2. Use the open‑source ifplugd daemon

The ifplugd project monitors Ethernet hot‑plug events and can run a custom script when an interface changes state. Porting it to the board requires the libdaemon library.

1) Porting steps

Prepare source archives:

libdaemon-0.14.tar.gz
ifplugd-0.14.tar.gz

Copy the source tree into an NDK project (the example places all files under the project’s src directory). The libdaemon headers are duplicated to simplify inclusion.

Edit YROS.mk to build the daemon as an executable named ethcheckd:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
    ifplugd.c  interface.c dexec.c dfork.c dlog.c dnonblock.c  dpid.c dsignal.c
LOCAL_MODULE_TAGS := optional
LOCAL_CLANG := true
LOCAL_MODULE:= ethcheckd
include $(BUILD_EXECUTABLE)

Fix compilation errors:

Define SYSCONFDIR as an empty string in ifplugd.c (line 63).

Define LOCALSTATEDIR in dpid.c (line 50) to resolve the missing identifier.

Run ndk-build. After applying the patches, the build succeeds and produces the binary libs/armeabi-v7a/ifplugd.

2) Testing the daemon

Display available options: ifplugd -h Create a script /system/if.sh that configures eth1 when it comes up:

#!/bin/bash
IPADDR=192.168.40.8
ETHPORT=eth1
if [ $# -eq 2 ]; then
  if [ $1 = $ETHPORT ]; then
    if [ $2 = "up" ]; then
      ifconfig $ETHPORT $IPADDR
      sleep 1
      ip rule add from all lookup main pref 9000
      sleep 1
      echo 1 > /proc/sys/net/ipv4/ip_forward
      iptables -F
    elif [ $2 = "down" ]; then
      echo "down"
    elif [ $2 = "disable" ]; then
      echo "disable"
    elif [ $2 = "error" ]; then
      echo "error"
    fi
  fi
fi

Run the daemon to monitor eth1 and invoke the script: ifplugd -i eth1 -r "sh /system/if.sh" Verify the process is running with ps -ef | grep if. When a cable is plugged into eth1, the script sets the interface to 192.168.40.8 and applies the additional routing and firewall rules.

Note: The daemon works only after the Ethernet interface is already registered in the system (visible via ifconfig -a ). USB‑ethernet adapters that appear only after insertion require further modifications to ifplugd .

In summary, the article demonstrates two viable approaches—direct binary configuration and a daemon‑based hot‑plug solution—to achieve automatic fixed‑IP assignment on the second Ethernet port of an RK3568 Android board.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AndroidNDKethernetFixed IPifplugdRK3568
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.