Any command to know the MTU size of Android?
-
See this answer: stackoverflow.com/a/7847980/1006863– Paulo FidalgoCommented May 27, 2013 at 17:46
-
possible duplicate of Is there a way to change android phone's mtu size?– Alfredo CavalcantiCommented Nov 4, 2013 at 17:55
-
2Not a duplicate of "is there a way to change android phone's mtu size" - this is just how to get the value, not change it. They are related however– NickCommented May 17, 2016 at 18:38
7 Answers
You should use the NetworkInterface class to query and obtain the network interfaces, then call getMTU()
.
Today, looking into the code of netcfg I saw that the configuration of the interfaces is located into /sys/class/net.. and then I thought of you! (I read your question yesterday)
If you have root access, open a terminal and run
cat /sys/class/net/<interface>/mtu
Methods to know the MTU size of Android:
- from terminal:
ifconfig $DEVICE | egrep addr\|MTU
- through Android Debug Bridge (adb):
adb shell netcfg | grep UP
to find the desired address andadb shell ip addr show rmnet0
in case ofrmnet0
oradb shell cat /sys/class/net/rmnet0/mtu
in case ofrmnet0
(as described by @patedit)
Without ROOTING your phone, you may use a ping command from a Windows/Mac/Unix system. Though, the syntax of ping
-options is very different for different OS.
For Windows
try this:
ping /l 1473 /f 10.68.34.75
/l <Size>
— Specifies the length, in bytes, of the Data field in the echo Request messages sent. The default is 32.
/f
— Specifies that echo Request messages are sent with the Do not Fragment flag in the IP header set to 1 (available on IPv4 only).
Adjust the payload using the -l
command-line option. When you reach the higher limit, you will see this message and you will find the MTU size :
> The packet needs to be fragmented but DF set.
More details: https://kb.netgear.com/19863/Ping-Test-to-determine-Optimal-MTU-Size-on-Router
-
You will find others tips on delog.wordpress.com/2013/09/07/using-ping-to-determine-mtu-size Commented Aug 6, 2014 at 16:39
-
after 6 years the link became broken. here is the new one: kb.netgear.com/19863/… Commented Apr 13, 2020 at 1:34
1480, I believe, but you can check by using ifconfig $DEVICE
with a rooted device, and checking the MTU there.
-
I believe, that there is a precise technical answer (even several answers). 1480, I believe =) bro, it is a technical question, not about beliefs. Commented Apr 13, 2020 at 1:47
For most network access, MTU could be resolved by MTU Discovery. You can use Ping command with different payload size and don't fragment to find aChrysler value. Good luck
-
1how the OP could use
ping
to determine the MTU? You didn't provide any instructions Commented Apr 13, 2020 at 1:44
Without ROOTING your phone, you may use a ping command from a Windows/Mac/Unix system. Though, the syntax of ping
-options is very different for different OS.
From most Unix/Linux/Mac systems (Without ROOTING the phone)
You might share the internet connection from your phone, and then from any PC connected to your android-phone run ping
commands:
ping www.yahoo.com -s 1413 -M do
man ping says:
-s <packetsize>
— Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.
-M <pmtudisc_opt>
— Select Path MTU Discovery strategy.<pmtudisc_option>
may be eitherdo
(prohibit fragmentation, even local one),want
(do PMTU discovery, fragment locally when packet size is large), ordont
(do not set DF flag).
Adjust the payload using the -s
command-line option (for example: 1200, 1300, 1400, 1500, 1450, 1425, 1440, ...). When you reach the higher limit, you will see a message like this and you will find the MTU size :
> From 192.168.1.1 icmp_seq=1 Frag needed and DF set (mtu = 1500)
ping: local error: Message too long, mtu=1500
My answer is based on this one for windows: answer #25165641