Что такое netinstall linux

Обновлено: 03.07.2024

Недавно мне потребовалось установить Debian на старый компьютер найденый в закромах (AMD 650Mhz, 256Mb, 4.3G). Компьютер предназначался для работы в качестве роутера спутникового интернета, о настройке которого я напишу в другой статье.

В компе не было никакого оптического привода, а вытаскивать свой было лень.

Было принято решение ставить с флешки. Я использовал два способа:

Способ первый — UNetbootin (универсальный)

Вкратце, программа может сама скачивать популярные дистрибутивы, ей можно скормить ISO, или можно скормить сразу ядро с параметрами для вызова. После этого она сама скачает и распакует исошку (если надо), положит на флешку, и добавит загрузчик на флешку. Очень удобно и интуитивно.

Для загрузки с флешки Unetbootin использует загрузчик syslinux, с которым все хорошо, кроме того что он не понимает FAT32. Искать как отформатировать 4GB флешку в FAT под виндой мне было лень и я перешел к способу №2.

Способ второй — boot.img.gz (тестировал только Debian)

Для второго способа я использовал виртуальную машину с тем же Debian (да, я мог бы отформатировать флешку там, но мысль пошла в другую сторону :) ).

Берем с диска или скачиваем boot.img.gz для своего дистрибутива, после чего делаем так:

zcat boot.img.gz > /dev/sda

Вместо /dev/sda ваша USB флешка.

Теперь при загрузке с флешки запустится скрипт который будет искать все ISO на всех доступных ему дисках и предложит выбрать с какого грузится! В моем случае образ был только один и все прошло автомагически :) Возможно, если в ISO будет другой дистрибутив (не Debian) все пойдет так же отлично. (см. update)

Проблеммы: на флешке будет досупно чуть более 160Мb (можно что бы все место было доступно, см. update), поэтому поместить на нее что либо кроме netinst версии дистрибутива не получится, но так как я всегда использую именно его, меня это полностью устраивало.

Как решение проблеммы можно предложить вставить вторую флешку уже с полноценными ISO.

Netinstall is a tool for installing and reinstalling MikroTik devices running RouterOS. Always try using Netinstall if you suspect that your device is not working properly. The tool is available for Windows (with a graphical interface) and for Linux (as a command line tool).

In short, the Netinstall procedure goes like this: Connect your PC directly to the boot port (Usually Ether1, the port labeled BOOT or as otherwise indicated in the product manual) of the device you will be reinstalling. Turn on the device while holding the reset button until it shows up in the Netinstall tool.

Careful. Netinstall re-formats the system's drive, all configuration and saved files will be lost. Netinstall does not erase the RouterOS license key, nor does it reset RouterBOOT related settings, for example, CPU frequency is not changed after reinstalling the device.

    Download Netinstall from the downloads page. If you are not sure which version you need, then you can always select the version that is marked as Current (stable);

Download the RouterOS Main package from the downloads page;

You must choose a RouterOS version. You can always select the version that is marked as Current . You must also select the architecture (ARM, MIPS, SMIPS, TILE, etc. ), but if you are not sure, then you can download the RouterOS package for ALL architectures, Netinstall will choose the right architecture for you.

Disconnect your computer from WiFi, Ethernet, LTE, or any other type of connection! Netinstall will only work on one active interface on your computer, it is highly recommended that you disconnect any other network interfaces in order to be sure that Netinstall will select the right network interface.

Configure a static IP address for your Ethernet interface, open Start, and select Settings :


Netinstall can run also on a local network, in such case you could skip setting a static IP address, but it is highly recommended that you set a static IP address if you are not familiar with Netinstall.

  • Open Network & Internet and select Change adapter options



  • Right-click on your Ethernet interface and select Properties


  • Select Internet Protocol Version 4 (TCP/IPv4) and click Properties


  • Check Use the following IP address and fill out the fields as shown in the image below


If you have a working router, then you can use it and skip the setting up a static IP part of this tutorial, but it requires you to know your LAN address since you will need to specify an unused IP address in your network for the network boot server. For this reason it is recommended to apply a static IP address and follow this guide precisely, if you are not sure how to get these parameters out of your network.

  • Open your Downloads folder (or wherever you saved the downloaded files) and extract the Netinstall .zip file to a convenient place



Run Netinstall.exe. If you followed the guide precisely, then you should not have any Internet connection on your computer, Windows 10 wants to verify all apps that it runs, but will not be able to do it since lack of the Internet connection, for this reason, a warning might pop up, you should click Run.


