How To Setup My UniFi Using Mikrotik RB751U-2HnD and Linksys WRT54GS v4 DD-WRT

I wanted to share with you my TM UniFi setup at my house. You can refer to the simple diagram below on how my TM UniFi setup at my house. The fibre cable is installed on the top floor of my house. I replaced the D-Link DIR-615 provided by TM with Mikrotik RB751U-2HnD. To achieve watching TM HyppTV (IPTV) as well as wireless web browsing on the ground floor, I put a Linksys WRT54GS v4 DD-WRT on the ground floor by connecting it to Mikrotik RB751U-2HnD via TP-Link Homeplug Powerline Ethernet Adapter Starter Kit.

Lets start configuring the Mikrotik RB751U-2HnD as below.

/interface vlan
add arp=enabled disabled=no interface=ether1-gateway l2mtu=1596 mtu=1500 name=vlan.500 use-service-tag=no vlan-id=500
add arp=enabled disabled=no interface=ether1-gateway l2mtu=1596 mtu=1500 name=gwvlan.600 use-service-tag=no vlan-id=600
add arp=enabled disabled=no interface=ether5-slave-local l2mtu=1594 mtu=1500 name=vlan.592 use-service-tag=no vlan-id=592
add arp=enabled disabled=no interface=ether5-slave-local l2mtu=1594 mtu=1500 name=vlan.600 use-service-tag=no vlan-id=600

/interface bridge
add admin-mac=00:0C:42:E4:63:3D ageing-time=5m arp=enabled auto-mac=yes disabled=no forward-delay=15s l2mtu=1594 max-message-age=20s mtu=1500 name=bridge-local priority=0x8000 protocol-mode=none transmit-hold-count=6
add admin-mac=00:00:00:00:00:00 ageing-time=5m arp=enabled auto-mac=yes disabled=no forward-delay=15s l2mtu=1594 max-message-age=20s mtu=1500 name=UniFi-IPTV priority=0x8000 protocol-mode=none transmit-hold-count=6

/interface bridge port
add bridge=bridge-local disabled=no edge=auto external-fdb=auto horizon=none interface=wlan1 path-cost=10 point-to-point=auto priority=0x80
add bridge=bridge-local disabled=no edge=auto external-fdb=auto horizon=none interface=ether2-master-local path-cost=10 point-to-point=auto priority=0x80
add bridge=bridge-local disabled=no edge=auto external-fdb=auto horizon=none interface=vlan.592 path-cost=10 point-to-point=auto priority=0x80
add bridge=UniFi-IPTV disabled=no edge=auto external-fdb=auto horizon=none interface=vlan.600 path-cost=10 point-to-point=auto priority=0x80
add bridge=UniFi-IPTV disabled=no edge=auto external-fdb=auto horizon=none interface=gwvlan.600 path-cost=10 point-to-point=auto priority=0x80

/interface bridge settings
set use-ip-firewall=no use-ip-firewall-for-pppoe=no use-ip-firewall-for-vlan=no

/ip firewall nat
add action=masquerade chain=srcnat comment="default configuration" disabled=no out-interface=UniFi-Internet

/ip firewall filter
add action=reject chain=input comment="default configuration" disabled=no in-interface=UniFi-Internet reject-with=icmp-network-unreachable

/ip pool
add name=default-dhcp ranges=192.168.88.51-192.168.88.60

/ip dhcp-server
add address-pool=default-dhcp authoritative=after-2sec-delay bootp-support=static disabled=no interface=bridge-local lease-time=3d name=default

/ip dhcp-server network
add address=192.168.88.0/24 comment="default configuration" dns-server=8.8.8.8,8.8.4.4 gateway=192.168.88.1

/ip dns
set allow-remote-requests=yes cache-max-ttl=1w cache-size=2048KiB max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4

/interface pppoe-client
add ac-name="" add-default-route=yes allow=pap,chap,mschap1,mschap2 dial-on-demand=no disabled=no interface=vlan.500 max-mru=1492 max-mtu=1492 mrru=disabled name=UniFi-Internet password=PASSWORD1234567890 profile=default service-name="" use-peer-dns=no user=username@unifi

Next, start configuring Linksys WRT54GS v4 to achieve VLAN tagging of using 3 digit VLAN number because it is understood that with the stock DD-WRT it only works with 802.11Q VLAN 0 to 15. I am using DD-WRT v24-sp2 (12/08/11) vpn-small – build 17990M VINT Eko. By changing the original switch-robo.o module with the new from DD-WRT forum post, VLAN number greater than 15 will work. I downloaded the pre-compiled switch-robo.o module from this Linksys WRT54GL VLAN tagging post. In DD-WRT, you need to enable JFFS. Goto Administration, Management, JFFS2 Support and JFFS2 enable. Reboot the Linksys router after successful modification.

Telnet to the Linksys router and run the commands below: –

# cd /jffs
# wget http://www.freqoflife.com/switch-robo.o
# chmod a+r switch-robo.o

Now you need to create a startup script. Goto Administration and Commands. Enter the following below and save startup. Reboot the Linksys router after successful modification.

rmmod switch-robo
insmod /jffs/switch-robo.o
sleep 10
vconfig add eth0 592
vconfig add eth0 600
ifconfig vlan592 up
ifconfig vlan600 up
brctl addif br0 vlan592
sleep 5
echo "1 2 3t 5t" > /proc/switch/eth0/vlan/592/ports
sleep 5
echo "0 3t 5t" > /proc/switch/eth0/vlan/600/ports

Finally, with all the configuration above I hope you are able to use and enjoy your UniFi. Thank you.