steps:
1. You should set your IP settings to static. You can do it by editing file/etc/network/interfaces config file. For the primary interface, usually it’s eth0, you will see following lines:
auto eth0
iface eth0 inet dhcp
You may set different IP settings here, in my case I change those lines to:
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
2. Set your DNS Servers editing /etc/resolv.conf file.
3. sudo /etc/init.d/networking restart
4. sudo apt-get update
5. sudo apt-get install dhcp3-server
6. sudo vim /etc/defaults/dhcp3-server
Add your interface name in the settings file. ( INTERFACES=”eth0″ )
We know that right after installing dhcp3-server packages it tries to start it but fails. So now that we changed default interface it will listen to we try again to start the server by typing:
7. sudo /etc/init.d/dhcp3-server start
8. All the logs from dhcp server is sent to syslog, we check it:
arstan@ubuntu:~$ sudo tail -f /var/log/syslog
Jul 6 13:03:24 ubuntu dhcpd: Wrote 0 leases to leases file.
Jul 6 13:03:24 ubuntu dhcpd:
Jul 6 13:03:24 ubuntu dhcpd: No subnet declaration for eth0 (192.168.1.100).
Jul 6 13:03:24 ubuntu dhcpd: ** Ignoring requests on eth0. If this is not what
Jul 6 13:03:24 ubuntu dhcpd: you want, please write a subnet declaration
Jul 6 13:03:24 ubuntu dhcpd: in your dhcpd.conf file for the network segment
Jul 6 13:03:24 ubuntu dhcpd: to which interface eth0 is attached. **
S o why is it still not starting up? After doing some digging in /etc/init.d/dhcp3-server start script I found that it has the following lines:
# Allow ltsp to override
if [ -f /etc/ltsp/dhcpd.conf ]; then
CONFIG_FILE=/etc/ltsp/dhcpd.conf
break
fi
Since we don’t need ltsp configs in this case, let’s just comment them out. You can do so by adding # at the beginning of each line.
Let’s restart the server by typing:
sudo /etc/init.d/dhcp3-server start
That’s all about it! You know have DHCP server configured in Ubuntu Linux.
Have fun!
http://www.linuxtricks.net/index.php/archives/102/how-to-install-dhcp3-server-in-ubuntu/
沒有留言:
張貼留言