OpenWrt Forum Archive

Topic: Is VLAN trunking on WR1034ND with VLAN id higher than 15 possible ?

The content of this topic has been archived on 1 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi

I have an ADSL modem (gateway) I received from my ISP which can be configured for VLAN trunking. Each port on that device can be configured for data, voice, tv or trunk. When port is configured as trunk, IPTV network is tagged with vlan id 2900, all other data (from public internet) is not tagged. I have TP-LINK 1043ND and i would like to connect it to trunk port on that modem, so IPTV and internet data could be transferred over the same cable.

I already tried that using a computer with Debian and it worked :

iface vlan2900 inet static
        address xxx.xxx.xxx.xxx
        netmask 255.255.255.0
        vlan_raw_device eth1

How can i achieve the same with OpenWRT backfire 10.03? The following doesn't work:

config 'interface' 'wan'
        option 'ifname' 'eth0.2'
        option 'proto' 'static'
        option 'ipaddr' 'yyy.yyy.yyy.yyy'
        option 'netmask' '255.255.255.0'

config 'interface' 'tvtrunk'
        option 'ifname' 'eth0.2900'
        option 'proto' 'static'
        option 'ipaddr' 'xxx.xxx.xxx.xxx'
        option 'netmask' '255.255.255.0'

#public internet
config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '2'
        option 'ports' '0 5t'

#IPTV network
config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '2900'
        option 'ports' '0t 5t'

eth0.2900 is created. Because  IPTV network is on that VLAN,  i should receive some IGMP messages on that interface, but nothing can be seen with tcpdump. Internet over eth0.2 works normally.
I have read on this forum that this might be because OpenWrt supports only 4 bits for VLAN id, is that true?

Never mind I asked to fast, I found answer on front page:

Highlights since Backfire 10.03.1 RC3:
* add support for 4k VLANs on rtl8366 switch

So i guess it should work with Backfire 10.03.1 RC4.

The configuration from 1st post still doesn't work with 10.03.1 RC4, however I succeeded with help from 2nd link - post from peson.

I enabled 4k vlans

config 'switch'
        option 'name' 'rtl8366rb'
        option 'reset' '1'
        option 'enable_vlan' '1'
        option 'enable_vlan4k' '1'

and added this init script:

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org

START=98

start() {
        swconfig dev rtl8366rb vlan 2900 set ports '0t 5t'
        swconfig dev rtl8366rb vlan 2 set ports '0 5t'
}

It is important that tagged port is set before untagged.

I also noticied that even without init script, configuration most probably works, but just for a few seconds. I believe this because ifconfig usually shows about 5 RX packets on eth0.2999 after network is restarted.

(Last edited by us on 29 Nov 2010, 14:57)

Thanks this helped me get VLAN working at all with Backfire 10.03.1-rc4 on TP-Link TL-WR1043ND Ver.1.8

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org

START=98

start() {
        swconfig dev rtl8366rb vlan 2900 set ports '0t 5t'
        swconfig dev rtl8366rb vlan 2 set ports '0 5t'
}

It is important that tagged port is set before untagged.

I also noticied that even without init script, configuration most probably works, but just for a few seconds. I believe this because ifconfig usually shows about 5 RX packets on eth0.2999 after network is restarted.

I created a script /etc/init.d/vlan as per above code, made it executable and linked to rc.d

ln -s ../init.d/vlan /etc/rc.d/S98vlan
chmod a+x /etc/init.d/vlan

I tried your configuration and it still fails for me. My /etc/config/network looks like this:

config 'interface' 'loopback'
       option 'ifname'   'lo'
       option 'proto'    'static'
       option 'ipaddr'   '127.0.0.1'
       option 'netmask'  '255.0.0.0'

config 'interface' 'lan'
        option 'ifname'   'eth0.1'
        option 'type'     'bridge'
        option 'proto'    'static'
        option 'ipaddr'   '192.168.1.1'
        option 'netmask'  '255.255.255.0'

config 'interface' 'wan'
        option 'ifname'      'eth0.2'
        option 'proto'    'dhcp'

config 'interface' 'test'
    option 'ifname'   'eth0.152'
    option 'proto'    'static'
    option 'ipaddr'   '192.168.255.1'
    option 'netmask'  '255.255.255.0'

config 'switch'
    option 'name' 'rtl8366rb'
        option 'reset' '1'
        option 'enable_vlan' '1'
        option 'enable_vlan4k' '1'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan'   '1'
        option 'ports'  '2 3 4 5t'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan'   '2'
        option 'ports'  '0 1 5t'

