Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bramford/781321e4cfd726730b68bb3adee36fa9 to your computer and use it in GitHub Desktop.
Save bramford/781321e4cfd726730b68bb3adee36fa9 to your computer and use it in GitHub Desktop.
Install OpenWRT on Mikrotik hEX (RB750Gr3) using dnsmasq to provide DHCP/BOOTP/TFTP server
# These instructions assume the user is following the TL;DR guide for Mikrotik install:
# https://openwrt.org/toh/mikrotik/common
# 'Step-By-Step OpenWrt Installation Process on Routerboard'
# 'TL;DR: simple way for all supported models'
# Complete steps 1-4 of the guide
# On Debian host (in my case, a Lenovo Thinkpad running Debian Buster)
## Ensure WiFi is connected (as assumed) to an existing network with a WAN connection
## Take down the Wired connection
nmcli c down Wired Connection 1
## Add IP range for Mikrotik default to ethernet interface (in case you have to repeat steps 1-4)
ip addr add 192.168.88.5/24 dev enp0s25
## Add IP range for OpenWRT default to ethernet interface
ip addr add 192.168.1.200/24 dev enp0s25
## Install dnsmasq and stop/disable the systemd service
sudo apt install dnsmasq
systemctl stop dnsmasq
systmectl disable dnsmasq
## Create tftp dir
sudo mkdir -p /srv/tftp
## Download openWRT install firmware (initramfs-kernel.bin) for hEX from https://openwrt.org/toh/mikrotik/mikrotik_rb750gr3
wget https://downloads.openwrt.org/snapshots/targets/ramips/mt7621/openwrt-ramips-mt7621-mikrotik_rb750gr3-initramfs-kernel.bin
## Download openWRT upgrade firmware (sysupgrade.bin file) for hEX from https://openwrt.org/toh/mikrotik/mikrotik_rb750gr3
wget https://downloads.openwrt.org/snapshots/targets/ramips/mt7621/openwrt-ramips-mt7621-mikrotik_rb750gr3-squashfs-sysupgrade.bin
## Copy the binary to /srv/tftp
sudo cp openwrt-ramips-mt7621-mikrotik_rb750gr3-initramfs-kernel.bin /srv/tftp/
## Start the dnsmasq DHCP/BOOTP/TFTP server
## Be sure to change the --dhcp-host mac address (from 74:4d:28:aa:bb:cc) to that of your mikrotik router's wan interface
sudo dnsmasq -kd -p 0 -C /dev/null -u nobody --enable-tftp --interface=enp0s25 --dhcp-range=192.168.88.50,192.168.88.100,255.255.255.0,1h --dhcp-boot=/srv/tftp/openwrt-ramips-mt7621-mikrotik_rb750gr3-initramfs-kernel.bin -tftp-root=/srv/tftp --dhcp-host=74:4d:28:aa:bb:cc,192.168.88.10
# Complete steps 6-10 of the guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment