Set up a dhcp server

From Linuxintro

To set up a dhcp server find out your distribution and proceed accordingly:

SUSE 12.1

This is an example that works with SUSE Linux 12.1. We use br0 as network card to offer the dhcp service, 192.168.0.0/24 as network where to take the IP addresses from, 192.168.0.1 and 192.168.0.5 as name servers and 192.168.0.5 as gateway.

  • install the dhcp server software:
yast -i dhcp-server
  • edit /etc/dhcpd.conf, enter the following:
ddns-update-style interim;
authoritative; 
default-lease-time 600;
max-lease-time 3600;
option broadcast-address 192.168.0.255;
option routers 192.168.0.5;
option domain-name-servers 192.168.0.1, 192.168.0.5;
option domain-name "mydomain.net";

subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.10 192.168.0.100;
}
  • edit /etc/sysconfig/dhcp, set
DHCPD_INTERFACE=br0
  • start the dhcp daemon:
/etc/init.d/dhcpd start

SUSE 11.4

This is an example that works with SUSE Linux 11.4. We use br0 as network card to offer the dhcp service, 192.168.0.0/24 as network where to take the IP addresses from, 192.168.0.1 and 192.168.0.5 as name servers and 192.168.0.5 as gateway.

  • install the dhcp server software:
yast -i dhcpd
  • edit /etc/dhcpd.conf, enter the following:
ddns-update-style interim;
authoritative; 
default-lease-time 600;
max-lease-time 3600;
option broadcast-address 192.168.0.255;
option routers 192.168.0.5;
option domain-name-servers 192.168.0.1, 192.168.0.5;
option domain-name "mydomain.net";

subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.10 192.168.0.100;
}
  • edit /etc/sysconfig/dhcp, set
DHCPD_INTERFACE=br0
  • start the dhcp daemon:
/etc/init.d/dhcpd start