Configure DHCP server for remote boot on Mikrotik


In this article you’ll find the steps required to boot the Mikrotik device with a linux kernel (more precisely the OpenWRT flavour). Due to the wide complexity of the dhcp server I’m going to use the very basic configuration and work on the needed settings to load the kernel via tftp.

First, we need to install a dhcp server, most linux distros offer them in their catalog and normally you don’t need to compile it. For this guide, I’ll download from the consortium.<

I’m using CentOS 6.3 for this guide, but I’ll try to get the most standard commands.

Download the sources in the folder /usr/src (for tidy reasons) and untar them.

# cd /usr/src
# wget ftp://ftp.isc.org/isc/dhcp/4.2.4-P2/dhcp-4.2.4-P2.tar.gz
# tar -xvzf dhcp-4.2.4-P2.tar.gz

Compile and install the sources
# cd /usr/share/cd dhcp-4.2.4-P2
# ./configure
[Ouput ommited ...]
# make
[Ouput ommited ...]
# make install

The dhcp server from the ISC is officially installed. Next step is to configure to reply to dhcp requests.
Because we installed locally, the configuration files and executables are placed in /usr/local, more precisely:
executable: /usr/local/sbin/dhcpd
config file: /usr/local/etc/dhcpd.conf

Add or change the following lines in the dhcpd.conf file:

authoritative;
ddns-update-style none;
option domain-name "test.lan";
option broadcast-address 10.0.0.255;
option subnet-mask 255.255.255.0;
allow booting;
allow bootp;
default-lease-time 86400;
max-lease-time 86400;
log-facility local7;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.100 10.0.0.150;
option routers 10.0.0.1;
option subnet-mask 255.255.255.0;
}
host hostname {
hardware ethernet 00:0c:42:24:ed:a8;
next-server 10.0.0.1;
fixed-address 10.0.0.17;
filename "vmlinux";
}

Before executing I needed to execute 2 more commands to make it work, a symbolic link to find the configuration file and create an empty file for leases.

# ln -s /usr/local/etc/dhcpd.conf /etc/dhcpd.conf
# touch /var/db/dhcpd.leases

Now you will be able to boot the form the ethernet and provide a linux kernel.

Starting up


Well, the idea behind this blog is to get everything in one place to allow me to get concentrated in what I enjoy the most, developing and sharing. Not much to say… yet.

Update:
Now with Blogilo I can build the posts from my desk without the inconvenience of the web browser. Personally I find useful the option to create your posts from the browser, but I found a problem of opening too many tabs due to investigations, and when close .. doh! I also close the blog… and all work/inspiration is gone.
#include <stdio.h>
int main() 
{
         printf(“Hello Blog”);
         return 0;
}