Netinstall requires administrator rights, there should be a window asking for permissions to run Netinstall, you must accept these permissions in order for Netinstall to work properly.

  • Allow access for Netinstall in Public networks and configure Net booting settings and fill out the required fields as shown in the image below



The Client IP address must be unique! Don't use an existing IP address in your network, this also means that you should not use the computer's IP address as well. Use a completely different IP address from the same subnet.
  • Connect your device to your computer using an ethernet cable directly (without any other devices in-between), plug the Ethernet cable into your device's Etherboot port.
  • MikroTik devices are able to use Netinstall from their first port (Ether1), or from the port marked with "BOOT".



Some computers have a network interface (especially USB Ethernet adapters) that tend to create an extra link flap, which is enough for Netinstall to fail to detect a device that is in Etherboot mode. In such a case you can use a switch between your device and your computer or a router in bridge mode to prevent this issue.

  • Power up your device and put it into e therboot mode

There are multiple ways how to put your device into Etherboot mode. Make sure you read the Etherboot manual before trying to put the device into this mode. Methods vary between different MikroTik devices.

  • Wait for the device to show up in Netinstall, select it and press Browse. Navigate to your Downloads folder (or wherever you saved your RouterOS packages) and press OK



  • Select your desired RouterOS version and press Install. Wait for the installation to finish and press "Reboot" (Devices without serial console have to be rebooted manually)

If you downloaded RouterOS packages for multiple architectures, then Netinstall will only show the appropriate architecture packages for your device after you have selected it. All unsupported packages will not show up in this window after you have selected a device.



If the installation does not start (progress bar is not moving or no status is shown), then you can try closing the Netinstall application and opening it up again or try to put the device into Etherboot mode again. If you are still unable to get Netinstall working, then you should try using it on a different computer since there might be an operating system's issue that is preventing Netinstall from working properly.

  • You are done! Remove the device from power, remove the Ethernet cable, place the device back in your network and your device should be running properly now!

After using Netinstall the device will be reset to defaults (unless you specified not to apply default configuration). Some devices are not accessible through ether1 port with the default configuration for security reasons. Read more about Default configuration .

When using the Configure script option, it is suggested to introduce a delay before configuration execution.

The Linux version is a command line tool, which offers nearly the same parameters as the Windows counterpart.

Download the tool from our download page (links not literal):

The available parameters are as follows:

Etherboot mode is a special state for a MikroTik device that allows you to reinstall your device using Netinstall . There are several ways to put your device into Etherboot mode depending on the device you are using.

Reset button

The Reset can be found on all MikroTik devices, this button can be used to put the device into Etherboot mode. An easy way to put a device into Etherboot mode using the Reset button is by powering off the device, hold the Reset button, power on the device while holding the Reset button and keep holding it until the device shows up in your Netinstalll window.


If you have set up a Protected bootloader , then the reset button's behavior is changed. Make sure you remember the settings you used to set up the Protected bootloader, otherwise you will not be able to use Eterboot mode and will not be able to reset your device.

RouterOS

If your device is able to boot up and you are able to log in, then you can easily put the device into Etherboot mode. To do so, just connect to your device and execute the following command:

After that either reboot the device or do a power cycle on the device. Next time the device will boot up, then it will first try going into Etherboot mode. Note that after the first boot up, the device will not try going into Etherboot mode and will boot directly of NAND or of the storage type the device is using.

Serial console

Some devices come with a serial console that can be used to put the device into Etherboot mode. To do so, make sure you configure your computer's serial console. The required parameters for all MikroTik devices (except for RouterBOARD 230 series) are as following:

For RouterBOARD 230 series devices the parameters are as following:

Make sure you are using a proper null modem cable, you can find the proper pinout here. When the device is booting up, keep pressing CTRL+E on your keyboard until the device shows that it is trying bootp protocol:

At this point your device is in Etherboot mode, now the device should show up in your Netinstall window.

Netinstall is a tool designed for Windows operating systems to reinstall MikroTik devices running RouterOS (except for non-MikroTik x86 devices). Netinstall re-formats the device's disk and copies over fresh files on to the system's disk, this can solve multiple issues when your device is not working properly. Always try using Netinstall if you suspect that your device is not working properly.

Warning: Netinstall re-formats the system's drive, all configuration and saved files will be lost. Netinstall does not erase the RouterOS license key, nor does it reset RouterBOOT related settings, for example, CPU frequency is not changed after reinstalling the device.

Note: You must choose a version for the Netinstall. If you are not sure, then you can always select the version that is marked as Current (stable).

  • Download RouterOS Main package from our downloads page.

