Вы находитесь на странице: 1из 6

MikroTik Installation Server Setup

Language: En | Fr | Es
DOCUMENTATION
Get Started
Get Involved
Supported Devices
Guides and How-tos
Commotion Construction Kit
Commotion Localization
Send us feedback
Report a bug

Introduction
MikroTik routers require a different installation process than most other routers: they pull
software from servers on a network, rather than you uploading the software to the device.
This requires you to set up the required servers up before you can install Commotion on your
MikroTik device. The three servers you will need to set up are:

1. A Netboot server that can assign an IP to the router with DHCP or BootP

2. A TFTP server that provides the router the first set of firmware files

3. A Web server that provides the router with the second set of firmware files

This guide installs and configures the following two server packages:

1. dnsmasq - a lightweight DNS and DHCP server. This provides the


Netboot and TFTP functions into one package.

2. lighttpd - a lightweight web server. It will respond to requests just like a


web server on the Internet, but is only configured here to provide firmware
to your routers.

</section>

Using Linux
This guide is written for computers running Debian Linux or a variant such as Ubuntu or Mint.
It may be possible to set up the same server packages using Windows or Mac OSX, but
those are not documented here.
If you do not have access to a Linux computer, you may be able to set up an instance of
Linux using a virtual machine on another platform, but that is beyond the scope of this guide.
Install and Configure dnsmasq
First, disconnect your computer from any network you are attached to. The dnsmasq server
can assign IP addresses to any computer on your network once it is configured, which can
cause strange behavior. For this reason, you should be very careful to turn the server on
only when you are using it to install Commotion. All other times your computer is running, the
dnsmasq service should be turned off. We will cover that below.
Next, open a terminal window and type:

sudo apt-get install dnsmasq

Wait for your system to install the package, then stop the service if it is running:

sudo service dnsmasq stop

You should see a message stating that the server has been shut off.
Also, you should disable dnsmasq from starting when you boot up your computer:

sudo update-rc.d -f dnsmasq remove


Next, configure dnsmaq to provide only the services needed to install Commotion. These are
to provide a DHCP server on the wired Ethernet port, and to enable the TFTP/BootP service
to serve files to the routers.
Dnsmasq is configured in the file /etc/dnsmasq.conf. There are many, many options for
configuring dnsmasq, and below are only the lines needed for the installation server's
configuration.

# Our server only has one ethernet port. Check yours to ensure
you're enabling the right port
interface=eth0
#bind-interfaces

# You can specify whatever dhcp-range you like, or per your


environment's specific requirements (for instance if this is a
production server)
dhcp-range=192.168.10.100,192.168.10.120,255.255.255.0,12h

dhcp-leasefile=/var/lib/misc/dnsmasq.lease

# For each device you want to TFTP boot, you need a dhcp-host
entry with the MAC address and the IP to give that client.
# You'll need to look up the MAC address of the device and
add a line here for it to be recognized.
dhcp-host=xx:xx:xx:xx:xx:xx,192.168.10.101

# The name of the boot file to be provided to dhcp-hosts. This


file should be saved in the 'tftp-root' folder (see below)
dhcp-boot=openwrt-ar71xx-nand-vmlinux-initramfs-lzma.elf

# Enable dnsmasq's built in tftp/bootp server


enable-tftp

# Designate where TFTP/BOOTP files will be served from on this


server
tftp-root=/var/lib/tftproot
log-queries
log-dhcp

You can download the file here and use the following steps to move it into place. (Right click
and select "Save link as...")
You will first need to edit the dnsmasq.conf file to provide the Ethernet MAC address of your
MikroTik device. In the file example above, the line reads:

dhcp-host=xx:xx:xx:xx:xx:xx,192.168.10.101

The section xx.xx.xx.xx.xx.xx signifies the MAC address of your router. You will need to
change this to the proper MAC address for your MikroTik device. The number will look
something more like a6:9b:45:23:ab:f2, and should have been provided in the box with the
router, either on a sticker or slip of paper. Keep this attached to the router or saved in a file
for later, in case you need to run this install process again.
You can use your favorite text editor to edit the file provided before you copy it with the
command below. For example, to run the editor gedit on the configuration file, type:

gedit ~/location_of_file/Commotion_dnsmasq.conf

Make a backup of the existing dnsmasq.conf file before copying anything over it.

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak

Then copy the edited file into the proper directory:

sudo cp ~/location_of_file/Commotion_dnsmasq.conf /etc/dnsmasq.conf

(where location_of_file is where you saved the Commotion software files)


You will need to make a directory for the files to be loaded from via TFTP. To do this, type the
following at the command prompt:

sudo mkdir /var/lib/tftproot


sudo cp ~/location_of_file/openwrt-ar71xx-nand-vmlinux-initramfs-lzma.elf
/var/lib/tftproot/

(where location_of_file is where you saved the Commotion software files)


We wont start dnsmasq in this guide until the end.

Install and Configure lighttpd


Open a terminal and type the following at the command line to install the web server
package:
sudo apt-get install lighttpd

Wait for your system to install the package, then stop the service if it is running:

sudo service lighttpd stop

You should see a message stating that the server has been shut off.
Also, you should disable lighttpd from starting when you boot up your computer:

sudo update-rc.d -f lighttpd remove

Lighttpd's default web pages and files are hosted at /var/www. You will copy the installation
files into /var/www with the commands:
sudo cp ~/location_of_file/openwrt-ar71xx-nand-vmlinux-lzma.elf /var/www/
sudo cp ~/location_of_file/openwrt-ar71xx-nand-rootfs.tar.gz /var/www/

(where location_of_file is where you saved the Commotion software files)


After network booting, the device uses a special program called wget2nand on the router to
install the kernel and filesystem onto the device. That is why files need to be hosted by your
webserver.

Start the server programs


Now that you have installed both server packages and copied the files to the proper
locations, we can start the server programs and proceed with the other installation steps
required.
Before you do this, you will need to set your computers Ethernet port to the Static IP
address information below:

IP Address: 192.168.10.254

Netmask: 255.255.255.0

Gateway: nothing or blank

In a terminal, type the following commands:

sudo service dnsmasq start


sudo service lighttpd start

Dnsmasq should now be providing DHCP leases to routers connected to your computer
(whether directly or through an Ethernet switch) and for devices in the configuration file that
are identified by the dhcp-host line you edited before (dhcp-
host=xx:xx:xx:xx:xx:xx,192.168.10.101), dnsmasq will provide a Commotion firmware file for
network boot. To confirm dnsmasq is running, you can connect the Ethernet port specified in
your configuration to a switch, and then connect a PC or laptop to that same switch. The PC
should get a DHCP lease from the server.
Lighttpd should also be running now at this point. It will be serving web pages to any
computer that can connect to it, and will provide the Commotion software files to the routers
attached to the switch mentioned above. To confirm lighttpd is running, open a web browser
and type http://localhost in the URL bar. You should see the default web page - something
similar to Placeholder page.
At this point, you can return to the Install on a MikroTik Router guide.