Setting up a home router + NAS on unRAID (part 2)

Π’ the first part I talked quite briefly about the assembly itself, which allows you to make a computer on which you can run unRAID to create a NAS and MikroTik RouterOS in a KVM virtual machine as a replacement for a regular router.

The comments turned out to be quite useful discussions, as a result of which it is necessary to correct errors in the initial assembly and write the third part already! Some of the proposed I will try on myself and, I hope, write the third part.

For the initial installation, you will need to connect a monitor, keyboard, and mouse to the server.

Installing unRAID

Go to broker and install unRAID on the USB stick (which I forgot to add to the spreadsheet). Recommendations for flash drives are standard: a normal brand and a larger physical size (for better cooling). UnRAID will boot from this flash drive, so your SSDs will completely go under the cache. More official information here.

Don't forget to enable VT-d and VT-x support in BIOS!

We connect the flash drive to the server and run it in GUI mode.

Default username and password: root without password.

Version at time of writing: 6.7.2

After starting the OS, make sure that all connected hardware is detected. The system should see all your disks (the disks are displayed on the Main tab), two Ethernet controllers and a Wi-Fi card (and this is convenient to see in Tools -> System Devices).

Problem with Marvell SATA controllers

Due to some bug in the Marvell controller driver, they do not work after enabling VT-d in unRAID version 6.7.x.

I chose the simplest solution: added iommu=pt to the parameter string passed to the Linux kernel at boot time. This is done on the Main tab (then click on the β€œFlash” device). Also, you can initially change the config on the flash drive: boot/syslinux/syslinux.cfg

Setting up a home router + NAS on unRAID (part 2)

About Intel vPro

I don't recommend looking for hardware that supports vPro/AMT.

Firstly, for normal remote desktop operation, you need to connect an HDMI-dummy or DP-dummy plug, otherwise the integrated video card will not initialize without a connected monitor.

Secondly, the quality of client software from Intel is extremely low.

Thirdly, you can achieve the same functionality for home use with a wireless or wired HDMI / DP extender and at the same time you will not be limited in the choice of hardware.

Network configuration

Go to Settings -> Network Settings. As you may have guessed, one of the interfaces will look to the local network, the second - to the Internet. First, decide on the one that will be connected to your local network. On my motherboard, there are stickers on the connectors with MAC addresses, that's how I understood who was who.

In a nutshell, what you need to do is assign each interface a member of two separate L2 bridges and set a static IP address on the one connected to the local network. An IP address is not needed on the interface looking on the Internet, RouterOS will deal with it.

Here is what you should get:

Setting up a home router + NAS on unRAID (part 2)

  • 192.168.1.2 - address where unRAID will be available
  • 192.168.0.1 - RouterOS address
  • 192.168.1.3 - pi.hole DNS server address

We can leave the address assignment for eth0 via DHCP, but then in case of any problems in RouterOS, we will not be able to access unRAID and we will need to connect a monitor and keyboard to the server.

After setting up the network, you can switch to remote setting by manually setting the IP address on the LAN client.

Storage setup

To run a virtual machine, you will need storage, so it's time to set it up. I will not describe in detail, since it is quite simple: you need to assign roles to hard drives - one is Disk 1, the other is Parity.

In the first part, I wrote that one SSD is enough, but in fact this is not so: it is better to take two identical ones and create a cache-pool from them, so the data on them will be protected in case one fails. Also, in unRAID there is no mechanism for backing up data from the cache. Everything is described in more detail here.