Note: You must choose a RouterOS version. You can always select the version that is marked as Current. You must also select the architecture (ARM, MIPS, SMIPS, TILE, etc. ), but if you are not sure, then you can download the RouterOS package for ALL architectures, Netinstall will choose the right architecture for you.

  • Disconnect your computer from WiFi, Ethernet, LTE or any other type of connections!

Warning: Netinstall will only work on one active interface on your computer, it is highly recommended that you disconnect any other network interfaces in order to be sure that Netinstall will select the right network interface.

  • Configure a static IP address for your Ethernet interface, open Start and select Settings:

Netinstall Win10 4.jpg

Note: Netinstall can run also on a local network, in such case you could skip setting a static IP address, but it is highly recommended that you set a static IP address if you are not familiar with Netinstall.

Netinstall Win10 5.jpg

Netinstall Win10 6.jpg

  • Right click on your Ethernet interface and select Properties

Netinstall Win10 7.jpg

  • Select Internet Protocol Version 4 (TCP/IPv4) and click Properties

Netinstall Win10 8.jpg

  • Check Use the following IP address and fill out the fields as shown in the image below

Netinstall Win10 9.jpg

Note: It you have a working router, then you can use it and skip the setting up a static IP part of this tutorial, but it requires for you to know your LAN address since you will need to specify an unused IP address in your network for the Network boot server. For this reason it is recommended to apply a static IP address and follow this guide precisely, if you are not sure how to get these parameters out of your network.

  • Open your Downloads folder (or wherever you saved the downloaded files) and extract the Netinstall .zip file to a convenient place

Netinstall Win10 1.jpg

Netinstall Win10 2.jpg

Netinstall Win10 3.jpg

Note: If you followed the guide precisely, then you should not have any Internet connection on your computer, Windows 10 wants to verify all apps that it runs, but will not be able to do it since lack of the Internet connection, for this reason a warning might pop up, you should click Run.

Netinstall Win10 10.jpg

Warning: Netinstall requires administrator rights, there should be a window asking for permissions to run Netinstall, you must accept these permissions in order for Netinstall to work properly.

  • Allow access for Netinstall in Public networks

Netinstall Win10 11.jpg

  • Configure Net booting settings and fill out the required fields as shown in the image below

Netinstall Win10 12.jpg

Warning: The Client IP address must be unique! Don't use an existing IP address in your network, this also means that you should not use the computer's IP address as well. Use a completely different IP address from the same subnet.

  • Connect your device to your computer using an Ethernet cable directly (without any other devices in-between), plug the Ethernet cable into your device's Etherboot port. Most commonly, RouterBOARD devices are able to use Netinstall from their first port (Ether1), or from the port marked with "BOOT".

Netinstall Win10 18.jpg

Warning: Some computer's have a network interface (especially USB Ethernet adapters) that tend to create an extra link flap, which is enough for Netinstall to fail to detect a device that is in Etherboot mode. In such case you can use a switch between your device and your computer or a router in bridge mode to prevent this issue.

Note: There are multiple ways how to put your device into Etherboot mode. Make sure you read the Etherboot manual before trying to put the device into this mode. Methods vary between different MikroTik devices.

  • Wait for the device to show up in Netinstall, select it and press Browse.

Netinstall Win10 13.jpg

Note: If the device does not show up in this window, then you can try closing the Netinstall application and opening it up again or try to put the device into Etherboot mode again.

  • Navigate to your Downloads folder (or wherever you saved your RouterOS packages) and press OK

Netinstall Win10 14.jpg

  • Select your desired RouterOS version and press Install

Note: If you downloaded RouterOS packages for multiple architectures, then Netinstall will only show the appropriate architecture packages for your device after you have selected it. All unsupported packages will not show up in this window after you have selected a device.

Netinstall Win10 15.jpg

  • Wait for the installation to finish and press "Reboot" (Devices without serial console have to be rebooted manually)

Netinstall Win10 17.jpg

Note: If the installation does not start (progress bar is not moving or no status is shown), then you can try closing the Netinstall application and opening it up again or try to put the device into Etherboot mode again. If you still unable to get Netinstall working, then you should try using it on a different computer since there might be an operating system's issue that is preventing Netinstall from working properly.

  • You are done! Remove the device from power, remove the Ethernet cable, place the device back in your network and your device should be running properly now!

Note: After using Netinstall the device will be reset to defaults (unless you specified not to apply default configuration). Some devices are not accessible through ether1 port with the default configuration for security reasons. Read more about Default configuration.

Note: When using the Configure script option, it is suggested to introduce delay before configuration execution.

