ubiquiti vlan Support on Nanostations – example scripts available

860 views

Background
Ubiquiti AirOS 5.5 – How to set management VLAN. Posted on 20/04/2012. First step. Login to device as an administrator user. Second step. Select Network tab ubiquiti vlan We have a management VLAN of 10.10.x.x/16 and realworld IP's for customers NAT'ing on a different VLAN. The Nanostations all end up with default gateway in all configurations of the management VLAN's default gateway so we can reach them all from our NOC.

Example 1 - Tagging all customer traffic on ethernet port onto specific customer ubiquiti vlan  without NAT + Management VLAN 5

#
ubiquiti vlan route del default gw 0.0.0.0
#
ifconfig br0 0.0.0.0
ifconfig br0 down
brctl delif br0 eth0
brctl delif br0 ath0
brctl delbr br0
#
vconfig add ath0 5
ifconfig ath0.5 10.10.1.50 netmask 255.255.0.0 up
#
route add default gw 10.10.254.254 ath0.5
#
brctl addbr br131
vconfig add ath0 131
ifconfig ath0.131 up
brctl addif br131 ath0.131
#
brctl addif br131 eth0
ifconfig br131 0.0.0.0 up

Example 2 - Tagging all customer traffic on ethernet port onto specific customer VLAN with NAT
## NAT onto customer ubiquiti vlan N (management is from customer IP)
#
route del default gw 0.0.0.0
#
ifconfig br0 0.0.0.0
ifconfig br0 down
brctl delif br0 eth0
brctl delif br0 ath0
brctl delbr br0

vconfig add ath0 5
ifconfig ath0.5 222.222.15.38 netmask 255.255.255.128 up
route add default gw 222.222.15.126 ath0.5

iptables -t nat -I POSTROUTING -o ath0.5 -j MASQUERADE
iptables -t nat -D POSTROUTING 2
iptables -t nat -I PREROUTING -i ath0.5 -j PORTFORWARD
iptables -t nat -D PREROUTING 2

Example 3 - Tagging all ingress wireless AP traffic and placing onto VLAN for the likes of hotspot use + Management VLAN

 

################AP Hotspot######################
#
ifconfig ath0 0.0.0.0
ifconfig br0 down
brctl delif br0 ath0
brctl delif br0 eth0
brctl delbr br0
# local IP address on ethernet interface so we can manage while installing
ifconfig eth0 192.168.1.20 netmask 255.255.255.0 up
#
#
vconfig add eth0 5
ifconfig eth0.5 10.10.24.51 netmask 255.255.0.0 up
route del default gw 0.0.0.0
route add default gw 10.10.254.254 eth0.5
#
brctl addbr br10
vconfig add eth0 10
ifconfig eth0.10 0.0.0.0 up
brctl addif br10 eth0.10
ifconfig ath0 0.0.0.0 up
brctl addif br10 ath0
ifconfig br10 up

Example 4 - Downstream 5GHz Backhaul Subscriber unit with above AP connected via ethernet behind, allowing pass-through of necessary VLANs

################5ghz SM###################
#
ifconfig ath0 0.0.0.0
route del default gw 0.0.0.0
#
brctl addbr br5
vconfig add ath0 5
ifconfig ath0.5 up
brctl addif br5 ath0.5
ifconfig br5 10.10.22.51 netmask 255.255.0.0 up
#
route add default gw 10.10.254.254 br5
#
vconfig add eth0 5
ifconfig eth0.5 up
brctl addif br5 eth0.5
#
brctl addbr br10
vconfig add ath0 10
ifconfig ath0.10 up
brctl addif br10 ath0.10
#
vconfig add eth0 10
ifconfig eth0.10 up
brctl addif br10 eth0.10
ifconfig br10 0.0.0.0 up

The fine print

These scripts can be placed into the following file and then written to memory.

/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...

cfgmtd -w -p /etc/
reset

Any other questions please contact me and we will be happy to assist.

Kind Regards

Dan Clark
Technical Manager
UniFone New Zealand Ltd

Tags: #indonesia #Support #Ubiquiti #vlan #wireless