Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1967202
  • 博文数量: 610
  • 博客积分: 11499
  • 博客等级: 上将
  • 技术积分: 5511
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-12 19:27
文章分类

全部博文(610)

文章存档

2016年(5)

2015年(18)

2014年(12)

2013年(16)

2012年(297)

2011年(45)

2010年(37)

2009年(79)

2008年(101)

分类: LINUX

2011-06-23 12:41:40

(2011-06-08 18:09)
分类: Android

一、有线网络配置
 
1)配置IP地址并启动网络设备
 
示例:#ifconfig eth0 10.120.120.81 up
 
2)配置网关
 
示例:#route add default 10.120.120.1
 
3)配置DNS(域名解析服务器)
 
示例:#setprop net.dns1 202.101.172.35
     #setprop net.eth0.dns1 202.101.172.35
 
以上参数会在重启时无法保存,故可以写成脚本文件放在system/etc目录下,假设文件为netconfigs.sh,然后在init.rc中添加开机启动服务即可。
 
示例:service mynetconfigs /system/etc/netconfigs.sh                               
             oneshot
 
二、无线网络配置
 
1)配置IP地址启动网络
 
示例:#ifconfig eth1 10.120.120.81 up
 
2)设置网关
 
示例:#route add default gw 10.120.120.1
 
3)选择无线网络
 
示例:#iwconfig eth1 essid NET_ESSID Channel CHANEL_NUM
 
NET_ESSID及CANNEL_NUM可由iwlist scan 查看相应网络的SSID及Chanel Num
 
4)设置无线网络密码
 
示例:#iwconfig eth1 key s:password
 
5)设置DNS
 
示例:#setprop net.eth1.dns1 202.101.172.35
 
三、动态IP网络
 
若网络为动态IP则IP可由如下命令获取:
 
示例:# udhcpc -i eth1
udhcpc (v1.9.1) started
Sending discover...
Sending select for 192.168.10.216...
Lease of 192.168.10.216 obtained, lease time 43200
adding dns 192.168.10.1
阅读(5109) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~