android网卡调试命令
16lz
2021-01-26
android开发中,经常遇到的调试工具汇总如下: 静态IP设置: 1. 设置指定网卡的IP地址和子网掩码: busybox ifconfig ethx IP地址 netmask 子网掩码
2. 设置指定网卡的网关: route add default gw 192.168.1.1 dev ethx
3. 设置指定网卡DNS setprop net.eth1.dns1 192.168.1.1 上面的方法会导致问题:网卡ping外网域名不通,ping网关或某IP地址正常。 解决:设置全局dns,方法如下: setprop net.dns1 192.168.1.1
查看DNS: getprop |grep dns 示例: root@sabresd_6dq:/ # getprop |grep dns [dhcp.eth0.dns1]: [114.114.114.114]
[dhcp.eth0.dns2]: [1.2.4.8]
[dhcp.eth0.dns3]: []
DHCP设置: netcfg ethx dhcp //通过dhcp 自动获取ip、网关、掩码、dns等 netcfg(网络配置命令):查看IP地址、MAC地址、打开或关闭等
设置网卡MAC地址: busybox ifconfig ethx down busybox ifconfig ethx hw ether 1234567890ab busybox ifconfig ehtx up 注意:该方法缺点:MAC地址无法保存,重启后,设置的MAC地址丢失。
关闭/开启网卡: 关闭:busybox ifconfig eth0 down 打开: busybox ifconfig eth0 up
指定特定网卡ping网络: ping -I eth0 192.168.1.1
2. 设置指定网卡的网关: route add default gw 192.168.1.1 dev ethx
3. 设置指定网卡DNS setprop net.eth1.dns1 192.168.1.1 上面的方法会导致问题:网卡ping外网域名不通,ping网关或某IP地址正常。 解决:设置全局dns,方法如下: setprop net.dns1 192.168.1.1
查看DNS: getprop |grep dns 示例: root@sabresd_6dq:/ # getprop |grep dns [dhcp.eth0.dns1]: [114.114.114.114]
[dhcp.eth0.dns2]: [1.2.4.8]
[dhcp.eth0.dns3]: []
上面[net.dns1]不是某个网卡的dns,而是全局dns
DHCP设置: netcfg ethx dhcp //通过dhcp 自动获取ip、网关、掩码、dns等 netcfg(网络配置命令):查看IP地址、MAC地址、打开或关闭等
设置网卡MAC地址: busybox ifconfig ethx down busybox ifconfig ethx hw ether 1234567890ab busybox ifconfig ehtx up 注意:该方法缺点:MAC地址无法保存,重启后,设置的MAC地址丢失。
关闭/开启网卡: 关闭:busybox ifconfig eth0 down 打开: busybox ifconfig eth0 up
指定特定网卡ping网络: ping -I eth0 192.168.1.1
路由跟踪:
windows: tracert IP地址
android:busybox traceroute 114.114.114.114(IP地址)
另外,还可以利用 ethtool 工具进行调试,例如:
设置网卡速率(切换网卡速率): 示例:设置eth0速率为100M,网卡自动协商关闭,全双工 ./ethtool -s eth0 speed 100 autoneg off duplex full
ethtool 功能很强大,此处不一一阐述。
更多相关文章
- TypedArray和attrs.xml
- Android5.0 设置wifi页面的修改
- Android(安卓)SDK Manager 代理服务器设置
- android开发给linearlayout设置边框
- webview 设定和使用缓存来获取网页中的js,css和图片资源
- Android布局学习——android:gravity和android:layout_gravity的
- android 通过主题设置activity统一切换动画
- 获取Android(安卓)手机设备信息:包括机型、操作系统版本号、手机
- Android(安卓)EditTextView 设置输入英文字母全部大写