Last active
October 22, 2023 13:24
-
-
Save braian87b/ab2dfdef72d507a18b057a5831eb1337 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
Where is the fail? have you seen some error when running commands ?, may be is this: https://gist.github.com/braian87b/ab2dfdef72d507a18b057a5831eb1337/revisions?diff=unified#diff-30534490b913940499a6922d647a2d4a
those line were commented and are needed in order to have working
wan2
network interface, try again and let me know so I could correct it properly. You should keep in mind that you need to add the net network interface to proper firewall zonewan
for example... and if you want to use it you will need to setup routing, if you need failover/highavailability you could set up your own script or check out https://forum.lede-project.org/t/policy-routing-luci-ui/5390, if you need more complex rules you will need to use mwan3 https://gist.github.com/braian87b/97a186b2e11b5aa438d8fd17de0eab20 but keep in mind that have some fails on LEDE specially when trying to use IPv6.