Reputation: 101
Any command to know the MTU size of Android?
Upvotes: 10
Views: 58839
Reputation: 1773
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.
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
Upvotes: 4
Reputation: 4553
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.
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
Upvotes: 1
Reputation: 1081
ifconfig $DEVICE | egrep addr\|MTU
adb shell netcfg | grep UP
to find the desired address andadb shell ip addr show rmnet0
in case of rmnet0
or adb shell cat /sys/class/net/rmnet0/mtu
in case of rmnet0
(as described by @patedit)Upvotes: 5
Reputation: 11
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
Upvotes: 1
Reputation: 61
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
Upvotes: 6
Reputation: 6862
You should use the NetworkInterface class to query and obtain the network interfaces, then call getMTU()
.
Upvotes: 6
Reputation: 928
1480, I believe, but you can check by using ifconfig $DEVICE
with a rooted device, and checking the MTU there.
Upvotes: 1