It should look like this (sorry, I haven't bought a second SSD yet):

Setting up a home router + NAS on unRAID (part 2)

Also, you can immediately set up a schedule for parity checking and data transfer from the cache. This is done on the Settings -> Scheduler page.

It is enough to check the parity once every two months, and transfer data from the cache every night.

You can immediately configure the resources available over the network in the Shares tab:

Setting up a home router + NAS on unRAID (part 2)

Due to the fact that I have only one disk for the cache, domains is unprotected. Everything must be green.

Install RouterOS

First you need to download the installation iso-image hence (choose x86 Stable CD Image) and put it in Towerisos.

Now it's time to create the virtual machine.

Enable support in Settings -> VM Manager. After that, a new tab will appear - VMs, go to it.

Click Add VM, then Linux.

  • Allocate just one core
  • It is enough to allocate 128 or 256 megabytes of memory
  • machine- i440fx-3.1
  • BIOS - SeaBIOS
  • In the OS Install ISO item, select the downloaded image (/mnt/user/isos/mikrotik-6.46.iso)
  • Primary vDisk Size - 256M
  • Primary vDisk Bus - SATA
  • Network Bridge-br0
  • Add a second network interface and select br1
  • If your Wi-Fi card is not displayed in Other PCI Devices, it's okay - write it with pens in the config, if it is displayed - check the box
  • For now, uncheck Start VM after creation and click Create

Remember which MAC addresses which interfaces will receive in order to further match them in RouterOS.

For some reason, automatic port assignment for different VMs did not always work for me, so open the resulting XML config and change the line with the VNC settings to something like this:

<graphics type='vnc' port='5900' autoport='no' websocket='5700' listen='0.0.0.0' keymap='en-us'>
 <listen type='address' address='0.0.0.0'/>
</graphics>

If you, like me, did not see a Wi-Fi adapter in Other PCI Devices, enter it manually. To do this, you need to find out its address on the PCI bus. The easiest way to do this is in Tools -> System Devices, there will be a line:

IOMMU group 23: [168c:003c] 0b:00.0 Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter

Which in my case turns into:

Setting up a home router + NAS on unRAID (part 2)
(sorry, Habr's MD parser for some reason is buggy on this passage, I had to insert a picture)

You can start a VM and connect to it via VNC. Installing RouterOS is very easy! After prompting to select packages, the easiest way is to select all with the key a and finish the installation with the key i, refusing to save the old configuration and agreeing to format the disk.

Setting up a home router + NAS on unRAID (part 2)

After the reboot, enter admin as the login, the password is empty.

Type /interface print and make sure that the system sees all three of your network interfaces (I took a screenshot from an already configured system, where the names are different from the default ones):

Setting up a home router + NAS on unRAID (part 2)

At this stage, you can download winbox, connect to RouterOS by MAC address and perform further configuration through the GUI.

I think that the detailed configuration of RouterOS is beyond the scope of this article, especially since there are a lot of manuals on the Internet, so I suggest that you first do the standard Quick Setup:

Setting up a home router + NAS on unRAID (part 2)

You can connect an Internet cable to a free port and switch the LAN client to automatically obtain an IP address, as well as check the Wi-Fi performance. After making sure that everything works, you can buy and enter the RouterOS license key.

Adding a Linux VM

To work in a more familiar environment, we will create another virtual machine on which we will run your favorite %distro_name%

Still download the ISO image and put it in isos

Go to the already familiar VMs tab, then Add VM, the vast majority of settings can now be left default.

  • BIOS - SeaBIOS
  • In OS Install ISO, select the downloaded image
  • Primary vDisk Size - something around 10-20 GB
  • Unraid Share - the path to the directory that you want to make available to the VM, in my case /mnt/user/shared/
  • Unraid Mount tag shared
  • Network Bridge-br0
  • For now, uncheck Start VM after creation and click Create

All the same, in the config, we edit the VNC server settings:

<graphics type='vnc' port='5901' autoport='no' websocket='5701' listen='0.0.0.0' keymap='en-us'>
 <listen type='address' address='0.0.0.0'/>
</graphics>

Install the system, it should get an IP via DHCP and have access to the Internet.

To make the FS directory available on the host, add to /etc/fstab next line:

shared  /mnt/shared     9p      trans=virtio,version=9p2000.L 0 0

Now you can use familiar services on a familiar Linux machine that will be easily portable to other hardware!

If everything works fine and turns on and off correctly, then you can buy and enter the key for unRAID. Don't forget that it is bound to the flash drive's GUID (although it can be portable). Also, without a license, the automatic launch of the VM will not work.

The final

Thanks for reading to the end!

I tried not to write a lot, but still, in my opinion, it turned out to be quite long. The rest of the unRAID features are quite easy to configure in my opinion, especially since everything is configured with the mouse.

There are good ideas what can be installed on the VM here. I think that everyone has their own needs and it is impossible to deduce some kind of universal list. Although, pi.hole, of course, can be advised to absolutely everyone πŸ™‚

I hope I have enough to continue!

Source: habr.com

Add a comment