Installing OpenWRT on a Mikrotik Hap AC2
Installing OpenWRT on a Mikrotik Hap AC2#
Router: MikroTik RouterBOARD hAP ac² (RBD52G-5HacD2HnD-TC)
You can follow the basic guide on openwrt for mikrotiks
remember to store your RouterOS license
If the default gateway of the device is 192.168.101.1
it may be preconfigured. In which case you should reset it as described in this video
The simplified version is:
- Download the Snapshot and snapshot upgrade. It is important to note that the referenced version on the hap_ac2 page does not include the LuCi browser interface. So it is better to use the files from the firmware selector
-
Boot into a linux OS or Live CD and make sure
dnsmasq
is installeddnsmasq
is best installed from source. To useifconfig
you needsudo apt install net-tools
. You also need to havemake
andgcc
to compile. -
Create this script
loader.sh
(change the user. If your router defaults to192.168.88.1
then this will work - if not make sure to change the network address. Also change thedhcp-boot
to reflect your chosen firmware.):#!/bin/bash USER=ubuntu IFNAME=enp1s0 /sbin/ip addr replace 192.168.88.10/24 dev $IFNAME /sbin/ip link set dev $IFNAME up /usr/sbin/dnsmasq --user=$USER \ --no-daemon \ --listen-address 192.168.88.10 \ --bind-interfaces \ -p0 \ --dhcp-authoritative \ --dhcp-range=192.168.88.100,192.168.88.200 \ --bootp-dynamic \ --dhcp-boot=openwrt-21.02.1-ipq40xx-mikrotik-mikrotik_hap-ac2-initramfs-kernel.bin \ --log-dhcp \ --enable-tftp \ --tftp-root=$(pwd)
The above script is available at openwrt mikrotik netboot Make sure the file is in the same directory as both the init and upgrade file, ensure it is executable and run it:
chmod +x loader.sh sudo bash loader.sh
-
Then make sure your Mikrotik router is in DHCP boot mode
- Connect the router, plug in ethernet into LAN port 2. Go to 192.168.88.1, login.
- System → Routerboard → Settings → Boot device: Try ethernet once then NAND
- System → Routerboard → Settings → Boot protocol: DHCP
- System → Routerboard → Settings → Force Backup Booter: Checked (if supported by your routerboard - !IMPORTANT)
- System → Shutdown. Power down the router.
Hit
Apply
If the above doesn’t work use method 1: reset
-
Put the ethernet cable into WAN port 1
- Start up the router
- The loader script will show a connection (you might need to re-run it). It will say sending file, then sent. Once complete it will output some data…then
sent size
and at the end it will sayserver-identifier 192.168.88.10
or something like that. It takes about 10 minutes. - The router should be running openwrt now - note you must connect with ethernet wifi will not work.
- Test you can ping to it: ping 192.168.1.1
- You cannot telnet but should be able to ssh:
ssh root@192.168.1.1
- Also check if you can get to the Luci browser:
https://192.168.1.1
-
Flash OpenWRT to permanently write openWRT to the device:
- Go to System → Backup/Flash Firmware
- Click on ‘Choose File’ under ‘Flash new firmware image’. Select the sysupgrade .bin file you previously downloaded for your RouterBoard
- Click on ‘Flash image’. This will flash the sysupgrade .bin file into your RouterBoard and reboot it
You have successfully installed OpenWRT on the Mikrotik hap AC2. Now look at the openwrt user guide
Restoring RouterOS onto a Mikrotik OpenWRT#
I did this on ubuntu
Follow these instructions
The important points to note:
-
if you have installed openwrt on the device you will need the keyfile to reinstall:
./netinstall -r -k
.key -a 192.168.88.3 routeros-7.1.1-arm.npk -
You must download the image and netinstall binary marked as
stable
-
Set the static IP:
- Ubuntu -> wired connection -> settings
- Settings -> IPv4 Address: 192.168.88.2 Netmask: 255.255.255.0 Gateway: 192.168.88.1 DNS: 192.168.88.1 (Automatic off)
- Apply
- Turn the toggle on and off
-
Run the script
sudo ./netinstall -r -k
.key -a 192.168.88.3 routeros-7.1.1-arm.npk -
Enable the Etherboot
- Put LAN Cable in ETH1 (Internet/PPPoe)
- take out the power cable
- Press
reset
in and hold - put power cable back in
- Wait for the light to start flashing and then stop (about 20 seconds)
- Release the reset
- Script should start
-
When it is completed it should sat
Sent reboot command
Will reset config Using server IP: 192.168.88.2 Starting PXE server Waiting for RouterBOARD… PXE client: B8:69:F4:83:F9:98 Sending image: arm Discovered RouterBOARD… Formatting… Sending package routeros-7.1.1-arm.npk … Ready for reboot… Sent reboot command