Hard: "MikroTik RB/CCR".
OS: "Linux Debian/RedHat", "RouterOS v6".
Apps: "Wine", "Netinstall".

Задача: руководствуясь официальной инструкцией ориентированной на применение в операционных системах "MS Windows" выработать свой подход, для использования в ОС "Linux".

Загрузка необходимого программного обеспечения.

Для работы потребуется полноценная графическая оболочка вроде "LXDE", "XFCE" или "KDE" - только лишь из командной строки наша задача не решается.

Прежде всего на стороне условного сервера инсталляции развернём среду запуска "MS Windows"-приложений, а также библиотеку расширения стандарта POSIX "capabilities".

Для "Linux Debian/Ubuntu":

Для "Linux RedHat/CentOS/Fedora":

Запускаем браузер, идём на сайт разработчиков программного обеспечения для маршрутизаторов "Mikrotik" и загружаем предназначенную для переустановки устройств под управлением "RouterOS" утилиту "Netinstall" - ищем её в блоке программного обеспечения для этой платформы:

Заодно скачиваем дистрибутив "Main packages" (в нашем примере "routeros-mipsbe-6.44.1.npk"), который впоследствии установим посредством утилиты "Netinstall" на целевое устройство.

Утилита "Netinstall" не нуждается в процедуре установки - это монолитное приложение, просто запускаемое на исполнение из любого места файловой системы и не оставляющее следов своей деятельности.

Подготовка сервера инсталляции.

При инсталляции используется группа протоколов BOOTP/PXE/TFTP поверх IP/UPD, и для их работы на сервере инсталляции достаточно настроенного LAN-интерфейса, через который будет осуществляться взаимодействие в целевым устройством. Для согласования клиент-серверных взаимодействий посредством протокола BOOTP (Bootstrap Protocol) требуется указание адреса "шлюза" (возможно несуществующего в действительности) в конфигурации сетевого интерфейса компьютера, на котором осуществляется запуск PXE-сервера (Preboot eXecution Environment) - например следующей адресации:

В GUI типового "Network Manager" установка параметров IP-протокола для сетевого интерфейса выглядит примерно так:

Параметры IP-протокола в GUI "Network Manager".

Диапазон адресации между сервером инсталляции и клиентом неважен (например в инструкции разработчиков утилиты "Netinstall" используется подсеть IPv4:192.168.88.0/24) - главное, чтобы задействуемые адреса не конфликтовали с возможно уже используемыми.

Включаем сервер инсталляции и целевой "Mikrotik" в одну L2-сеть - лучше всего проводом напрямую, без посредников. Иногда возможность PXE-загрузки целевого устройства ограничена первым (eth1) сетевым интерфейсом или иным, отмеченным подписью "Boot" - лучше сразу проверить это и включиться в нужный.

Запуск утилиты "Netinstall" в "Wine" и активация PXE-сервера.

Это обходится грубым запуском посредством SUDO или точечным разрешением посредством расширения стандарта POSIX "capabilities" ответственному в "Wine" за сеть приложению открывать порты ниже порога по умолчанию:

Удостоверимся, что расширенные разрешения успешно применены:

Запускаем утилиту "Netinstall" посредством "Wine":

В GUI-интерфейсе "Netinstall" активируем PXE-сервер и задаём IP-адрес, который должен будет назначен целевому устройству "Mikrotik" в процессе согласования параметров соединения с ним посредством протокола BOOTP:

Активация PXE-сервера в GUI "Netinstall" (Mikrotik).

Main -> Net booting - > Boot Server enabled: true
Main -> Net booting - > Client IP address: 172.16.1.11

Обновление ПО (прошивка) "Mikrotik".

Необязательно, но желательно для наблюдения за процессом загрузки и обновления на стороне "Mikrotik" подключиться к устройству через "последовательный порт (serial port)" RS-232 (кабелем DB-9):

$ minicom --device /dev/ttyUSB0 --baudrate 115200 --8bit --noinit

Уже сейчас можно запустить "Mikrotik" в режиме загрузки по сети "Etherboot" и попробовать пройти процедуру инсталляции:

1. Выключаем питание.
2. Зажимаем кнопку "Reset".
3. Удерживая кнопку "Reset" включаем питание.
4. Отпускаем кнопку "Reset" после завершения мигания индикатора загрузки (ожидаем не менее десяти секунд с момента подачи электропитания).

Через заранее установленное посредством RS-232 подключение в интерфейсе "minicom" наблюдаем за процессом согласования сетевых параметров BOOTP и получения от PXE-сервера загрузочного программного модуля посредством TFTP (Trivial File Transfer Protocol):

