root@ubuntu-1:~# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 12.10"
root@ubuntu-1:~# uname -ri
3.5.0-26-generic x86_64
|
install ISC-DHCP via apt-get
root@ubuntu-1:~# apt-get install -y isc-dhcp-server
root@ubuntu-1:~# dhcpd --version
isc-dhcpd-4.2.4
|
configure DHCPD
back up an original configuration file before configuring DHCPD.
root@ubuntu-1:/etc/dhcp# cd /etc/dhcp
root@ubuntu-1:/etc/dhcp# cp dhcpd.conf dhcpd.conf.bakup
|
sample configuration is in “/usr/share/doc/isc-dhcp-server/examples/dhcpd.conf” directory.
root@ubuntu-1:/etc/dhcp# egrep -v ^# dhcpd.conf | grep -v ^$
INTERFACES="eth3";
ddns-update-style none;
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.150.0 netmask 255.255.255.0 {
range 192.168.150.10 192.168.150.200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.150.255;
option routers 192.168.150.254;
ping-check false;
}
|
start DHCPD
root@ubuntu-1:/etc/dhcp# service isc-dhcp-server start
isc-dhcp-server start/running, process 4971
root@ubuntu-1:/etc/dhcp# ps aux | grep 4971 | grep -v grep
dhcpd 4971 0.0 0.0 19604 6664 ? Ss 17:51 0:00 dhcpd -user dhcpd -group dhcpd -f -q -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf
|
install dhcpdump on DHCPD box to analyze DHCP packets easily.
root@ubuntu-1:/etc/dhcp# apt-get install dhcpdump
|
run dhcpdump on DHCPD box
root@ubuntu-1:/etc/dhcp# dhcpdump -i eth3
|
send DHCP request to DHCPD with dhcping box.
on dhcping box
mint-1 ~ # dhcping -v -s 192.168.150.4
Got answer from: 192.168.150.4
|
on DHCPD box
root@ubuntu-1:/etc/dhcp# dhcpdump -i eth3
TIME: 2013-04-17 21:10:01.252
IP: 192.168.150.5 (0:26:55::zz:zz:zz) > 192.168.150.4 (0:26:55:xx:xx:xx)
OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: e9666e51
SECS: 0
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION: 53 ( 1) DHCP message type 3 (DHCPREQUEST)
OPTION: 50 ( 4) Request IP address 0.0.0.0
---------------------------------------------------------------------------
TIME: 2013-04-17 21:10:01.252
IP: 192.168.150.4 (0:26:55:xx:xx:xx) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
OP: 2 (BOOTPREPLY)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: e9666e51
SECS: 0
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 192.168.150.4
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION: 53 ( 1) DHCP message type 6 (DHCPNAK)
OPTION: 54 ( 4) Server identifier 192.168.150.4
---------------------------------------------------------------------------
TIME: 2013-04-17 21:10:01.252
IP: 192.168.150.5 (0:26:55::zz:zz:zz) > 192.168.150.4 (0:26:55:xx:xx:xx)
OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: e9666e51
SECS: 0
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION: 53 ( 1) DHCP message type 7 (DHCPRELEASE)
---------------------------------------------------------------------------
^C
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.