openWRT学习心得Word文档下载推荐.docx

上传人:b****5 文档编号:20389335 上传时间:2023-01-22 格式:DOCX 页数:27 大小:32.30KB
下载 相关 举报
openWRT学习心得Word文档下载推荐.docx_第1页
第1页 / 共27页
openWRT学习心得Word文档下载推荐.docx_第2页
第2页 / 共27页
openWRT学习心得Word文档下载推荐.docx_第3页
第3页 / 共27页
openWRT学习心得Word文档下载推荐.docx_第4页
第4页 / 共27页
openWRT学习心得Word文档下载推荐.docx_第5页
第5页 / 共27页
点击查看更多>>
下载资源
资源描述

openWRT学习心得Word文档下载推荐.docx

《openWRT学习心得Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《openWRT学习心得Word文档下载推荐.docx(27页珍藏版)》请在冰豆网上搜索。

openWRT学习心得Word文档下载推荐.docx

对于toolchain目录不需要做任何事情,除非youintendtoaddanewversionofoneofthecomponentsabove。

Package

Package包目录,在openwrtfirmware中,所有模块均是.ipk,这种软件包可用来addtoiremware中来提供新的特性或去除以节省空间。

这些软件包也是在主干外维护的,并可通过packagefeed系统来获取到。

./scripts/feedsupdate

Thosepackagescanbeusedtoextendthefunctionalityofthebuildsystemandneedtobesymlinkedintothemaintrunk.Onceyoudothat,thepackageswillshowupinthemenuforconfiguration.Youwoulddosomethinglikethis:

./scripts/feedssearchnmap

Searchresultsinfeed'

packages'

:

nmapNetworkexplorationand/orsecurityauditingutility

$./scripts/feedsinstallnmap

Toincludeallpackages,issuethefollowingcommand:

$makepackage/symlinks

Target

Target指的是嵌入式平台,包括特定嵌入式平台的内容。

其中target/linux目录,whichisbrokendownbyplatform<

,包含了特定平台的kernelpatch、profileconfig。

Target/image目录描述了怎么为特定平台打包firmware。

Target和package步骤均会使用build_dir/<

作为临时目录来编译,另外,toolchain、target、package步骤所下载的内容均会放到dl目录下。

BuildingOpenWrt

Creatingpackages

Creatingbinarypackages

Creatingkernelmodulespackages

Conventions

Troubleshooting

Usingbuildenvironments

Config.tex

配置文件结构

Structureoftheconfigurationfiles

配置文件分为sections和options/values对。

每一section有一type,但不一定需要name。

每一option有一个name和value,写在其所属于的section中。

语法如下:

config<

type>

["

<

name>

"

]#Section

option<

"

value>

#Option

每一参数应当是单一字符串,isformattedexactlylikeaparameterforashellfunction。

引号及特殊字符规则仍然适用,他们将被shell解释。

Parsingconfigurationfilesincustomscripts

为了loadconfigurationfiles,必须包含通用功能脚本:

./etc/functions.sh

这样就可以使用config_load<

来加载配置文件,功能会首先以<

作为文件名来检查,并从/etc/config中加载。

(这是最通用的使用方式)

Ifyouwanttousespecialcallbacksforsectionsand/oroptions,youneedtodefinethefollowingshellfunctionsbeforerunning\texttt{config\_load}(afterincluding\texttt{/etc/functions.sh}):

config_cb(){

localtype="

$1"

localname="

$2"

#commandstoberunforeverysection

}

option_cb(){

#commandstoberunforeveryoption

wireless.tex文档部分学习

WiFi配置文件为/etc/config/wireless。

当前支持broadcom、atheros、mac80211。

设备首次启动会检测无线卡类型,并创建一个默认配置文件(sampleconfigurationfile)。

每一无线驱动都有自己的配置脚本(/lib/wifi/driver_name.sh),用来处理驱动特定的选项及配置,脚本也会调用驱动特定的二进制如适用于broadcom的wlc,适用于atheros、mac80211的hostapd和wpa_supplicant。

这种结构(architecture)抽象了驱动配置。

通用的broadcom无线配置(略):

通用的mac80211无线配置(略):

通用的atheros无线配置:

configwifi-device"

wifi0"

optiontype"

atheros"

optionchannel"

5"

optionhwmode"

11g"

configwifi-iface

optiondevice"

#optionnetworklan

optionmode"

ap"

optionssid"

OpenWrt"

optionhidden"

0"

optionencryption"

none"

通用的多radioatheros无线配置:

configwifi-devicewifi0

optiontypeatheros

optionchannel1

optiondevicewifi0

optionmodeap

optionssidOpenWrt_private

optionhidden0

optionencryptionnone

configwifi-devicewifi1

optionchannel11

optiondevicewifi1

optionssidOpenWrt_public

optionhidden1

配置文件详述

配置文件有两部分,一是wifi-device,指的是物理wifi接口,而wifi-iface指的是其上的虚拟接口,即VAP。

整个的配置文件如下:

configwifi-devicewifidevicename

optiontypebroadcom,atheros,mac80211所支持的驱动类型

optioncountryus,uk,fr,de,etc.国家码

optionchannel1-14wifi信道,依赖于国家码

optionmaxassoc1-128(broadcomonly)关联的最大client数目,仅broadcom支持。

optiondistance1-n(meters)AP与最远的client的距离,仅atheros芯片支持

optionhwmode11b,11g,11a,11bg(atheros,mac80211)频率带宽,仅atheros支持。

optionrxantenna0,1,2(atheros,broadcom)接收端天线标识(Antennaidentifier)

optiontxantenna0,1,2(atheros,broadcom)发送端天线标识(Antennaidentifier)

optiontxpowertransmissionpowerindBm发射功率transmissionpower

optionnetworktheinterfaceyouwantwifitobridgewithwifi要使用的网络接口

optiondevicewifi0,wifi1,wifi2,wifiNwifi设备名

optionmodeap,sta,adhoc,monitor,mesh,orwds操作模式,有AP、clientmode、adhoc、monitor、meshpointmode(802.11s)及WDS点对点连接。

optiontxpower(deprecated)transmissionpowerindBm发送功率,应设置在wifi-device。

optionssidssidnameSSID名字

optionbssidbssidaddress用于WDS,设置为otherWDSunit的MAC地址

optionencryptionnone,wep,psk,psk2,wpa,wpa2加密设置,支持none、WEP、pre-sharedkey、及wparadius。

optionkeyencryptionkey

optionkey1key1

optionkey2key2

optionkey3key3

optionkey4key4

optionpassphrase0,10则将WPApsk为明文passphrase,1则为encodedpassphrase。

可通过wpa_passphrase工具产生加密的passphrase。

在passphrase包含特殊字符时有用。

此选项仅适用于mac80211或atheros。

optionserveripaddressradiusserverIP地址

optionportportradiusserver端口号,缺省为1812

optionhidden0,10为广播SSID,1为隐藏

optionisolate0,1(broadcom)无线客户端隔离功能,0要禁止隔离,1为开启,缺省为0.

optiondoth0,1(atheros,broadcom)Toggle802.11hmode,0为禁止802.11h,1为启用,缺省为0.

optionwmm0,1(atheros,broadcom)Toggle802.11emode,0为禁止,1为启用,缺省为0.

MeshPoint

MeshPoint(802.11s)仅mac80211驱动支持,需要安装iw包来建立meshlink。

Openwrt创建mshNmeshpoint接口,配置举例:

wlan0"

optiontype"

mac80211"

optionnetworklan

mesh"

optionmesh_id"

WDS

WirelessDistributionSystem

WDS是个非标准模式,可工作在同类设备间,但不能工作在不同的设备如broadcom和atheros设备间。

UnencryptedWDSconnections

未加密的WDS配置如下,我们假定一端的BSSIDca:

fe:

ba:

be:

00:

01,而另一端为BSSIDca:

01:

wl0"

broadcom"

optionencryption"

optionnetworklan

optionmodewds

OpenWrtWDS"

optionbssid"

ca:

02"

EncryptedWDSconnections

可以加密wds连接,支持psk、psk2及psk+psk2模式,以下是一个使用AES加密算法的pre-sharedkey例子:

configwifi-devicewl0

optiontypebroadcom

optionchannel5

optionencryptionpsk2

optionkey"

keyforclients>

optionbssidca:

02

pskforWDS>

802.1xconfigurations

配置略

EAP-PEAP

限制说明

Limitations

Therearecertainlimitationswhencombiningmodes.Onlythefollowingmodecombinationsaresupported:

WDSlinkscanonlybeusedinpureAPmodeandcannotuseWEP(exceptwhensharingthesettingswiththemasterinterface,whichisdoneautomatically).

VAPnumdefaultsto4,butcanbechangedbyloadingthemodulewiththemaxvaps=Nparameter.

Addinganewdriverconfiguration

具体添加方式略

Network-scripts.tex

Usingthenetworkscripts

为使用network,必须通过如下方式包含必须的shell脚本:

./etc/functions.sh#commonfunctions

include/lib/network#include/lib/network/*.sh

scan_interfaces#readandparsethenetworkconfig

有些协议,如PPP会在运行期间改变配置的接口名,如PPPOE会将eth0改为ppp0,因此要运行scan_interface,而不是从配置中直接读取。

运行scan_interface后,ifname选项将包含有效的接口名(用于iptraffic),如果物理设备名与此不同,则会保存在device选项中。

这意味着在scan_interface后运行config_get_lan_ifname,获取的结果可能与运行之前不同。

Writingprotocolhanders

添加协议处理

可通过在/lib/network下添加shell脚本来定制协议处理,脚本包含:

scan_<

protocolname>

(){

localconfig="

#changetheinterfacenamesifnecessary

setup_interface_<

localinterface="

#setuptheinterface

Network.tex

网络接口配置

网络配置文件为/etc/config/network,被分隔为多个接口配置。

每一个接口配置或直接就是ethernet/wifi接口(如eth0、wl0),或包含多个接口的桥接口。

如:

configinterface"

lan"

optionifname"

eth0"

optionproto"

static"

optionipaddr"

192.168.1.1"

optionnetmask"

255.255.255.0"

optiongateway"

192.168.1.254"

optiondns"

其中ifname指定linux接口名,如果使用bridge接口则将ifname设置为接口列表,同时添加optiontype“bridge”。

可通过添加vlanid来支持vlan功能如eth0.1,具体参照switch一节。

此配置是一个简单的eth0静态配置,proto指定了接口使用的协议,支持none、static、dhcp,可通过install额外的包来支持其他的协议。

Static

当为static时,ipaddr与netmask必填,而gateway与dns可选,支持多个DNS服务器,中间以空格隔开即可,如:

optiondns"

192.168.1.254192.168.1.253"

(optional)

...

DHCP

DHCP当前仅接受ipaddr与hostname选项。

其中ipaddr指定了dhcpserver的地址,而hostname指定了客户的的hostname标识,两者均可选。

dhcp"

optionhostname"

openwrt"

PPPOE

PPP基础的协议,如PPPOE、PPTP支持下列选项:

Username:

PPP用户名,用于PAP认证

Password:

PPP密码

Keepalived:

使用LCPpingPPP服务器,保活值,缺省间隔为5.

Demand:

按需拨友,值指定了最大空闲时间。

Server:

对端PPTP服务器IP地址

MTU设置

对所有协议,均可指定MTU,通过设置mtu选项即可,如:

pppoe"

optionusername"

username"

optionpassword"

optionmtu1492(optional)

设置静态路由

Settingupstaticroutes

可对指定的接口添加静态路由,在接口配置后会自动添加,举例配置:

configroutefoo

optioninterfacelan

optiontarget1.1.1.0

optionnetmask255.255.255.0

optiongateway192.168.1.1

其中route节的名称可选,interface、target、gateway选项是必须的。

如果netmsk不填,则默认为主机路由。

设置交换机

Settinguptheswitch(currentlybroadcomonly)

设置交换机,当前仅broadcom支

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 理化生

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1