How to configure static IP and ethernet on rooted Galaxy S7 using only a micro USB cable (no OTG adapter)?

2.5k Views Asked by At

I have a rooted Galaxy S7 that I will be using wired as a display for a larger system. It needs to be able to send and receive ethernet data over its built in micro USB port using a static IP address.

On the phone, when plugged into the laptop and selected the RNDIS USB configuration the setting won't "stick" and allow the phone to have an IP set by a laptop. The Android menu never updates to show that RNDIS was selected (it will update when selecting MTP or Charge). But after selecting RNDIS the laptop can see the RNDIS connection but because the phone doesn't receive an IP I can't ping it. The "ethernet" setting is also greyed out.

I can not use an OTG cable with an ethernet adapter and I can not use a different phone. I need the static IP to be persistent so that when I unplug the phone it retains the static IP, including between boots. Is there a piece of software I can run/write to accomplish this or am I missing something obvious?

To be clear, I was able to accomplish this exact task when using Galaxy S7 -> OTG cable -> usb-to-ethernet -> ethernet -> ethernet-to-usb -> Windows 10 laptop setup. However, that's 4 cables and I need to be able to accomplish this with 1. If anybody has any leads please let me know.

1

There are 1 best solutions below

0
On

Okay so I figured it out.

I didn't end up using RNDIS at all. This was accomplished entirely by forcing the phone's ethernet interface to be enabled. Firstly, the phone did need to be rooted and a terminal emulator APK installed. The commands I ran in the terminal emulator were:

ifconfig eth0 up
ifconfig eth0 <your ip addr here> netmask <your netmaks here>

And that's it. I had a single male USB A to micro USB cable and I was able to ping the radio from the phone and the laptop through the radio and vice-versa. This method doesn't retain settings between boots but I will be writing a quick Android app to accomplish the desired effects.