RouterBOOT backup booter 3.22
.

trying bootp protocol. OK
resolved mac address 60:EB:69:xx:xx:xx
transfer started . transfer ok, time=2.38s
setting up elf image. OK
jumping to kernel code

Далее управление "Mikrotik" автоматически передаётся полученному от PXE-сервера программному модулю загрузки, который должен будет посредством TFTP доставить на устройство полноценный дистрибутив и произвести необходимые изменения в конфигурации:

Welcome to MikroTik Router Software remote installation 6.44.1
Press Ctrl-Alt-Delete to abort

Waiting for installation server.
.
Found server at 60:EB:69:xx:xx:xx

Вывод выше даёт нам понять, что "Mikrotik" успешно соединился с PXE-сервером и готов принять от него управляющие команды и данные для загрузки. При этом в окне "Netinstall" целевое устройство должно отобразится в списке доступных для инсталляции "Routers/Drives".

В GUI-интерфейсе "Netinstall" выбираем месторасположение дистрибутива, который мы собираемся установить на устройство:

Main -> Packages -> From -> Browse. -> (директория с файлами "*.npk")

Выделяем целевое устройство в списке доступных "Routers/Drives", выбираем предназначенный для установки дистрибутив с списке "Packages" и жмём кнопку "Install" - сразу после чего запускается процедура форматирования встроенного NAND-диска ("флеш-памяти") целевого "Mikrotik" и установка на неё заданного дистрибутива "RouterOS":

Отображение процесса обновления "RouterOS" в GUI "Netinstall" (Mikrotik).

Отображение процесса обновления "RouterOS" в GUI "Netinstall" (Mikrotik).

installed routeros-mipsbe-6.44.1
Writing configuration.

Software installed.
Press ENTER to reboot

На этом обновление программного обеспечения считается завершённым. Перезагружаем "Mikrotik" и переходим к его настройке.

Если что-то пошло не так.

Прежде всего полезно посмотреть выхлоп "Wine", в среде которого запущена утилита "Netinstall" - в идеале мы должны там наблюдать заметки о приёме BOOTP-запросов, регистрации целевого устройства на PXE-сервере и отправке по TFTP программного модуля загрузки:

.
bootp recv bytes: 300
client: 00:0C:42:D5:C8:B4
bootp req received
onTftp 131 vmlinux
port: 43264
blksize 1452
sendFile 3711316
.

Основные причины, почему соединения BOOTP/PXE/TFTP не отрабатывают заключаются в неверных сетевых настройках сервера инсталляции, ограничениях ядра "Linux" на открытие порта UPD:67 и запретительных правилах сетевого защитного экрана. Разбирайтесь с этим, руководствуясь вышеприведёнными инструкциями.

Для выяснения, что конкретно не срабатывает, очень поможет подключение к устройству через "последовательный порт (serial port)" RS-232.

Помимо простого вызова режима "Etherboot" путём зажима на этапе запуска "Mikrotik" кнопки "Reset" можно воспользоваться более богатым возможностями режимом конфигурирования параметров загрузки - его CLI-интерфейс вызывается нажатием любой клавиши в момент двухсекундной задержки на этапе загрузки устройства, разумеется в интерфейсе "minicom", подключенного по RS-232:

RouterBOOT backup booter 3.22
.
Press any key within 2 seconds to enter setup
.
RouterBOOT-3.22
What do you want to configure?
.
o - boot device
.
g - upgrade firmware
.
your choice: .

Нам нужно будет воздействовать на два параметра меню загрузчика "Mikrotik".

Изменим порядок загрузки (опция "o" главного меню), оставив только "Etherboot":

.
Select boot device:
* e - boot over Ethernet
n - boot from NAND, if fail then Ethernet
.
your choice: e - boot over Ethernet

После чего запустим процедуру обновления (опция "g" главного меню) посредством "Etherboot":

.
Upgrade firmware options:
* e - upgrade firmware over ethernet
s - upgrade firmware over serial port
your choice: e - upgrade firmware over ethernet

Вероятно процедура обновления завершится ошибкой - мы ведь не из любопытства здесь - но с заданными настройками загрузки только посредством "Etherboot" она будет повторятся бесконечно, пока мы не найдём причину на сервере инсталляции и не устраним её:

.
trying bootp protocol. failed
firmware loading failed
.

[ уже посетило: 6041 / +2 ] [ интересно! / нет ]


Поблагодарить автора ( сделайте свой денежный вклад в хорошее настроение )

Читайте также: