Configuring DHCP on Ubuntu 10.04.
This is a part 2, but can equally be used as a part 1. Install dhcp3 using apt-get.
The first thing you'll see is that after you install it it'll fail to start. That is deliberate. Leave it down.
First thing to do is to tell DHCP what ethernet port to use.
nano /etc/defaults/dhcp3-server
under the interfaces line, in the speech marks, put your interface. For example "eth1"
Save and close that. That's the easy bit.
Now we need to setup the bits and pieces.
nano /etc/dhcp3/dhcpd.conf
Either edit this one, or back it up. Anyway, the lines you want are these:
ddns-update-style interim;
ignore client-updates;
and these (I've left the comment line in so you can see where in the file I did this):
# A slightly different configuration for an internal subnet.
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.70 192.168.1.150;
option domain-name-servers [your DNS server NAME];
option domain-name "[your domain name]";
option routers 192.168.1.254;
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}
include "/etc/bind/rndc.key";
zone 1.168.192.in-addr.arpa. {
primary [your DNS server IP];
key "rndc-key";
}
zone newburytechinfo.co.uk. {
primary [your DNS server IP];
key "rndc-key";
}
These are fairly easy to read. The last 2 bits on the zone. This is to automatically update your DNS server with your clients IPs and names. The include line, includes the key from BIND.
Change the IP ranges and whatnot for your network, turn off your current DHCP server, start this one.
sudo service dhcp3 start
On your PC type this:
sudo dhclient
You should get an IP preconfigured with the right gateway, and your dns server as first. You should also be able to ping it from another box.
That's it.
Oh. Some messing about might be required.
Do these lines if you start having errors:
cd /etc/apparmor.d
nano usr.sbin.named
add this line:
/etc/bind/zones/** rw,
save and close.
nano usr.sbin.dhcpd3
add these lines (no its not pretty, this is a hack):
/etc/bind/ rw,
/etc/bind/** rw,
Save and close.
Run this:
sudo service apparmor restart
That's it. It should all work.
Thanks for reading
Trev
No comments:
Post a Comment