swconfig是交换接口(switch)配置命令。
swconfig list ; 列出可用的SWITCH设备信息(dev参数)
Found: switch0 - ag71xx-mdio.0
swconfig dev switch0 help ; 查询该设备信息
switch0: ag71xx-mdio.0(Atheros AR8337), ports: 7 (cpu @ 0), vlans: 128
--switch
Attribute 1 (int): enable_vlan (Enable VLAN mode)
Attribute 2 (none): reset_mibs (Reset all MIB counters)
Attribute 3 (int): enable_mirror_rx (Enable mirroring of RX packets)
Attribute 4 (int): enable_mirror_tx (Enable mirroring of TX packets)
Attribute 5 (int): mirror_monitor_port (Mirror monitor port)
Attribute 6 (int): mirror_source_port (Mirror source port)
Attribute 7 (string): arl_table (Get ARL table)
Attribute 8 (none): apply (Activate changes in the hardware)
Attribute 9 (none): reset (Reset the switch)
--vlan
Attribute 1 (int): vid (VLAN ID (0-4094))
Attribute 2 (ports): ports (VLAN port mapping)
--port
Attribute 1 (none): reset_mib (Reset single port MIB counters)
Attribute 2 (string): mib (Get port's MIB counters)
Attribute 3 (int): enable_eee (Enable EEE PHY sleep mode)
Attribute 4 (int): pvid (Primary VLAN ID)
Attribute 5 (string): link (Get port link information)
swconfig dev <dev> [port <port>|vlan <vlan>] (help|set <key> <value>|get <key>|load <config>|show) ;设置switch,port,vlan
swconfig dev switch0 show ;显示switch信息
示例:
显示switch0/eth1 port
~# swconfig dev eth1 show
Global attributes:
enable_vlan: 1
Port 0:
pvid: 1
link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
pvid: 1
link: port:1 link:down
Port 2:
pvid: 1
link: port:2 link:down
Port 3:
pvid: 1
link: port:3 link:down
Port 4:
pvid: 1
link: port:4 link:down
VLAN 1:
vid: 1
ports: 0 1 2 3 4
~# swconfig list
Found: switch0 - eth1