CPU:RK3288
系统:Android 5.1
MTU:通信术语 最大传输单元(Maximum Transmission Unit,MTU)是指一种通信协议的某一层上面所能通过的最大数据包大小(以字节为单位)。
查看当前网络mtu:
8000 已经超出了当前的 mtu,所以报错,并且后面括号中显示了当前网络 mtu 值为 1500
root@rk3288:/ # ping -c 2 -M do -s 8000 www.baidu.com ping -c 2 -M do -s 8000 www.baidu.com PING www.a.shifen.com (14.215.177.38) 8000(8028) bytes of data. From android-59027ac919feb197 (192.168.0.178): icmp_seq=1 Frag needed and DF set (mtu = 1500) From android-59027ac919feb197 (192.168.0.178): icmp_seq=1 Frag needed and DF set (mtu = 1500) --- www.a.shifen.com ping statistics --- 0 packets transmitted, 0 received, +2 errors
临时修改测试,设备重启后就恢复原始值
1、4G网络
# 查看4G网络mtu root@rk3288:/ # cat /sys/class/net/ppp0/mtu cat /sys/class/net/ppp0/mtu 1500 # 修改mtu root@rk3288:/ # echo 1492 > /sys/class/net/ppp0/mtu echo 1492 > /sys/class/net/ppp0/mtu root@rk3288:/ # cat /sys/class/net/ppp0/mtu cat /sys/class/net/ppp0/mtu 1492
2、WLAN
# 查看wifi网络mtu root@rk288:/ # cat /sys/class/net/wlan0/mtu cat /sys/class/net/wlan0/mtu 1500 # 修改wifi网络mtu root@rk3288:/ # echo 1492 > /sys/class/net/wlan0/mtu root@rk3288:/ # cat /sys/class/net/wlan0/mtu 1492
3、以太网
# 查看以太网mtu root@rk3288:/ # cat /sys/class/net/eth0/mtu cat /sys/class/net/eth0/mtu 1500 # 修改以太网mtu root@rk3288:/ # echo 1492 > /sys/class/net/eth0/mtu echo 1492 > /sys/class/net/eth0/mtu 1|root@rk3288:/ # cat /sys/class/net/eth0/mtu cat /sys/class/net/eth0/mtu 1500 # 修改失败 # 设备上关闭以太网,不要拔掉网线 #修改以太网mtu root@rk3288:/ # echo 1492 > /sys/class/net/eth0/mtu echo 1492 > /sys/class/net/eth0/mtu # 修改成功 root@rk3288:/ # cat /sys/class/net/eth0/mtu cat /sys/class/net/eth0/mtu 1492
固定网络的 mtu,重启后不恢复
以太网
diff --git a/kernel/include/uapi/linux/if_ether.h b/kernel/include/uapi/linux/if_ether.h index ade07f1..0b780bf 100755 --- a/kernel/include/uapi/linux/if_ether.h +++ b/kernel/include/uapi/linux/if_ether.h @@ -31,7 +31,7 @@ #define ETH_ALEN 6 /* Octets in one ethernet addr */ #define ETH_HLEN 14 /* Total octets in header. */ #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ -#define ETH_DATA_LEN 1500 /* Max. octets in payload */ +#define ETH_DATA_LEN 1492 /* Max. octets in payload */ #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ #define ETH_FCS_LEN 4 /* Octets in the FCS */