OpenWrt Forum Archive

Topic: Configuring vlan

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

Hi all
I have one raspberry pi with 4usb ports
I want to create vlans with usb ports that usb0 be vlan2 and usb1 be vlan3
what should i edit or add to this config?

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 type 'bridge'               
        option proto 'static'               
        option netmask '255.255.255.0'     
        option ip6assign '60'               
        option _orig_ifname 'eth0'         
        option _orig_bridge 'true'         
        option ipaddr '192.168.42.20'       
        option ifname 'eth0'               
                                                                                         
config interface 'wan2'                       
        option proto 'dhcp'                   
        option ifname 'usb1'                   
        option metric '20'                     
        option peerdns '0'                     
                                               
config interface 'wan'                         
        option ifname 'usb0'               
        option _orig_ifname 'usb0'         
        option _orig_bridge 'false'         
        option proto 'static'               
        option ipaddr '192.168.42.60'       
        option netmask '255.255.255.0'     
                                           
config 'switch' 'eth0'                     
        option 'reset' '1'                 
        option 'enable_vlan' '1'           
                                           
config 'switch_vlan' 'eth0_1'                 
        option 'device' 'eth0'                 
        option 'vlan' '1'                     
        option 'ports' '0 1 3t 5t'             
                                               
config 'switch_vlan' 'eth0_2'                 
        option 'device' 'eth0'             
        option 'vlan' '2'                   
        option 'ports' '2 4t 5t'           
                                           
config 'switch_vlan' 'eth0_3'               
        option 'device' 'eth0'             
        option 'vlan' '3'                   
        option 'ports' '3t 4t'             
                                           
config 'switch_port'                       
        option 'device' 'eth0'             
        option 'port' '3'                   
        option 'pvid' '3' 

please help
Best Regards

So, you have four USB to ethernet adapters plugged into the 4 ports?

There is no switch involved, so you don't do switch configuration.  To tag a VLAN on the main ethernet port, use 'eth0.x'.  Create a bridge interface that includes that VLAN and the USB adapter you want the packets to come out on.

config interface vlan3
    option type bridge
    option ifname 'eth0.3 usb3'
    option proto none

(Last edited by mk24 on 26 Aug 2017, 15:57)

The discussion might have continued from here.