OpenWRT VLAN 설정



■ 가용한 포트와 상태 보기

# swconfig dev rt305x show
Global attributes:
        enable_vlan: 1
        alternate_vlan_disable: 0
Port 0:
        disable: 0
        doubletag: 0
        untag: 1
        led: 5
        lan: 1
        recv_bad: 0
        recv_good: 0
        pvid: 1
        link: port:0 link:down
Port 1:
        disable: 0
        doubletag: 0
        untag: 1
        led: 5
        lan: 1
        recv_bad: 0
        recv_good: 21375
        pvid: 1
        link: port:1 link:up speed:100baseT full-duplex
Port 2:
        disable: 0
        doubletag: 0
        untag: 1
        led: 5
        lan: 1
        recv_bad: 0
        recv_good: 0
        pvid: 1
        link: port:2 link:down
Port 3:
        disable: 0
        doubletag: 0
        untag: 1
        led: 5
        lan: 1
        recv_bad: 0
        recv_good: 0
        pvid: 1
        link: port:3 link:down
Port 4:
        disable: 0
        doubletag: 0
        untag: 1
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        pvid: 2
        link: port:4 link:down
Port 5: 기능은 있으나 실제 물리적 포트는 없음.
        disable: 1
        doubletag: 0
        untag: 0
        led: ???
        lan: 1
        recv_bad: 0
        recv_good: 0
        pvid: 0
        link: port:5 link:down
Port 6: 기능은 있으나 실제 물리적 포트는 없음.(1 Gb)
        disable: 0
        doubletag: 0
        untag: 0
        led: ???
        lan: ???
        recv_bad: ???
        recv_good: ???
        pvid: 0
        link: port:6 link:up speed:1000baseT full-duplex
VLAN 1: VLAN으로 6번은 Tagging 포트
        ports: 0 1 2 3 6t
VLAN 2: VLAN으로 6번은 Tagging 포트
        ports: 4 6t

■ 수동으로 VLAN 설정

swconfig dev rt305x vlan 1 set ports "1 2 3 6t"
swconfig dev rt305x vlan 2 set ports "4 6t"
swconfig dev rt305x set enable_vlan 1
swconfig dev rt305x set apply

※ 추가된 VLAN은 apply 후에 show에서 보인다.

■ /etc/config/network 에서 VLAN 설정

config switch
        option name 'rt305x'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'rt305x'
        option vlan '1'
        option ports '0 1 2 3  6t'

config switch_vlan
        option device 'rt305x'
        option vlan '2'
        option ports '4  6t'

■ 가용한 기능 보기

# swconfig dev rt305x help
switch0: rt305x(rt305x-esw), ports: 7 (cpu @ 6), vlans: 4096
     --switch
        Attribute 1 (int): enable_vlan (VLAN mode (1:enabled))
        Attribute 2 (int): alternate_vlan_disable (Use en_vlan instead of doubletag to disable VLAN mode)
        Attribute 3 (none): apply (Activate changes in the hardware)
        Attribute 4 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (int): disable (Port state (1:disabled))
        Attribute 2 (int): doubletag (Double tagging for incoming vlan packets (1:enabled))
        Attribute 3 (int): untag (Untag (1:strip outgoing vlan tag))
        Attribute 4 (int): led (LED mode (0:link, 1:100m, 2:duplex, 3:activity, 4:collision, 5:linkact, 6:duplcoll, 7:10mact, 8:100mact, 10:blink, 12:on))
        Attribute 5 (int): lan (HW port group (0:wan, 1:lan))
        Attribute 6 (int): recv_bad (Receive bad packet counter)
        Attribute 7 (int): recv_good (Receive good packet counter)
        Attribute 8 (int): pvid (Primary VLAN ID)
        Attribute 9 (string): link (Get port link information)

■ LED 설정

swconfig dev rt305x port 0 set led 2
swconfig dev rt305x set apply


■ VLAN 끄기

swconfig dev rt305x set enable_vlan 0
swconfig dev rt305x set apply

위로 스크롤