首页
登录 | 注册

openwrt1

Content

shttp://kamikaze.openwrt.org/docs/openwrt.html#x1-460002.1.2

1 The Router
 1.1
Getting started
  1.1.1
Installation
  1.1.2
Initial configuration
  1.1.3
Failsafe mode
 1.2
Configuring OpenWrt
  1.2.1
Network
  1.2.2
Wireless
 1.3
Advanced configuration
  1.3.1
Hotplug
  1.3.2
Init scripts
  1.3.3
Network scripts
2
Development issues
 2.1
The build system
  2.1.1
Building an image
  2.1.2
Creating packages
  2.1.3
Creating kernel modules packages
  2.1.4
Conventions
  2.1.5
Troubleshooting
  2.1.6
Using build environments
 2.2
Extra tools
  2.2.1
Image Builder
  2.2.2
SDK
 2.3
Adding platform support
  2.3.1
Which Operating System does this device run?
  2.3.2
Finding and using the manufacturer SDK
 2.4
Debugging and debricking
  2.4.1
Adding a serial port
  2.4.2
JTAG
 2.5
Reporting bugs
  2.5.1
Using the Trac ticket system
 2.6
Submitting patches
  2.6.1
How to contribute
  2.6.2
Where to listen and talk
  2.6.3
Patch Submission Process

Chapter 1
The Router

1.1 Getting started

1.1.1 Installation

1.1.2 Initial configuration

1.1.3 Failsafe mode

1.2 Configuring OpenWrt

1.2.1 Network

The network configuration in Kamikaze is stored in /etc/config/network and is divided into interface configurations. Each interface configuration either refers directly to an ethernet/wifi interface (eth0, wl0, ..) or to a bridge containing multiple interfaces. It looks like this:

Kamikaze里面的网络配置存储在/etc/config/network,分成不同的界面配置。每一个界面配置要么直接涉及一个ethernet/wifi 界面 (eth0, wl0, ..),要么作为一个网桥,包含多个界面。它是这样的:

  config interface     "lan"
      option ifname    "eth0"
      option proto     "static"
      option ipaddr    "192.168.1.1"
      option netmask   "255.255.255.0"
      option gateway   "192.168.1.254"
      option dns       "192.168.1.254"

ifname specifies the Linux interface name. If you want to use bridging on one or more interfaces, set ifname to a list of interfaces and add:

ifname指定LINXU的界面名称。如果你想在一个或多个界面间使用网桥,把ifname安置到界面列表下,然后增加:

      option type     "bridge"

It is possible to use VLAN tagging on an interface simply by adding the VLAN IDs to it, e.g. eth0.1. These can be nested as well.

可以通过增加VLAN IDs(虚拟局域网ID)到界面,以便使用虚拟局域网在界面上做标记。例如,eth0.1.它还可以通过嵌入做标记。

This sets up a simple static configuration for eth0. proto specifies the protocol used for the interface. The default image usually provides ’none’ ’static’, ’dhcp’ and ’pppoe’. Others can be added by installing additional packages.

这为eth0. Proto设置了一个简单的静态配置,指定界面使用的协议。默认的图像通常提供 ’none’ ’static’, ’dhcp’ ’pppoe’,其它的可以通过安置其它的数据包实现。

When using the ’static’ method like in the example, the options ipaddr and netmask are mandatory, while gateway and dns are optional. You can specify more than one DNS server, separated with spaces.

在使用如例子中的’static’方式时,ipaddrnetmask选项是强制的,而gateway dns则可以选择。你可以指定多个DNS服务器,用空格隔开。

DHCP currently only accepts ipaddr (IP address to request from the server) and hostname (client hostname identify as) - both are optional.

   DHCP 动态主机配置协议)当前只接受ipaddr(服务器要求的IP地址)和and hostname(客户机主名识别为)--两者都可选择。

PPP based protocols (pppoe, pptp, ...) accept these options:

