Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://forum.ubnt.com/showthread.php?t=8654&page=2
- #the link must be in WDS mode
- #These script can be placed into the following file and then written to memory.
- #
- ###Code:
- ###
- ###/etc/persistent/rc.poststart
- #
- #Remember if the script isn't quite correct it may brick the radio to a point
- #where you'll need to perform the full reset procedure. We normally run the
- #script manually first which will apply the changes without making them
- #permanent.
- #To commit the changes to the radio type the following and reset...
- #
- ###Code:
- ###
- ###cfgmtd -w -p /etc/
- ###reset
- #----NS5 AP-----------
- #----Vlan Constants----
- MVLAN_ID=1
- VLAN1_ID=4
- VLAN2_ID=2
- #----------------------
- #----IP Address--------
- IP_ADDR=172.31.5.4
- NETMASK=255.255.0.0
- GATEWAY=172.31.31.254
- #----------------------
- #Clear out wireless interface ip address
- ifconfig ath0 0.0.0.0
- #Bring down and destroy default bridge
- ifconfig br0 down
- brctl delif br0 ath0
- brctl delif br0 eth0
- brctl delbr br0
- #
- #--------------------------------------------------------------------
- #Create and configure Management Vlan bridge (Allows pass-thru to SM)
- #--------------------------------------------------------------------
- #Create bridge for management vlan
- brctl addbr br0
- #Add mvlan onto ethernet/wireless interface
- vconfig add eth0 ${MVLAN_ID}
- vconfig add ath0 ${MVLAN_ID}
- #Bring up mvlanned interfaces with defaults
- ifconfig eth0.${MVLAN_ID} 0.0.0.0 up
- ifconfig ath0.${MVLAN_ID} 0.0.0.0 up
- #Attach mvlanned ethernet/wireless interface to bridge
- brctl addif br0 eth0.${MVLAN_ID}
- brctl addif br0 ath0.${MVLAN_ID}
- #Configure ip address for mvlanned bridge
- ifconfig br0 ${IP_ADDR} netmask ${NETMASK} up
- route del default gw 0.0.0.0
- route add default gw ${GATEWAY} br0
- #
- #---------------------------------------------------------------------
- #Create bridge to pass through customer vlans
- #---------------------------------------------------------------------
- #Create bridge for customer vlan1
- brctl addbr br${VLAN1_ID}
- #
- #Add vlan onto wireless/ethernet interfaces
- vconfig add ath0 ${VLAN1_ID}
- vconfig add eth0 ${VLAN1_ID}
- #
- #Bring up vlanned interfaces with defaults
- ifconfig ath0.${VLAN1_ID} 0.0.0.0 up
- ifconfig eth0.${VLAN1_ID} 0.0.0.0 up
- #
- #Attach vlanned wireless/ethernet interface to bridge
- brctl addif br${VLAN1_ID} ath0.${VLAN1_ID}
- brctl addif br${VLAN1_ID} eth0.${VLAN1_ID}
- #
- #Bring up bridge with defaults
- ifconfig br${VLAN1_ID} 0.0.0.0 up
- #Create bridge for customer vlan2
- brctl addbr br${VLAN2_ID}
- #
- #Add vlan onto wireless/ethernet interfaces
- vconfig add ath0 ${VLAN2_ID}
- vconfig add eth0 ${VLAN2_ID}
- #
- #Bring up vlanned interfaces with defaults
- ifconfig ath0.${VLAN2_ID} 0.0.0.0 up
- ifconfig eth0.${VLAN2_ID} 0.0.0.0 up
- #
- #Attach vlanned wireless/ethernet interface to bridge
- brctl addif br${VLAN2_ID} ath0.${VLAN2_ID}
- brctl addif br${VLAN2_ID} eth0.${VLAN2_ID}
- #
- #Bring up bridge with defaults
- ifconfig br${VLAN2_ID} 0.0.0.0 up
- ******************************************************
- #----NS5 SM-----------
- #----Vlan Constants----
- MVLAN_ID=1
- VLAN1_ID=4
- VLAN2_ID=2
- #----------------------
- #----IP Information----
- IP_ADDR=172.31.5.3
- NETMASK=255.255.0.0
- GATEWAY=172.31.31.254
- #----------------------
- #Delete default gateway from device
- route del default gw 0.0.0.0
- #
- #Bring down and destroy default bridge
- ifconfig br0 0.0.0.0
- ifconfig br0 down
- brctl delif br0 ath0
- brctl delif br0 eth0
- brctl delbr br0
- #
- #---------------------------------------------------------------
- #Create and configure Management Vlan
- #---------------------------------------------------------------
- #Add MVlan onto wireless interface and configure ip address
- vconfig add ath0 ${MVLAN_ID}
- ifconfig ath0.${MVLAN_ID} ${IP_ADDR} netmask ${NETMASK} up
- route add default gw ${GATEWAY} ath0.${MVLAN_ID}
- #
- #---------------------------------------------------------------
- #Tag ethernet traffic as it passes to wireless interface
- #---------------------------------------------------------------
- #Create bridge for customer vlan
- brctl addbr br0
- #
- #Add vlan onto wireless interface
- vconfig add ath0 ${VLAN1_ID}
- vconfig add eth0 ${VLAN1_ID}
- #
- #Attach vlanned wireless/untagged ethernet interface to bridge
- brctl addif br0 ath0.${VLAN1_ID}
- brctl addif br0 eth0.${VLAN1_ID}
- #
- #Bring up interfaces with defaults
- ifconfig ath0.${VLAN1_ID} 0.0.0.0 up
- ifconfig eth0.${VLAN1_ID} 0.0.0.0 up
- #
- #Bring up bridges with defaults
- ifconfig br0 up
- #Create bridge for customer vlan 2
- brctl addbr br1
- #
- #Add vlan onto wireless interface
- vconfig add ath0 ${VLAN2_ID}
- vconfig add eth0 ${VLAN2_ID}
- #
- #Attach vlanned wireless/untagged ethernet interface to bridge
- brctl addif br1 ath0.${VLAN2_ID}
- brctl addif br1 eth0.${VLAN2_ID}
- #
- #Bring up interfaces with defaults
- ifconfig ath0.${VLAN2_ID} 0.0.0.0 up
- ifconfig eth0.${VLAN2_ID} 0.0.0.0 up
- #
- #Bring up bridges with defaults
- ifconfig br1 up
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement