Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brosahay/c2a1ac7042f4a92304523170a31321de to your computer and use it in GitHub Desktop.
Save brosahay/c2a1ac7042f4a92304523170a31321de to your computer and use it in GitHub Desktop.
Additional VLAN 3 for WAN2 on tl-wr1043nd-v2, tl-wdr3600-v1 and tl-wdr4300-v1 OpenWRT / LEDE
# This is done by luci (it just sets defaults and assigns an ID to each vlan entry)
uci set network.@switch[0].mirror_source_port='0'
uci set network.@switch[0].mirror_monitor_port='0'
uci set network.@switch_vlan[0].vid='1'
uci set network.@switch_vlan[1].vid='2'
# For tl-wr1043nd-v2:
# Switch, LAN (on tl-wr1043nd-v2 we must enable tagging on CPU port 0)
uci set network.@switch_vlan[0].ports='0t 1 2 3 4' # previously '0 1 2 3 4'
# Switch, WAN
uci set network.@switch_vlan[1].ports='5 6t' # previously '5 6'
# Network, LAN
uci set network.lan.ifname='eth1.1' # vlan 1, previously 'eth1'
# for some reason wan seems to work only on vlan2 (may be need to be on CPU port 6)
uci set network.wan.ifname='eth0.2' # vlan 2, previously 'eth0'
# So far, the networks works as previous but now with VLAN Enabled
# For tl-wdr3600-v1 and tl-wdr4300-v1 (commands just show current state, it comes already like this)
uci set network.@switch_vlan[0].ports='0t 2 3 4 5' # (already like this)
# Switch, WAN
uci set network.@switch_vlan[1].ports='0t 1' # (already like this)
# Network, LAN
uci set network.lan.ifname='eth0.1' # vlan 1, (already like this)
# for some reason wan seems to work only on vlan2
uci set network.wan.ifname='eth0.2' # vlan 2, (already like this)
# Add additional VLAN 3 for WAN2 (switch_vlan index [-1] is same as [2])
uci add network switch_vlan # will be created with index 2 (network.@switch_vlan[2])
uci set network.@switch_vlan[-1].device='switch0'
uci set network.@switch_vlan[-1].vlan='3'
uci set network.@switch_vlan[-1].vid='3'
# For tl-wr1043nd-v2:
# Now we do physical port 1 (logic port 4) as tagged in vlan 3, removing it from vlan 0
uci set network.@switch_vlan[0].ports='0t 1 2 3' # previously '0 1 2 3 4'
uci set network.@switch_vlan[2].ports='0t 4'
# set vlan3 new device to network wan2
uci set network.wan2='interface'
uci set network.wan2.ifname='eth1.3'
uci set network.wan2.proto='dhcp'
# For tl-wdr3600-v1 and tl-wdr4300-v1
# Now we do physical port 1 (logic port 2) as tagged in vlan 3
uci set network.@switch_vlan[0].ports='0t 3 4 5' # previously '0t 2 3 4 5'
uci set network.@switch_vlan[2].ports='0t 2'
# set vlan3 new device to network wan2
uci set network.wan2='interface'
uci set network.wan2.ifname='eth0.3'
uci set network.wan2.proto='dhcp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment