VLAN configuration

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Atheros WiSOC based Hardware
Author Message
wenzhuo
DD-WRT User


Joined: 22 Apr 2011
Posts: 120

PostPosted: Fri Jul 17, 2015 3:31    Post subject: VLAN configuration Reply with quote
I am thinking to make use of the internal switch of my retired Buffalo WHR-G300Nv2, so that I can put it in the cable cabinet to extend both the VLAN 1 and 2 of the main router, Netgear WNDR4300.

The internal switch of WHR-G300Nv2 has one internal port (port 0) connected to the chipset, and four external ports (port 1-4) for LAN. The five ports are assigned to VLAN 1 on boot, but the vlan network interface is not created in the kernel. I can create VLAN 2, add assign port 1-3 to it and create the vlan network interfaces by the following commands:

Code:
root@DD-WRT:~# swconfig dev eth0 set enable_vlan 2
root@DD-WRT:~# swconfig dev eth0 vlan 1 set ports "0t 1t 4"
root@DD-WRT:~# swconfig dev eth0 vlan 2 set ports "0t 1t 2 3"
root@DD-WRT:~# swconfig dev eth0 set apply
root@DD-WRT:~# swconfig dev switch0 show
Global attributes:
        enable_vlan: 1
Port 0:
        pvid: 1
        link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
        pvid: 1
        link: port:1 link:down
Port 2:
        pvid: 2
        link: port:2 link:down
Port 3:
        pvid: 2
        link: port:3 link:down
Port 4:
        pvid: 1
        link: port:4 link:down
VLAN 1:
        vid: 1
        ports: 0t 1t 4
VLAN 2:
        vid: 2
        ports: 0t 1t 2 3

root@DD-WRT:~# vconfig set_name_type VLAN_PLUS_VID_NO_PAD
root@DD-WRT:~# vconfig add eth0 1
root@DD-WRT:~# vconfig add eth0 2

Which nvram parameters do I have to change to achieve the configuration in the standard dd-wrt way? If it can be done in the nvram settings, I can configure other network settings, say bridging, on the GUI.

I have thoroughly read the "Switch Ports" wiki article and a couple of blogs, but haven't figured it out yet.
Sponsor
wenzhuo
DD-WRT User


Joined: 22 Apr 2011
Posts: 120

PostPosted: Sat Jul 18, 2015 9:26    Post subject: Reply with quote
It looks that the parameters mentioned in Switched Ports, vlan.*ports, port.*vlans, etc., are not intended for Atheros chipset based routers at all. In my Atheros based routers, these settings are nearly identical, although their network hardware configurations are different.

So I have to configure the switch manually in the rc_startup script. For the record, here are the steps to configure my WHR-G300Nv2 as a routing switch, so that I can use it to extend both the VLAN 1 & 2 of the main router to the cable cabinet using one cable only:

1. On Setup / Basic Setup, disable WAN, configure Router IP settings, disable DHCP server, and then click Save.


2. On Setup / Networking, unbridge eth1, the network interface connected to the internal switch, and then click Save.


3. On Administration / Commands, enter the following commands into the Commands box and then click Save Startup.

Code:
swconfig dev eth1 set enable_vlan 2
swconfig dev eth1 vlan 1 set ports "0t 1 4t"
swconfig dev eth1 vlan 2 set ports "0t 2 3 4t"
swconfig dev eth1 set apply
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
vconfig add eth1 1
vconfig add eth1 2
brctl addif br0 vlan1


WHR-G300Nv2 has two network interfaces, eth0 is for the WAN port, and eth1 is connected to the internal switch. The internal switch port numbers of the 4 LAN ports are in the reverse order as they are labeled.

Results after rebooting:
Code:
root@DD-WRT:~# swconfig dev eth1 show
Global attributes:
        enable_vlan: 1
Port 0:
        pvid: 1
        link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
        pvid: 1
        link: port:1 link:down
Port 2:
        pvid: 2
        link: port:2 link:down
Port 3:
        pvid: 2
        link: port:3 link:up speed:100baseT full-duplex auto
Port 4:
        pvid: 1
        link: port:4 link:up speed:100baseT full-duplex auto
VLAN 1:
        vid: 1
        ports: 0t 1 4t
VLAN 2:
        vid: 2
        ports: 0t 2 3 4t
root@DD-WRT:~# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.0024a5xxxxxx       no              eth0
                                                        ath0
                                                        vlan1


I configured the wifi as WDS Station before making the VLAN changes, so I can still access the router in case I screw up the VLAN settings. After making sure everything is fine, I will change the WiFi mode to AP.
wenzhuo
DD-WRT User


Joined: 22 Apr 2011
Posts: 120

PostPosted: Sun Jul 19, 2015 1:40    Post subject: Reply with quote
Just encountered one issue with the above setup. When changing the WiFi Mode from WDS Station to AP, vlan1 was deleted from br0, and I had to connect a notebook to the WAN port (eth0) to login the router and add vlan1 back to the bridge interface.

Any ideas to prevent it from happening?
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum