Android NDC Resolver Commands (DNS)

Manipulate DNS servers on Android via native Terminal, Termux or using SSH. Each Android version has it's own set of commands are the respective versions, so we've compiled a list of those commands to help those that want to control DNS.

The following is a list of commands, and their respective C++ source code used as reference. Each version is referenced as the example below:

Android Version

(Version Name) http:// link_to_c++_reference

ndc commands...



4.0.3 — 4.0.4

(ICS) http://androidxref.com/4.0.4/xref/system/netd/CommandListener.cpp#778

ndc resolver setdefaultif <iface>
ndc resolver setifdns <iface> <dns1> <dns2> ...
ndc resolver flushdefaultif
ndc resolver flushif <iface>

4.1.1 — 4.1.2

(JellyBean) http://androidxref.com/4.1.1/xref/system/netd/CommandListener.cpp#803

ndc resolver setdefaultif <iface>
ndc resolver setifdns <iface> <dns1> <dns2> ...
ndc resolver flushdefaultif
ndc resolver flushif <iface>

4.2_r1 — 4.2.2_r1

(JellyBean) http://androidxref.com/4.2_r1/xref/system/netd/CommandListener.cpp#873

ndc resolver setdefaultif <iface>
ndc resolver setifdns <iface> <dns1> <dns2> ...
ndc resolver flushdefaultif
ndc resolver flushif <iface>

4.3_r2.1

(JellyBean) http://androidxref.com/4.3_r2.1/xref/system/netd/CommandListener.cpp#770

ndc resolver setdefaultif <iface>
ndc resolver setifdns <iface> <domains> <dns1> <dns2> ...
ndc resolver flushdefaultif
ndc resolver flushif <iface>
ndc resolver setifaceforpid <iface> <pid>
ndc resolver clearifaceforpid <pid>

4.4_r1

(KitKat) http://androidxref.com/4.4_r1/xref/system/netd/CommandListener.cpp#941

ndc resolver setdefaultif <iface>
ndc resolver setifdns <iface> <domains> <dns1> <dns2> ...
ndc resolver flushdefaultif
ndc resolver flushif <iface>
ndc resolver setifaceforpid <iface> <pid>
ndc resolver clearifaceforpid <pid>
ndc resolver setifaceforuid <iface> <l> <h>
ndc resolver clearifaceforuid <l> <h>
ndc resolver clearifacemapping

4.4.2_r1 — 4.4.2_r2

(KitKat) http://androidxref.com/4.4.2_r1/xref/system/netd/CommandListener.cpp#942

ndc resolver setdefaultif <iface>
ndc resolver setifdns <iface> <domains> <dns1> <dns2> ...
ndc resolver flushdefaultif
ndc resolver flushif <iface>
ndc resolver setifaceforpid <iface> <pid>
ndc resolver clearifaceforpid <pid>
ndc resolver setifaceforuidrange <iface> <l> <h>
ndc resolver clearifaceforuidrange <l> <h>
ndc resolver clearifacemapping

4.4.3_r1.1

(KitKat) http://androidxref.com/4.4.3_r1.1/xref/system/netd/CommandListener.cpp#940

ndc resolver setdefaultif <iface>
ndc resolver setifdns <iface> <domains> <dns1> <dns2> ...
ndc resolver flushdefaultif
ndc resolver flushif <iface>
ndc resolver setifaceforpid <iface> <pid>
ndc resolver clearifaceforpid <pid>
ndc resolver setifaceforuidrange <iface> <l> <h>
ndc resolver clearifaceforuidrange <if> <l> <h>
ndc resolver clearifacemapping

4.4.4_r1

(KitKat) http://androidxref.com/4.4.4_r1/xref/system/netd/CommandListener.cpp#940

ndc resolver setdefaultif <iface>
ndc resolver setifdns <iface> <domains> <dns1> <dns2> ...
ndc resolver flushdefaultif
ndc resolver flushif <iface>
ndc resolver setifaceforpid <iface> <pid>
ndc resolver clearifaceforpid <pid>
ndc resolver setifaceforuid <iface> <l> <h>
ndc resolver clearifaceforuid <if> <l> <h>
ndc resolver clearifacemapping

5.0.0_r2

(Marshmallow) http://androidxref.com/5.0.0_r2/xref/system/netd/server/CommandListener.cpp#776

ndc resolver setnetdns <netId> <domains> <dns1> <dns2> ...
ndc resolver flushnet <netId>

5.1.0_r1 — 6.0.1_r10

(Marshmallow — Lollipop) http://androidxref.com/5.1.0_r1/xref/system/netd/server/CommandListener.cpp#791

ndc resolver setnetdns <netId> <domains> <dns1> <dns2> ...
ndc resolver clearnetdns <netId>
ndc resolver flushnet <netId>

7.0.0_r1 — 9.0.0_r3

(Nougat — Pie) http://androidxref.com/7.0.0_r1/xref/system/netd/server/CommandListener.cpp#801

ndc resolver setnetdns <netId> <domains> <dns1> <dns2> ...
ndc resolver clearnetdns <netId>
{{ message }}

{{ 'Comments are closed.' | trans }}