Dhcp

From Cheatsheet

Jump to: navigation, search

In this application I'm going to:

  1. set up a basic DHCP server (on Redhat/Fedoraish things, but similar on Debian variants
  2. allow it to work on a specific eth interface, in this case eth1
yum install dhcp installs the dhcp server with a sample file you have to copy to the real one for it to work
cd /usr/share/doc/dhcp-whateverversionyouhave/ look at the example there called dhcpd.conf.sample, it has a basic setup that should work on the 192.168.0.x network, so your gateway on the client would be 192.168.1.1, and your clients would have an IP range of 192.168.1.128-254
vi dhcpd.conf.sample take a look at what you have, it should be relatively self-explanatory
DHCPARGS=eth1 put this in the top of the file, it tells the server to only eth1, probably your second interface
cp dhcpd.conf.sample /etc/dhcpd.conf overwrite the placeholder file in /etc/ so it will start reading your new one
service dhcpd configtest test your configuration for errors before you start it up

now you want to set up your eth1 (inside network) interface

 GATEWAY=10.1.10.1
 TYPE=Ethernet
 DEVICE=eth1
 HWADDR=00:1a:a0:37:26:e3
 BOOTPROTO=none
 NETMASK=255.255.255.0
 IPADDR=192.168.0.1
 ONBOOT=yes
 USERCTL=no
 IPV6INIT=no
 PEERDNS=yes
route add -host 255.255.255.255 dev eth1 when a client tries to get a DHCP address they send it out to anyone who'll listen with and address of 255.255.255.255, so this is what your server has to be told to respond on with the eth1 interface