config 'switch_vlan'
    option 'device' 'rtl8366rb'
    option 'vlan'   '152'
    option 'ports'  '1t 3t 5t'

# Port 0: WAN
config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'   '0'
    option 'pvid'   '2'

# Port 1: Cerber    
config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'   '1'
    option 'pvid'   '2'

# Port 2: Kino
config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'   '2'
    option 'pvid'   '1'    

# Port 3: VoIP
config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'   '3'
    option 'pvid'   '1'
    
# Port 4: Nieuzywany
config 'switch_port' 
    option 'device' 'rtl8366rb'
    option 'port'   '4'
    option 'pvid'   '1'

But  "swconfig dev rtl8366rb show" gives:

(...)


VLAN 0:
    info: VLAN 0: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x003f      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 0t 1t 2t 3t 4t 5t 
VLAN 1:
    info: VLAN 1: Ports: 2345
         vid      prio      member      untag      fid
    MC:    1      0      0x003c      0x001c      0
    4K:    1            0x003c      0x001c      0
    ports: 2 3 4 5t 
VLAN 2:
    info: VLAN 2: Ports: 01
         vid      prio      member      untag      fid
    MC:    2      0      0x0023      0x0003      0
    4K:    2            0x0023      0x0003      0
    ports: 0 1 5t 
VLAN 3:
    info: VLAN 3: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 4:
    info: VLAN 4: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 5:
    info: VLAN 5: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 6:
    info: VLAN 6: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 7:
    info: VLAN 7: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 8:
    info: VLAN 8: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 9:
    info: VLAN 9: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 10:
    info: VLAN 10: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 11:
    info: VLAN 11: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 12:
    info: VLAN 12: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 13:
    info: VLAN 13: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 14:
    info: VLAN 14: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports: 
VLAN 15:
    info: VLAN 15: Ports: 
         vid      prio      member      untag      fid
    MC:    0      0      0x0000      0x0000      0
    4K:    0            0x003f      0x001f      0
    ports:

So it doesn't get set up. My /etc/init.d/vlan looks like this:

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org

START=98

start() {
    swconfig dev rtl8366rb vlan 152 set ports '1t 3t 5t'
    swconfig dev rtl8366rb vlan 2 set ports '0 1 5t'
    swconfig dev rtl8366rb vlan 1 set ports '2 3 4 5t'
}

But starting it manually gives:

root@OpenWrt:~# /etc/init.d/vlan start
failed

And that failed comes from line

swconfig dev rtl8366rb vlan 152 set ports '1t 3t 5t'

Something is wrong then.

It seems for me that either swconfig or networks scripts are broken because this config works (comments inside):

config 'interface' 'loopback'
       option 'ifname'   'lo'
       option 'proto'    'static'
       option 'ipaddr'   '127.0.0.1'
       option 'netmask'  '255.0.0.0'

config 'interface' 'lan'
        option 'ifname'   'eth0.1'
        option 'type'     'bridge'
        option 'proto'    'static'
        option 'ipaddr'   '192.168.1.1'
        option 'netmask'  '255.255.255.0'

config 'interface' 'wan'
        option 'ifname'      'eth0.2'
        option 'proto'    'dhcp'

config 'switch'
    option 'name' 'rtl8366rb'
        option 'reset' '1'
        option 'enable_vlan' '1'
        option 'enable_vlan4k' '1'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan'   '1'
        option 'ports'  '2 3 4 5t'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan'   '2'
        option 'ports'  '0 1 5t'

# HACK - this forces swconfig to set VID of VLAN 3 to 152
config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'    '4'
    option 'pvid'    '152'

# Here we are configuring VLAN 3 but it makes changes to the one with 152 VID
config 'switch_vlan'
    option 'device' 'rtl8366rb'
    option 'vlan'   '3'
    option 'ports'  '0t 1t 3t'

config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'   '0'
    option 'pvid'   '2'

config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'   '1'
    option 'pvid'   '2'

config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'   '2'
    option 'pvid'   '1'    

config 'switch_port'
    option 'device' 'rtl8366rb'
    option 'port'   '3'
    option 'pvid'   '1'
    
config 'switch_port' 
    option 'device' 'rtl8366rb'
    option 'port'   '4'
    option 'pvid'   '1'

PS. Opened bug for it - https://dev.openwrt.org/ticket/8867

(Last edited by alchemyx on 14 Feb 2011, 20:58)

The discussion might have continued from here.