Install Mikrotik From Usb Flash
Lately I've been using Mikrotik routers because they're cheap, powerful, and fast. Most of them have either a USB or MicroSD slot, so you can add enough space to store network boot images right on the router.
- Install Mikrotik From Usb Flash Computer
- Install Mikrotik From Usb Flash Mac
- Download Pictures From Usb Device
I got most of the tips needed from these two articles, and combined them into this step by step guide:
Install Mikrotik From Usb Flash' title='Install Mikrotik From Usb Flash' />Ubiquiti Uni. Fi AC Outdoor Mesh Access Point. Hardware Overview Compact Form Factor The Uni. TFjESjO0_s/VLtlMK8aP1I/AAAAAAAAAiw/IfirAS9aZ0I/s1600/install3.png' alt='Install Mikrotik From Usb Flash' title='Install Mikrotik From.
Prerequisites
- A Mikrotik device running RouterOS, login info, and SSH client
- A deployment computer: A computer with the Windows Assessment and Deployment Kit (Windows ADK) installed.
- A 1GB or larger USB drive or MicroSD card compatible with your Mikrotik router
Prepare the drive
First, let's make sure the USB drive can be detected and formatted on the Mikrotik device.
- Verify the disk is found with
/disk print
- Format it with
/disk format-drive
. If it's already mounted, you need to eject it first with/disk eject-drive
- Now that it's formatted, go ahead and eject it with
/disk eject-drive #
then plug it into your Windows machine where you have the ADK installed.
Copy Windows PE files to USB drive
Note: If you want more details on these steps, please see the original source Configure a PXE server to load Windows PE. These are copied from that article but adjusted to use a USB drive instead of a remote fileserver.
Prepare Windows PE boot files
On the deployment computer, click Start, and type deployment.
Right-click Deployment and Imaging Tools Environment and then click Run as administrator. The Deployment and Imaging Tools Environment shortcut opens a Command Prompt window and automatically sets environment variables to point to all the necessary tools.
Run the following command to copy the base Windows PE files into a new folder. The script requires two arguments: hardware architecture (amd64) and destination location (a temporary folder - I used c:winpe_amd64).
The script creates the destination directory structure and copies all the necessary files for that architecture. In the previous example, the following directories are created:
Mount the base Windows PE image (winpe.wim) to the mount directory using the DISM tool. Mounting an image file unpacks the file contents into a folder so that you can make changes directly or by using tools such as DISM. See the following example.
Verify that 'The operation completed successfully' is displayed.
Make a folder on your USB drive or MicroSD card called 'tftp'. I will be using
e:tftp
below.Copy the PXE boot files from the mounted directory to the boot folder. For example:
Copy the boot.sdi file to the PXE/TFTP server.
Copy the bootable Windows PE image (boot.wim) to the boot folder.
(Optional) Copy true type fonts to the boot folder
Configure boot settings and copy the BCD file
Create a BCD store using bcdedit.exe:
Configure RAMDISK settings:
The last command will return a GUID, for example:
Copy this GUID to your clipboard, you will need it in the next step.
Create a new boot application entry for the Windows PE image:
Important replace the GUID in the first line below with your GUID.
Configure BOOTMGR settings:
Copy the BCD file to your USB drive:
You can view the BCD settings that have been configured using the command bcdedit /store <BCD file location> /enum all. See the following example. Note: Your GUID will be different than the one shown below.
That's it for copying files! Now it's time to clean up and unmount the USB drive.
Install Mikrotik From Usb Flash Computer
- Unmount the WIM
- (Optional) Clean up the WinPE temporary directory
If you don't plan to use or modify this WinPE image, clean it up to save space:
- Eject the USB drive and move it back to the router
Install Mikrotik From Usb Flash Mac
You're done with the steps on your PC!
Configure TFTP on your Mikrotik
Plug in the USB drive or MicroSD card
Find the new files with
/file print
Make sure all the boot and WinPE files are there. Here's a trimmed list showing them on my router. Since I'm using a USB drive they're prefixed with disk1/
:
Watch out for files over 32Mb such as boot.wim - you'll need to adjust the settings for them later.
- Find the IP subnet you want to boot from
Use /ip pool print
to list the IP address pools.
I only have one pool configured on this router, which is the subnet 192.168.88.0/24
. That address is needed when configuring the tftp server.
- Map the files in the tftp server
Each one of these files need to be mapped from a real path on the router such as disk1/tftp/bcd
to the request path for the network boot clients such as /bcd
.
Switch to the tftp server configuration context with /ip tftp
For each file, run add ip-addresses=<ip>/<subnet> real-filename=... req-filename=...
Now, adjust the settings for any files > 32 MB and set allow-rollover=yes
. In this list, it's just boot.wim.
Get the file numbers with print
, then find boot.wim
in that list.
Number 12 needs to be modified, so run set numbers=12 allow-rollover=yes
- Add boot options to DHCP server
Find the right DHCP configuration. Change to the DHCP config with /ip dhcp-server network
, then print
to see the settings
Add the new options with set <number> next-server=<router ip> boot-file-name=boot/pxeboot.n12
, then run print detail
again to check your settings
TODO's
Download Pictures From Usb Device
- Change boot image to bootx64.efi?
copy C:winpe_amd64mediaEFIBootbootx64.efi e:tftpbcdedit /store c:winpe_amd64bcd /set '{d318e932-1717-11e7-9c5d-94659c579f96}' path windowssystem32bootwinload.eficopy c:winpe_amd64bcd e:tftpbcd
[admin@MikroTik] /ip dhcp-server network> set 0 boot-file-name=boot/bootx64.efi[admin@MikroTik] /ip dhcp-server network> /ip tftp[admin@MikroTik] /ip tftp> addallow comment ip-addresses reading-window-sizeallow-overwrite copy-from place-before real-filenameallow-rollover disabled read-only req-filename[admin@MikroTik] /ip tftp> add ip-addresses=192.168.88.0/24 reread-only reading-window-size real-filename req-filename[admin@MikroTik] /ip tftp> add ip-addresses=192.168.88.0/24 rearead-only reading-window-size real-filename[admin@MikroTik] /ip tftp> add ip-addresses=192.168.88.0/24 real-filename=disk1/tftp/bootx64.efi req-filename=boot/bootx64.efi[admin@MikroTik] /ip tftp> printFlags: X - disabled
0 192.168.88.0/24 boot/abortpx... disk1/tftp/... yes yes no 01 192.168.88.0/24 boot/bootmgr... disk1/tftp/... yes yes no 02 192.168.88.0/24 boot/hdlscom... disk1/tftp/... yes yes no 03 192.168.88.0/24 boot/hdlscom... disk1/tftp/... yes yes no 04 192.168.88.0/24 boot/hdlscom... disk1/tftp/... yes yes no 05 192.168.88.0/24 boot/hdlscom... disk1/tftp/... yes yes no 06 192.168.88.0/24 boot/pxeboot... disk1/tftp/... yes yes no 367 192.168.88.0/24 boot/pxeboot... disk1/tftp/... yes yes no 318 192.168.88.0/24 boot/WdsConf... disk1/tftp/... yes yes no 09 192.168.88.0/24 boot/wdsmgfw... disk1/tftp/... yes yes no 410 192.168.88.0/24 boot/wdsnbp.com disk1/tftp/... yes yes no 011 192.168.88.0/24 boot/boot.sdi disk1/tftp/... yes yes no 012 192.168.88.0/24 boot/boot.wim disk1/tftp/... yes yes yes 013 192.168.88.0/24 boot/Fonts/c... disk1/tftp/... yes yes no 014 192.168.88.0/24 boot/Fonts/c... disk1/tftp/... yes yes no 015 192.168.88.0/24 boot/Fonts/j... disk1/tftp/... yes yes no 016 192.168.88.0/24 boot/Fonts/k... disk1/tftp/... yes yes no 017 192.168.88.0/24 boot/Fonts/m... disk1/tftp/... yes yes no 018 192.168.88.0/24 boot/Fonts/m... disk1/tftp/... yes yes no 019 192.168.88.0/24 boot/Fonts/m... disk1/tftp/... yes yes no 020 192.168.88.0/24 boot/Fonts/m... disk1/tftp/... yes yes no 021 192.168.88.0/24 boot/Fonts/m... disk1/tftp/... yes yes no 022 192.168.88.0/24 boot/Fonts/m... disk1/tftp/... yes yes no 023 192.168.88.0/24 boot/Fonts/m... disk1/tftp/... yes yes no 024 192.168.88.0/24 boot/Fonts/m... disk1/tftp/... yes yes no 025 192.168.88.0/24 boot/Fonts/s... disk1/tftp/... yes yes no 026 192.168.88.0/24 boot/Fonts/s... disk1/tftp/... yes yes no 027 192.168.88.0/24 boot/Fonts/s... disk1/tftp/... yes yes no 028 192.168.88.0/24 boot/Fonts/w... disk1/tftp/... yes yes no 029 192.168.88.0/24 boot/bcd disk1/tftp/bcd yes yes no 030 192.168.88.0/24 boot/bootx64... disk1/tftp/... yes yes no 0