基于PPP(点对点通讯协定)的协议(pppoe, pptp, ...)接受如下选项:

  • username
    The PPP username (usually with PAP authentication)
  • password
    The PPP password
  • keepalive
    Ping the PPP server (using LCP). The value of this option specifies the maximum number of failed pings before reconnecting. The ping interval defaults to 5, but can be changed by appending "," to the keepalive value
  • 回应PPP服务器(使用LCP)。该选项的值在重新连线中,指定失败回应的最多次数。回应间隔默认值为5,但可以通过附加","到保活定时器的值上做更改。
  • demand
    Use Dial on Demand (value specifies the maximum idle time.
  • 使用及期拨号(指定最大闲置时间的值)
  • server: (pptp)
    The remote pptp server IP

For all protocol types, you can also specify the MTU by using the mtu option.

对于所有的协议类型,你可以通过使用mtu选择来指定MTU.

Setting up static routes

设置静态的路由器

You can set up static routes for a specific interface that will be brought up after the interface is configured.

你可以为特定界面设置静态路由器,在界面配置后,它将被终止。

Simply add a config section like this:

简单的增加如下的配置片段。

  config route foo
   option interface lan
   option target 1.1.1.0
   option netmask 255.255.255.0
   option gateway 192.168.1.1

The name for the route section is optional, the interface, target and gateway options are mandatory. Leaving out the netmask option will turn the route into a host route.

路线片段的名称是可选的,界面,目标和网关的选择都是强制的。余下的netmask选项将不路线改到主机的路线里。

Setting up the switch (currently broadcom only)

设置中继站

The switch configuration is set by adding a ’switch’ config section. Example:

中继配置只有通过增加’switch’配置片段来设置。例子如下:

  config switch       "eth0"
      option vlan0    "1 2 3 4 5*"
      option vlan1    "0 5"

On Broadcom hardware the section name needs to be eth0, as the switch driver does not detect the switch on any other physical device. Every vlan option needs to have the name vlan where is the VLAN number as used in the switch driver. As value it takes a list of ports with these optional suffixes:

在博通公司的硬件上,片段的名称必须是eth0,因为中继驱动器不懂检测到其它物理设备上的中继站。每一个VLAN选项都必须有一个vlan名称,在此处,是在中继驱动器上使用的VLAN数目。作为数值,它有一个带有选项后缀的端口列表。

  • ’*’: Set the default VLAN (PVID) of the Port to the current VLAN
  • ’u’: Force the port to be untagged
  • ’t’: Force the port to be tagged

The CPU port defaults to tagged, all other ports to untagged. On Broadcom hardware the CPU port is always 5. The other ports may vary with different hardware.

CPU端口默认加了标记,所有其它的端口都未标记。在博通公司的硬件中,CPU端口通常是5。其它的端口值根据不同硬件有所不同。

For instance, if you wish to have 3 vlans, like one 3-port switch, 1 port in a DMZ, and another one as your WAN interface, use the following configuration :

例如,如果你想有3VLAN,想一个带有3个端口的中继器,1个在DMZ上的端口,和其它你的WAN界面上的端口一样,使用如下配置:

  config switch       "eth0"
      option vlan0    "1 2 3 5*"
      option vlan1    "0 5"
      option vlan2    "4 5"

Three interfaces will be automatically created using this switch layout : eth0.0 (vlan0), eth0.1 (vlan1) and eth0.2 (vlan2). You can then assign those interfaces to a custom network configuration name like lan, wan or dmz for instance.

使用该中继器设计,3个界面将自动生成:eth0.0 (vlan0), eth0.1 (vlan1) eth0.2 (vlan2).然后你可以提交这些也没到一个客户网络配置名称,例如lan, wan dmz.

 

Setting up IPv6 connectivity

设置EPV6连通性

OpenWrt supports IPv6 connectivity using PPP, Tunnel brokers or static assignment.

OpenWrt使用PPP,安全加密链路报关信息,或静态人物,支持IPV6连通性的运行。

If you use PPP, IPv6 will be setup using IP6CP and there is nothing to configure.

如果你使用PPPIPV6将使用IP6CP来安装,那就不需要任何配置了。

To setup an IPv6 tunnel to a tunnel broker, you can install the 6scripts package and edit the /etc/config/6tunnel file and change the settings accordingly :

要把IPv6安全加密链路安装到负责人处,倪可以安装6script数据包,编辑/etc/config/6tunnel文件,然后根据设置修改:

  config 6tunnel
          option tnlifname     ’sixbone’
          option remoteip4        ’1.0.0.1’
          option localip4         ’1.0.0.2’
          option localip6         ’2001::DEAD::BEEF::1’
          option prefix           ’/64’

  • ’tnlifname’: Set the interface name of the IPv6 in IPv4 tunnel
  •                 设置IPv4隧道里的IPv6的界面名称
  • ’remoteip4’: IP address of the remote end to establish the 6in4 tunnel. This address is given by the tunnel broker
  •               远程终端用来建立6in4隧道的IP地址。该地址由加密链路安装到负责提供。
  • ’localip4’: IP address of your router to establish the 6in4 tunnel.It will usually match your WAN IP address.
  • 路由器建立6in4隧道的IP地址。通常能够和WAN IP地址匹配。
  • ’localip6’: IPv6 address to setup on your tunnel side This address is given by the tunnel broker
  • 用来在隧道旁安装的IPv6 地址。该地址由加密链路安装到负责提供。
  • ’prefix’: IPv6  prefix to setup on the LAN.
  •           LAN上安装的IPV6前缀。

Using the same package you can also setup an IPv6 bridged connection :

使用同一个数据包,你还可以安装IPV6已经加了网桥的链接;

  config 6bridge
   option bridge ’br6’

By default the script bridges the WAN interface with the LAN interface and uses ebtables to filter anything that is not IPv6 on the bridge.

通过默认,该脚本可以在WAN界面和LAN界面间架桥,使用ebtables过滤任何网桥上不是IPV6的内容。

IPv6 static addressing is also supported using a similar setup as IPv4 but with the ip6 prefixing (when applicable).

IPv6静态访问可使用同样的设置,如IPV4来支持其运行,但是有IP6前缀的不行。

  config interface     "lan"
      option ifname    "eth0"
      option proto     "static"
      option ip6addr    "fe80::200:ff:fe00:0/64"
      option ip6gw     "2001::DEAF:BEE:1"

 



2020 unjeep.com webmaster#unjeep.com
11 q. 0.012 s.
京ICP备10005923号