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:
1 |
sudo nano /etc/network/interfaces |
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
1 2 3 4 5 |
iface eth0 inet static address 10.0.0.7 netmask 255.255.255.0 gateway 10.0.0.138 #router IP network 10.0.0.0 |
save the configuration and restart the connection
1 |
sudo /etc/init.d/networking restart |
now we are going to install our dhcp server
1 |
sudo apt-get install isc-dhcp-server |
and start the config:
1 |
sudo nano /etc/dhcp/dhcpd.conf |
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.
1 2 3 4 5 6 7 8 9 |
subnet 10.0.0.0 netmask 255.255.255.0 { range 10.0.0.1 10.0.0.100; #Lease-Time (in seconds) default-lease-time 60000; max-lease-time 720000; option domain-name-servers 10.0.0.138; #router IP option subnet-mask 255.255.255.0; option routers 10.0.0.138; #router IP } |
almost done, lets start the DHCP-server:
1 |
sudo /etc/init.d/isc-dhcp-server start |
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.