Skip to content

Instantly share code, notes, and snippets.

@edwork
Created May 21, 2018 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwork/77b6ab092b67d4f6f4175b4924d317f0 to your computer and use it in GitHub Desktop.
Save edwork/77b6ab092b67d4f6f4175b4924d317f0 to your computer and use it in GitHub Desktop.
#!/bin/sh
PATH="/sbin:/usr/sbin:/bin:/usr/bin:${PATH}"
#################################################
##
## Edwork 'services-start' Script
##
## Place in /jffs/scripts/services-start (chmod +x)
##
#################################################
## VLANs
# -1- Default (Redacted) [MAIN SSID]
# -4- Guest (SSID: WildWest) [Guest Network 1 - both 2.4 + 5ghz]
# -5- Test (SSID: LoKo) [Guest Network 2 - both 2.4 + 5ghz]
# -6- Infrastructure (SSID: Infra) [Guest Network 3 - both 2.4 + 5ghz]
## Initialize VLANs on physical switchports
##################################
#Robocfg port mapping #
#Model { WAN L1 L2 L3 L4 CPU } #
#RTN16: { 0, 4, 3, 2, 1, 8 } #
#RTAC56U: { 4, 0, 1, 2, 3, 5 } #
#RTN66U: { 0, 1, 2, 3, 4, 8 } # ***
#RTAC66U: { 0, 1, 2, 3, 4, 8 } #
#RTAC68U: { 0, 1, 2, 3, 4, 5 } #
#RTAC87U: { 0, 5, 3, 2, 1, 7 } # ***
#RTAC3200: { 0, 4, 3, 2, 1, 5 } #
##################################
# Remove default VLANs
#vconfig rem vlan 1045
#vconfig rem vlan 1046
#vconfig rem vlan 1047
#vconfig rem vlan 1099
#vconfig rem vlan 1100
#vconfig rem vlan 1101
#vconfig rem vlan 1102
#vconfig rem vlan 1103
robocfg vlan 4 ports "1t 5t 8t"
robocfg vlan 5 ports "1t 5t 8t"
robocfg vlan 6 ports "1t 5t 8t"
## Add VLANs to internal NIC
vconfig add eth0 4
vconfig add eth0 5
vconfig add eth0 6
## Enable VLANs
ifconfig vlan4 up
ifconfig vlan5 up
ifconfig vlan6 up
##Add virtual bridges
brctl addbr br1
brctl addbr br2
brctl addbr br3
## Remove virtual interface from default bridge
brctl delif br0 wl0.1
brctl delif br0 wl0.2
brctl delif br0 wl0.3
#brctl delif br0 wl1.1
#brctl delif br0 wl1.2
#brctl delif br0 wl1.3
## Add interfaces to bridges
#VLAN4
brctl addif br1 wl0.1
#brctl addif br1 wl1.1
brctl addif br1 vlan4
#VLAN5
brctl addif br2 wl0.2
#brctl addif br2 wl1.2
brctl addif br2 vlan5
#VLAN6
brctl addif br3 wl0.3
#brctl addif br3 wl1.3
brctl addif br3 vlan6
## Enable new bridges
ifconfig br1 up
ifconfig br2 up
ifconfig br3 up
## Commit LAN changes to NVRAM
#VLAN1 (default)
nvram set lan_ifnames="vlan1 eth0 eth1"
nvram set lan_ifname="br0"
#VLAN4
nvram set lan1_ifnames="vlan4 wl0.1"
nvram set lan1_ifname="br1"
#VLAN5
nvram set lan2_ifnames="vlan5 wl0.2"
nvram set lan2_ifname="br2"
#VLAN6
nvram set lan3_ifnames="vlan6 wl0.3"
nvram set lan3_ifname="br3"
## Commit Changes
nvram commit
killall eapd
eapd
@edwork
Copy link
Author

edwork commented May 21, 2018

ASUS Merlin services-start script for enabling VLANs over one trunked port, which map to 4 SSIDs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment