Android平台网络常用命令
工作中经常用到的一些命令,整理一下,方便以后进行参考
1.IP设置
ifconfig eth0 128.224.156.81 up //一般的嵌入式linux中设置IP。
ifconfig eth0 128.224.156.81 netmask 255.255.255.0 up
netcfg eth0 up dhcp //通过dhcp 自动获取ip,网关,掩码等。
2. gateway
route add default gw 128.224.156.1 //一般的嵌入式linux会用这个命令添加网关,但是android中不用。直接“netcfg eth0 up dhcp” 自动分配IP等。
3. dns:
echo "nameserver 128.224.160.11" > resolv.conf //一般嵌入式linux中设置dns的方法
nameserver 128.224.160.11
setprop net.dns1 128.224.160.11 //android中设置DNS的命令。
setprop net.dns2 147.11.100.30
4、自动获取IP
# ./dhcpcd -U eth1
broadcast_address='192.168.100.255'
dhcp_lease_time='30'
dhcp_message_type='5'
dhcp_server_identifier='192.168.100.1'
ip_address='192.168.100.10'
network_number='192.168.100.0'
routers='192.168.100.1'
subnet_cidr='24'
subnet_mask='255.255.255.0'
5、自动获取IP的详细调用过程
# ./dhcpcd -h eth1 -d
dhcpcd[1534]: version 5.6.8 starting
dhcpcd[1534]: eth0: using hwaddr a2:47:2c:1e:af:3b
dhcpcd[1534]: eth0: executing `/home/xxx/work/Android_Net/install/libexec/dhcpcd-run-hooks', reason PREINIT
dhcpcd[1534]: eth0: executing `/home/xxx/work/Android_Net/install/libexec/dhcpcd-run-hooks', reason CARRIER
dhcpcd[1534]: eth1: using hwaddr a2:47:2c:1e:af:3b
dhcpcd[1534]: eth1: executing `/home/xxx/work/Android_Net/install/libexec/dhcpcd-run-hooks', reason PREINIT
dhcpcd[1534]: eth1: executing `/home/xxx/work/Android_Net/install/libexec/dhcpcd-run-hooks', reason CARRIER
dhcpcd[1534]: eth0: sending IPv6 Router Solicitation
dhcpcd[1534]: eth0: reading lease `/var/db/dhcpcd-eth0.lease'
dhcpcd[1534]: eth0: rebinding lease of 192.168.20.14
dhcpcd[1534]: eth0: sending REQUEST (xid 0x425e5b0e), next in 3.62 seconds
dhcpcd[1534]: eth1: sending IPv6 Router Solicitation
dhcpcd[1534]: eth1: reading lease `/var/db/dhcpcd-eth1.lease'
dhcpcd[1534]: eth1: rebinding lease of 192.168.100.10
dhcpcd[1534]: eth1: sending REQUEST (xid 0x18442cad), next in 3.15 seconds
dhcpcd[1534]: eth0: acknowledged 192.168.20.14 from 192.168.3.185
dhcpcd[1534]: eth0: checking for 192.168.20.14
dhcpcd[1534]: eth0: sending ARP probe (1 of 3), next in 1.22 seconds
dhcpcd[1534]: eth1: acknowledged 192.168.100.10 from 192.168.100.1
dhcpcd[1534]: eth1: checking for 192.168.100.10
dhcpcd[1534]: eth1: sending ARP probe (1 of 3), next in 1.88 seconds
dhcpcd[1534]: eth0: sending ARP probe (2 of 3), next in 1.88 seconds
dhcpcd[1534]: eth1: sending ARP probe (2 of 3), next in 1.95 seconds
dhcpcd[1534]: eth0: sending ARP probe (3 of 3), next in 2.00 seconds
dhcpcd[1534]: eth0: sending IPv6 Router Solicitation
dhcpcd[1534]: eth1: sending IPv6 Router Solicitation
dhcpcd[1534]: eth1: sending ARP probe (3 of 3), next in 2.00 seconds
dhcpcd[1534]: eth0: leased 192.168.20.14 for 172800 seconds
dhcpcd[1534]: eth0: renew in 86400 seconds, rebind in 86400 seconds
dhcpcd[1534]: eth0: adding IP address 192.168.20.14/24
dhcpcd[1534]: eth0: router 192.168.3.254 requires a host route
dhcpcd[1534]: eth0: adding route to 192.168.20.0/24
dhcpcd[1534]: eth0: adding host route to 192.168.3.254
dhcpcd[1534]: eth0: adding default route via 192.168.3.254
dhcpcd[1534]: eth0: writing lease `/var/db/dhcpcd-eth0.lease'
dhcpcd[1534]: eth0: executing `/home/xxx/work/Android_Net/install/libexec/dhcpcd-run-hooks', reason BOUND
dhcpcd[1534]: forking to background
dhcpcd[1534]: forked to background, child pid 1575
Android平台网络常用命令的更多相关文章
- Android开发调试常用命令列表
Android开发调试常用命令列表 adb命令 am am start -n com.iflytek.autofly.account/.ui.MainActivity am start -n com. ...
- 【android】adb常用命令
ADB常用命令: [adb help]获取帮助 [adb get-serialno]获取设备串号 [adb -s <serialNumber> <command>]给特定设备发 ...
- Android 神兵利器—— Adb 常用命令
总结的Android工具类文章: Android 神兵利器-- Adb 常用命令 Android 神兵利器-- Git 常用命令 Adb的全称为Android Debug Bridge,是管理andr ...
- 54. Android中adb常用命令及应用常用目录
本文主要介绍adb常用命令及应用常用目录.1.adb常用命令adb devices列出所有连接的android设备.以下命令都是对单个devices而言,如果存在多个devices的话,下面的命令都需 ...
- Android SQLite3工具常用命令行总结
Android SDK的tools目录下提供了一个sqlite3.exe工具,这是一个简单的sqlite数据库管理工具.开发者可以方便的使用其对sqlite数据库进行命令行的操作. 程序运行生成的*. ...
- android平台一些常用代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...
- linux网络:常用命令(一)
1.ifconfig 可以查看Linux的网卡情况 ifconfig eth0 查看 eth0的信息 给一块网卡设置多个ip地址: ifconfig eth0:0 192.168.1.12 255. ...
- 基于Linux的oracle数据库管理 part3( 存储 网络 常用命令 )
主要内容 1. 常用存储模式 2. 配置网络 3. 维护指令 常用存储模式 - 文件系统 优点:管理方便, 缺点:读写慢 - 裸设备 只没有被格式化和挂载的磁盘, 只能有程序直接访问, 不能被操作系统 ...
- [转]Linux下网络常用命令和工具
转自:http://int32bit.me/2016/05/04/Linux%E5%B8%B8%E7%94%A8%E7%BD%91%E7%BB%9C%E5%B7%A5%E5%85%B7%E6%80%B ...
随机推荐
- C++笔记--类型和声明
布尔量 Eg: bool b1=a==b;//这个例子中,=是赋值,==是判断是否相等,所以先是判断是否相等,a如果等于b,b1的值就是true,否则就是false了 Bool经常被用作检查某些条件是 ...
- C++11新标准:nullptr关键字
一.nullptr的意义 1.NULL在C中的定义 #define NULL (void*)0 2.NULL在C++中的定义 #ifndef NULL #ifdef __cplusplus #defi ...
- springcloud zuulfilter 实现get,post请求日志记录功能
import com.alibaba.fastjson.JSONObject; import com.idoipo.infras.gateway.open.model.InvokeLogModel; ...
- ubuntu - 14.04,安装CDT(Eclipse开发C++和C的插件)
我已经安装完Eclipse了,我想把CDT加入到我的Eclipse里面. 一,下载CDT:我下载的是64位的CDT,下载地址:http://eclipse.bluemix.net/packages/m ...
- [Django笔记] views.py 深入学习
views.py 是django MTV 中的主要逻辑层,相当于MVC中的 Controller 以下的实例都基于这样一个路由表: urlpatterns = [ url(r'^(index)?$', ...
- ASP.NET-GridView之表头设计
我们 见过许多网页呈现表格的 时候,表头的形式多种多样.下面来看看,怎么制定多样的表头吧. 效果显示: 需要在后台写一个方法,网页一加载在前端写个事件调用这个方法. DEMO 前端 <span ...
- SP8222 NSUBSTR - Substrings
\(\color{#0066ff}{ 题目描述 }\) 你得到一个字符串,最多由25万个小写拉丁字母组成.我们将 F(x)定义为某些长度X的字符串在s中出现的最大次数,例如字符串'ababaf'- F ...
- loj#6229. 这是一道简单的数学题 (??反演+杜教筛)
题目链接 题意:给定\(n\le 10^9\),求:\(F(n)=\sum_{i=1}^n\sum_{j=1}^i\frac{\mathrm{lcm}(i,j)}{\mathrm{gcd}(i,j)} ...
- 洛谷 P1028 数的计算
嗯... 首先这道题想到的就是递推.... 但是递推失败 (不知道自己是怎么想的 然后又想打一个暴力,但是数的最高位太难存储了,所以又放弃了(并且好像这个暴力大约500就会炸... 然后看了题解,才发 ...
- spring boot 下websocket实现的两种方法
websocket前台实现代码,保存为html执行就好 html代码来自:https://blog.csdn.net/M348915654/article/details/53616837 <h ...