swconfig是交换接口(switch)配置命令。

swconfig list ; 列出可用的SWITCH设备信息(dev参数)
Found: switch0 - ag71xx-mdio.
swconfig dev switch0 help ; 查询该设备信息
switch0: ag71xx-mdio.(Atheros AR8337), ports: (cpu @ ), vlans:
--switch
Attribute (int): enable_vlan (Enable VLAN mode)
Attribute (none): reset_mibs (Reset all MIB counters)
Attribute (int): enable_mirror_rx (Enable mirroring of RX packets)
Attribute (int): enable_mirror_tx (Enable mirroring of TX packets)
Attribute (int): mirror_monitor_port (Mirror monitor port)
Attribute (int): mirror_source_port (Mirror source port)
Attribute (string): arl_table (Get ARL table)
Attribute (none): apply (Activate changes in the hardware)
Attribute (none): reset (Reset the switch)
--vlan
Attribute (int): vid (VLAN ID (-))
Attribute (ports): ports (VLAN port mapping)
--port
Attribute (none): reset_mib (Reset single port MIB counters)
Attribute (string): mib (Get port's MIB counters)
Attribute (int): enable_eee (Enable EEE PHY sleep mode)
Attribute (int): pvid (Primary VLAN ID)
Attribute (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:
Port :
pvid:
link: port: link:up speed:1000baseT full-duplex txflow rxflow
Port :
pvid:
link: port: link:down
Port :
pvid:
link: port: link:down
Port :
pvid:
link: port: link:down
Port :
pvid:
link: port: link:down
VLAN :
vid:
ports:
~# swconfig list
Found: switch0 - eth1
05-11 22:41