Android shell 命令设置(获取)IP地址、网关、dns
2016-08-02 14:55
706 查看
转自 http://www.biemmeitalia.net/blog/android-network-configuration/
通过shell命令设置(获取)IP、网关、dns信息,需要获取root权限
查看所有网络信息
查看eth0
查看dns
设置ip
设置网关Gateway
添加dns
查看eth配置信息
转自:http://www.cnblogs.com/zhudongfang/p/4383507.html
通过shell命令设置(获取)IP、网关、dns信息,需要获取root权限
查看所有网络信息
C:\>adb shell root@android:/ # netcfg netcfg ip6tnl0 DOWN 0.0.0.0/0 0x00000080 00:00:00: 00:00:00 gre0 DOWN 0.0.0.0/0 0x00000080 00:00:00: 00:00:00 eth0 UP 192.168.0.180/24 0x00001043 00:00:00: ec:0a:00 sit0 DOWN 0.0.0.0/0 0x00000080 00:00:00: 00:00:00 lo UP 127.0.0.1/8 0x00000049 00:00:00: 00:00:00 tunl0 DOWN 0.0.0.0/0 0x00000080 00:00:00: 00:00:00
查看eth0
root@android:/ # ifconfig eth0 ifconfig eth0 eth0: ip 192.168.0.180 mask 255.255.255.0 flags [up broadcast running multicast]
查看dns
root@android:/ # getprop net.eth0.dns1 getprop net.eth0.dns1 8.8.8.8 root@android:/ # getprop net.eth0.dns2 getprop net.eth0.dns2 8.8.4.4
设置ip
root@android:/ # ifconfig eth0 192.168.0.173 netmask 255.255.255.0 ifconfig eth0 192.168.0.173 netmask 255.255.255.0 root@android:/ # ifconfig eth0 ifconfig eth0 eth0: ip 192.168.0.173 mask 255.255.255.0 flags [up broadcast running multicast]
设置网关Gateway
root@android:/ # route add default gw 192.168.0.1 dev eth0 route add default gw 192.168.0.1 dev eth0
添加dns
root@android:/ # setprop net.eth0.dns1 8.8.8.8 setprop net.eth0.dns1 8.8.8.8 root@android:/ # setprop net.eth0.dns2 8.8.4.4 setprop net.eth0.dns2 8.8.4.4
查看eth配置信息
root@android:/ # getprop | grep eth0 getprop | grep eth0 [dhcp.eth0.dns1]: [192.168.0.1] [dhcp.eth0.dns2]: [] [dhcp.eth0.dns3]: [] [dhcp.eth0.dns4]: [] [dhcp.eth0.gateway]: [192.168.0.1] [dhcp.eth0.ipaddress]: [192.168.0.180] [dhcp.eth0.leasetime]: [3600] [dhcp.eth0.mask]: [255.255.255.0] [dhcp.eth0.pid]: [13800] [dhcp.eth0.reason]: [PREINIT] [dhcp.eth0.result]: [failed] [dhcp.eth0.server]: [192.168.0.1] [dhcp.eth0.vendorInfo]: [] [net.change]: [net.eth0.dns2] [net.eth0.dns1]: [8.8.8.8] [net.eth0.dns2]: [8.8.4.4]
转自:http://www.cnblogs.com/zhudongfang/p/4383507.html
相关文章推荐
- Android shell 命令设置(获取)IP地址、网关、dns
- Android 命令设置获取、IP地址、网关、dns
- 怎样用DOS命令设置ip地址、网关、DNS等操作
- Android shell命令查询ip,网关,DNS
- 用DOS命令设置ip地址、网关、DNS等操作
- [转]命令行修改网络设置ip地址、dns、网关的方法(windows)
- CentOS 6.0 设置IP地址、网关、DNS
- Ubuntu DNS配置与使用命令设置Ubuntu的ip地址
- 命令行修改网络设置ip地址、dns、网关的方法(windows)
- Ubuntu DNS配置与使用命令设置Ubuntu的ip地址
- CentOS 6.0 设置IP地址、网关、DNS
- Dos命令更改IP地址、网关、DNS
- 命令行修改网络设置ip地址、dns、网关的方法
- 在windows中用 netsh 命令修改ip地址网关和DNS等
- Ubuntu DNS配置与使用命令设置Ubuntu的ip地址
- SUSE Linux Enterprise Server 设置IP地址、网关、DNS的方法
- 通过WifiManager,DhcpInfo获取android IP地址及网关等信息(两种方式)
- 获取当前可使用的网卡并检查网卡设置(网卡的IP,网关,子网掩码,DNS,备用DNS信息)
- 在windows中用 netsh 命令修改ip地址网关和DNS等
- 怎样用MS-DOS命令修改设置 IP地址 和 DNS