Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NetworkInterface. What are the meanings of names of NetworkInterface?

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.

like image 965
Allen Avatar asked Nov 17 '15 01:11

Allen


People also ask

What is Ccmni?

you forgot to include Cross Core Modem Network Interface(ccmni) : ccmni0 / ccmni1 which are basically interfaces for cellular data.

How do I find my network interface name Android?

Find Android MAC Address and Interface Name On your Android device, go to Settings -> WiFi.

What is p2p0?

p2p0 is the interface for WIFI DIRECT. Send 'ifconfig' command in android studio console to see currently used INTERFACES. If any interface is used currently then the status shows active otherwise it shows inactive.

What is NetworkInterface in Java?

public final class NetworkInterface extends Object. This class represents a Network Interface made up of a name, and a list of IP addresses assigned to this interface. It is used to identify the local interface on which a multicast group is joined. Interfaces are normally known by names such as "le0".


2 Answers

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

Here's some resources on *nix network interface naming

  • a tour of classic Linux network interface names
  • new predictable interface names
  • a good StackOverflow question

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

like image 187
jeyoor Avatar answered Sep 19 '22 06:09

jeyoor


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).

like image 20
jox Avatar answered Sep 21 '22 06:09

jox