Setting Android with Static IP [Solved]

I got Android custom VM working with Gateway by installing DHCP server.

Since DHCP server can’t be trusted, I want to configure Android with static IP. So I started with a fresh Gateway without DHCP.

I’ve updated my solution from another thread and the Wiki here. There appear to be regular searches and queries for this type of setup, so hopefully this one is better for visibility.

Solved! Use the following:

su
ifconfig eth0 10.152.152.12 netmask 255.255.192.0
ip rule add from all lookup main pref 0
busybox route add default gw 10.152.152.10
ndc resolver setnetdns 100 localdomain 10.152.152.10

DNS now works. DHCP need not apply.

3 Likes

Thank you so much for that!

Anonymize Other Operating Systems

I should add that in my case the above-mentioned commands only work IF I type ifconfig eth0 10.152.152.12 netmask 255.255.192.0 up (with “up” at the end)

So the whole sequence in my case would be:

    su
    ifconfig eth0 10.152.152.12 netmask 255.255.192.0 up
    ip rule add from all lookup main pref 0
    busybox route add default gw 10.152.152.10
    ndc resolver setnetdns 100 localdomain 10.152.152.10