How to configure tagged VLAN ID for a OpenWrt device

Hi all,
I have an embedded device running OpenWrt OS (Module AI7688), now I need to connect it with a network switch. It required my device must have a tagged VLAN ID. But I don't find a place to configure VLAN ID for the device.

Could anyone know how to configure tagged VLAN ID for a OpenWrt device?

Hi

maybe you could post your current config ?

cat /etc/config/network
2 Likes

Here is network config file. Please check

Here is an example from a GL.iNet GL-MT300N-V2, running OpenWRT 22.03.5, showing some VLAN configuration:

config interface 'lan'
       option proto 'static'
       option netmask '255.255.255.0'
       option ipaddr '192.168.7.1'
       option device 'eth0.1'

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

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

config switch_vlan
       option device 'switch0'
       option vlan '1'
       option ports '1 6t'

config switch_vlan
       option device 'switch0'
       option vlan '2'
       option ports '0 6t'

As you can see, there are directives to enable the use of VLANs, and directives to define the VLANs, and directives to assign the VLANs (both untagged and tagged) to certain ports.

You may also find https://openwrt.org/docs/guide-user/network/vlan/start to be useful.

Two things I'm noticing here...

  1. You are either running an old version of OpenWrt, or you are using a fork (not the official OpenWrt). Let's figure out what is going on so that we can make sure you get the right advice. What is the output of:
ubus call system board
  1. Please copy and paste the text -- screenshots are much harder to work with and may be missing information (in fact, it is quite likely your screenshot is not showing the entire contents of the file).

Please use the "Preformatted text </>" button for logs, scripts, configs and general console output.
grafik
Please edit your post accordingly. Thank you! :slight_smile:

1 Like

I'm sorry for my carelessness,

  1. Here is the version of OpenWrt on my board

{
        "kernel": "3.18.23",
        "hostname": "mylinkit",
        "system": "MediaTek MT7688 ver:1 eco:2",
        "model": "MediaTek LinkIt Smart 7688",
        "release": {
                "distribution": "OpenWrt",
                "version": "15.05.1",
                "revision": "r49203",
                "codename": "chaos_calmer",
                "target": "ramips\/mt7688",
                "description": "OpenWrt Chaos Calmer 15.05.1"
        }
}

Hi,
Are you using your GL-MT300N-V2 as a VLAN router or a VLAN access point?

As it happens, I'm using it as a straight-up router with no specific VLAN malarkey. I posted the config solely to give an example of one approach that OpenWRT supports for configuring VLANs; that config is pretty much straight out of the box (the only changes I made were to the LAN IP address and the removal of IPv6, neither of which are relevant to understanding VLAN operation).

1 Like

Your device supports 22.03.05 - https://openwrt.org/toh/views/toh_fwdownload?dataflt[CPU*~]=7688&dataflt[Brand*~]=mediatek

You'd likely find it beneficial to upgrade to the latest supported version. Not only will you benefit from feature enhancements and fixes, but you'll also likely have a wider audience for support requests. For example, I haven't touched 15.05 in years; I can't remember anything about it, and any configuration I might recommend might work on 22.03.5, but not work on 15.05.

Up to you, of course, but if your hardware supports a version upgrade there's not much reason not to.

2 Likes

I'll express the same sentiment, but much stronger... you absolutely should upgrade. The version you are running now is from 2015 (so 8 years old) and has long since been EOL and unsupported. What @iplaywithtoys is correct that there are few people here who remember the nuances of using that version (i.e. getting your core question answered will be difficult), but more importantly, there are major security vulnerabilities that cannot be addressed without upgrading.

Please upgrade. You may need to upgrade in a few steps (such as 15.01 > 18.06 > 21.02 > 22.05)... do not keep settings on any of the upgrades since the settings are not compatible.

When you're done, you can post the default config and we can help you with the appropriate modifications.

2 Likes

my bad when not telling the situation from the first, my product was manufactured, and now it goes to installing steps.
The customer does not have enough ethernet port for my device and the only way is using a switch to expand ethernet port. To use this switch, my device must be able to assign vlan ID.
So basically, I cannot upgrade OS for the device now.

Where did the firmware come from? Did some other party create a customized version of the firmware?

I use default firmware come with the module AI7688 from AcSip

Ah... ok, so you probably need to ask the vendor. It is possible that advice here might not work anyway since that is likely a customized fork, not official OpenWrt.

1 Like

thank you,
I'm asking vendor, but this is quite a specific case.
So, I'm looking for support from anyone who may encounter issue like me.

You can try this way:

  1. Change ifname eth0 to ifname eth0.100 in lan interface.
  2. Configure internal switch for use vlan 100, i.e. totally replace switch section with:
config switch
       option name 'switch0'
       option reset '1'
       option enable_vlan '1'

config switch_vlan
       option device 'switch0'
       option vlan '100'
       option ports '0t 1t 2t 3t 4t 6t'

I don't konw which port of internal switch is connected to the only rj45 socket so include all ports into vlan 100

2 Likes

Thank you, I will try

Thank you very much for your support, your VLAN configuration worked.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.