Raspberry Pi as DHCP Server

In order to run my Raspberry Pi as a PXE server I had to switch the DHCP server from my router to the Raspberry.

For this duty we are using isc-dhcp-server

Quite simple stuff, so lets start and get it.

At first we need a static IP on our raspberry pi:

 

comment out iface eth0 inet dhcp

add the following lines and adjust the gateway to your routers IP. Address and network can also be changed f.e. to address 192.168.0.1 and network 192.168.0.0. In this howto I will use my personal settings which are in a 10.0.0.0 network

 
interfaces

save the configuration and restart the connection

 

now we are going to install our dhcp server

 

and start the config:

 

my network is running on the subnet 10.0.0.0. Adjust the IP if you want to use 192.168.0.0. f.e.

 

almost done, lets start the DHCP-server:

 

Now deactivate the DHCP server on your router.

After that you can test it. On a windows client open cmd and type ipconfig /release and afterwards ipconfig /renew. You should now have a new IP from your subnet.

lets change the motd of our raspberry pi

Most of us will be using ssh to log into our raspberry pi. So lets change the motd to something more shiny:

 

delete everything

 

look for uname -snrvm > /var/run/motd.dynamic and comment it out (put # at the beginning of the line)

 

look for PrintLastLog and change yes to no

 

azeam of raspberrypi.org forums provided a nice code which shows some basic information of your raspberry pi and can be complete customized. You’ll also find information about customized motd’s at the following link http://www.mewbies.com/how_to_customize_your_console_login_message_tutorial.htm

so lets put in the following code:

 

save and go on with the next step:

 

 

 

go to the end of the file an add /etc/motd.tcl

save your work and test it

 

motd

You’ll see I just added a custom text at the bottom, you can modify it however you like by editing /etc/motd.tcl