Any command to know the MTU size of Android?
-
See this answer: http://stackoverflow.com/a/7847980/1006863 – Paulo Fidalgo May 27 '13 at 17:46
-
possible duplicate of [Is there a way to change android phone's mtu size?](http://stackoverflow.com/questions/5264344/is-there-a-way-to-change-android-phones-mtu-size) – Alfredo Cavalcanti Nov 04 '13 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 – Nick May 17 '16 at 18:38
7 Answers
You should use the NetworkInterface class to query and obtain the network interfaces, then call getMTU().
- 6,782
- 1
- 26
- 34
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
- 61
- 1
Methods to know the MTU size of Android:
- from terminal:
ifconfig $DEVICE | egrep addr\|MTU - through Android Debug Bridge (adb):
adb shell netcfg | grep UPto find the desired address andadb shell ip addr show rmnet0in case ofrmnet0oradb shell cat /sys/class/net/rmnet0/mtuin case ofrmnet0(as described by @patedit)
- 1,053
- 1
- 19
- 40
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
- 4,205
- 5
- 33
- 54
- 1,727
- 1
- 19
- 32
-
You will find others tips on http://delog.wordpress.com/2013/09/07/using-ping-to-determine-mtu-size/ – Spawnrider Aug 06 '14 at 16:39
-
after 6 years the link became broken. here is the new one: https://kb.netgear.com/19863/Ping-Test-to-determine-Optimal-MTU-Size-on-Router – maxkoryukov Apr 13 '20 at 01:34
1480, I believe, but you can check by using ifconfig $DEVICE with a rooted device, and checking the MTU there.
- 905
- 6
- 16
-
I believe, that there is a precise technical answer (even several answers). _1480, I believe_ =) bro, it is a technical question, not about beliefs. – maxkoryukov Apr 13 '20 at 01: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
- 11
- 1
-
1how the OP could use `ping` to determine the MTU? You didn't provide any instructions – maxkoryukov Apr 13 '20 at 01: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
- 4,205
- 5
- 33
- 54