Android NetworkInterface. What are the meanings of names of NetworkInterface?
Asked Answered
H

3

16

I want to get available network of the current device, so I firstly get networkinterfaces list:

NetworkInterface.getNetworkInterfaces();

Then, iterate every one:

NetworkInterface intf = en.nextElement();
String name = intf.getName();

Here is the problem. The names of returned value of 'name' are: rmnet_data1, dymmy0, wlan0, rmnet_usb0, intf, lo, p2p0, sit0. (on my device) I want to know what are the meanings of them.

Hannahhannan answered 17/11, 2015 at 1:46 Comment(1)
you forgot to include Cross Core Modem Network Interface(ccmni) : ccmni0 / ccmni1 which are basically interfaces for cellular data.Steiermark
N
45

Since Android is based on Linux, Linux network interface naming patterns apply to Android devices.

Here's some resources on *nix network interface naming

To summarize:

lo usually stands for the loopback interface (localhost)

wlan usually stands for a wireless networking interface

rmnet interfaces are usually associated with cellular connections and usb tethering

sit interfaces are associated with tunneling IPv6 over IPv4

p2p interfaces are usually associated with peer-to-peer connections (perhaps your Android device's WiFi Direct support?)

dummy interfaces provide special aliases for the loopback interface

Nabala answered 17/11, 2015 at 3:22 Comment(1)
This is a really comprehensive guide, although is short. For instance, I didn't know that P2P is related to WiFi-direct!Acquiescent
E
1

ap or swlan interfaces (depending on the Android distribution) can be found when the Mobile Hotspot (Access Point) is activated on an Android device. It might also be associated with a regular wlan interface though (observed on devices where it is not possible to activate the WiFi connection and Mobile Hotspot at the same time, e.g. Android 9 on Galaxy Tab S2).

Escarpment answered 6/1, 2021 at 16:58 Comment(0)
L
0

I connected the phone to the computer and turned on the USB modem. Interface name: rndis0

Luik answered 9/5 at 13:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.