Chinaunix首页 | 论坛 | 博客
  • 博客访问: 426101
  • 博文数量: 69
  • 博客积分: 957
  • 博客等级: 准尉
  • 技术积分: 1161
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-26 14:54
文章分类

全部博文(69)

文章存档

2013年(15)

2012年(12)

2011年(42)

分类: LINUX

2013-07-23 12:53:58

(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
阅读(7811) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~