首页 > 代码库 > OpenWrt系统交换机之swconfig

OpenWrt系统交换机之swconfig


http://blog.csdn.net/oyangshanjin/article/details/38128295


swconfig 是OpenWrt用来配置交换机的命令。

交换机是二层设备,是我们用来配置vlan的必备利器。

swconfig list 现实系统交换机。

swconfig dev <switch0/eth1> show现实当前端口配置。

所谓家庭路由器=交换机+网络服务程序+无线

企业级路由器还有些路由功能等。


root@YSWiFi:~# swconfig
swconfig dev <dev> [port <port>|vlan <vlan>] (help|set <key> <value>|get <key>|load <config>|show)
root@YSWiFi:~# swconfig dev eth1 show
Global attributes:
        enable_vlan: 1
Port 0:
        pvid: 0
        link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
        pvid: 2
        link: port:1 link:up speed:100baseT full-duplex auto
Port 2:
        pvid: 2
        link: port:2 link:up speed:100baseT full-duplex auto
Port 3:
        pvid: 1
        link: port:3 link:down
Port 4:
        pvid: 1
        link: port:4 link:down
VLAN 0:
        vid: 0
        ports: 0t
VLAN 1:
        vid: 1
        ports: 0t 3 4
VLAN 2:
        vid: 2
        ports: 0t 1 2
root@YSWiFi:~# ifconfig
br-lan    Link encap:Ethernet  HWaddr EC:88:8F:30:1D:C8
          inet addr:10.1.1.1  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1687 errors:0 dropped:15 overruns:0 frame:0
          TX packets:1526 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:111729 (109.1 KiB)  TX bytes:124350 (121.4 KiB)

br-lan2   Link encap:Ethernet  HWaddr EC:88:8F:30:1D:C8
          inet addr:10.0.2.1  Bcast:10.0.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18764 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21235 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2125122 (2.0 MiB)  TX bytes:7359281 (7.0 MiB)

eth0      Link encap:Ethernet  HWaddr EC:88:8F:30:1D:C7
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:4

eth1      Link encap:Ethernet  HWaddr EC:88:8F:30:1D:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:330320 errors:0 dropped:0 overruns:0 frame:0
          TX packets:644315 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:24291958 (23.1 MiB)  TX bytes:928701243 (885.6 MiB)
          Interrupt:5

eth1.1    Link encap:Ethernet  HWaddr EC:88:8F:30:1D:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:92 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:8513 (8.3 KiB)

eth1.2    Link encap:Ethernet  HWaddr EC:88:8F:30:1D:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:330320 errors:0 dropped:0 overruns:0 frame:0
          TX packets:644223 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:18346198 (17.4 MiB)  TX bytes:926115470 (883.2 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:33237 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33237 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2235750 (2.1 MiB)  TX bytes:2235750 (2.1 MiB)

wlan0     Link encap:Ethernet  HWaddr EC:88:8F:30:1D:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1684 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1555 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:135287 (132.1 KiB)  TX bytes:160545 (156.7 KiB)

wlan0-1   Link encap:Ethernet  HWaddr EE:88:8F:30:1D:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:624019 errors:0 dropped:0 overruns:0 frame:0
          TX packets:314821 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:918919244 (876.3 MiB)  TX bytes:27209520 (25.9 MiB)

root@YSWiFi:~#