User Tools

Site Tools


交换机手册(Switch Documentation)

FIXME: This page assumes you know what this is and why you want it. (Someone please add info or another page and a link).


如果你想要更改这些端口如何互相连接的,你需要配置你的switch设备。 (see also network.interfaces)

UCI config, swconfig style


  • 设备运行在kernel 2.6 或 3 的版本
  • 设备使用swconfig类型的switch配置
  • —————————————————
  • swithc位于eth1上。FIXME(有许多是在eth0上,判断方法:/proc/switch目录包含了正确的设备号,请确认)[Howto find out:/proc/switch directory appears to contain the right eth number for the switch. please confirm],例如:rtl8366s的芯片.
  • 5个接口的交换设备,其中0-3连接外部,4没有连接,5连接到CPU的eth1接口(which adds up to six ports except that 4 is not counted)
  • vlan0 仅表示所有的对外接口除了最后的那个。
  • vlan1 仅表示最后的那个对外接口。[Howto find out which Port corresponds:]
  • vlan0 是默认vlan,这意味着如果数据包是未加标签的,它将被视为vlan0的数据包。




config 'switch' 'eth1'
   option 'enable'      '1'
   option 'enable_vlan' '1'
   option 'reset'       '1'
   option 'pvid'        '100'

VLAN: switch config

in /etc/config/network


VLAN标识号是由option vlan行来指定。 一个VLAN的VID(VLAN ID)默认是与相同VLAN标识号关联的。这个标识号可以被option pvid行更改。例如,VLAN1可以使用VID 100

In the option ports line, a number indicates that the specified vlan includes the port with that number. If the number is followed by a “t” then packets transmitted out that port on this VLAN are tagged, and that packets received on that port may be received with this VLAN tag. 5 is generally the CPU or 'internal' port and is most often used as tagged. Other suffixes are ignored on devices using swconfig but Broadcom kmod-switch style interfaces (/proc/switch/) use “*” and “u” to indicate PVID and untagged ports respectively (as they have the CPU port implicitly tagged one needs to use “u” to untag it).

So, '0 1 2 3 5t' would mean that packets on this VLAN are transmitted untagged when leaving ports 0, 1, 2 and 3, but tagged when leaving port 5 (generally the CPU internal port as described above).

Tagged packets received on a port will be directed to the VLAN indicated by the VID contained in the packet. Untagged packets received on a port will be directed to the default port VLAN (usually called the PVID). A separate config switch_port section is required to set the default port VLAN.

The relevant standards document is 801.2q which says that VID values 0 and 4095 may not be used for tagging packets as they denote reserved values - VID 0 is the default 'native' vlan - leaving 4094 valid values in between, although VID 1 is often reserved for network management (see Dell 2708 for example). This means vlan0 can be used as a VLAN within or between devices, but you cannot tag packets with it.

The config sections
config 'switch_vlan'
   option 'vlan'       '0'
   option 'device'     'eth1'
   option 'ports'      '0 1 2 5t'

config 'switch_vlan'
   option 'vlan'       '1'
   option 'device'     'eth1'
   option 'ports'      '3 5t'

config 'switch_port'
    option 'port'      '3'
    option 'pvid'      '1'

VLAN: interface/network config

VLAN interface sections look just like regular interface sections, except that instead of eth1 (or eth0, or whatever), you have eth1.0, eth1.1, etc. where a digit after a . is a VLAN number. (that is, for kernel 2.6; 2.4 kernels do something different).

The following example is for a two-interface router, with eth0 being the WAN and eth1 being the five-port switch configured as above. It goes in /etc/config/network


config 'interface' 'lan'
    option 'ifname' 'eth1.0'
    option 'proto' 'static'
    option 'ipaddr' ''
    option 'netmask' ''
    option 'defaultroute' '0'
    option 'peerdns' '0'
    option 'nat'    '1'

config 'interface' 'extranet'
    option 'ifname'  'eth1.1'
    option 'proto'   'dhcp'

config 'interface'  'wan'
   option 'ifname'  'eth0.2'
   option 'proto'   'pppoe'
   option 'username' 'szabozsolt-em'
   option 'password' 'M3IuWBt4'

Of course, if you only had a five port switch on eth0 (and no other interfaces), you might make the wan interface eth0.1 and the lan eth0.0 with appropriately matching switch, switch_vlan and switch_port sections.

See also backplane.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
zh-cn/doc/uci/network/switch.txt · Last modified: 2018/02/17 18:16 by