DHCP 服务器的配置过程
以前在做实验的过程中总结和写的一些教程的一些资料,一直没时间发布到博客上面,五一到了,终于有点时间发布啦!关于Linux上面还会有RHCE系列的学习笔记发表
DHCP的安装包是:dhcp-3.0.1-12_EL.i386.rpm
守护进程是:dchpd
服务器的配置过程:
1、安装 rpm包
[root@cisco ~]# cd /media/cdrom/RedHat/RPMS/
[root@cisco RPMS]# rpm -ivh dhcp-3.0.1-12_EL.i386.rpm
warning: dhcp-3.0.1-12_EL.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
package dhcp-3.0.1-12_EL is already installed
[root@cisco RPMS]#
2、复制配置文件的样本:
[root@cisco RPMS]# cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf
3、编辑配置文件:
[root@cisco RPMS]# vi /etc/dhcpd.conf
subnet 192.168.20.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.20.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "benet.com";
option domain-name-servers 192.168.1.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.20.100 192.168.20.200;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
www.wqmsl.cn4、启动 dhcp 服务即可
[root@cisco ~]# service dhcpd start
5、多网卡配置选择的配置文件
[root@cisco ~]# cat /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS= 这里添网卡即可
6、租约文件:
[root@cisco ~]# cat /var/lib/dhcp/dhcpd.leases
# All times in this file are in UTC (GMT), not your local timezone. This is
# not a bug, so please don't ask about it. There is no portable way to
# store leases in the local timezone, so please don't request this as a
# feature. If this is inconvenient or confusing to you, we sincerely
# apologize. Seriously, though - don't ask.
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-V3.0.1
lease 192.168.20.200 {
starts 5 2009/05/29 05:16:44;
ends 5 2009/05/29 11:16:44;
tstp 5 2009/05/29 11:16:44;
binding state active;
next binding state free;
hardware ethernet 00:0c:29:00:77:3e;
}
DHCP 客户端的配置
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
IPADDR=192.168.20.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
[root@localhost ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:00:77:3E
inet addr:192.168.20.200 Bcast:192.168.20.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe00:773e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42757 errors:0 dropped:0 overruns:0 frame:0
TX packets:207 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2669265 (2.5 MiB) TX bytes:24116 (23.5 KiB)
Interrupt:11 Base address:0x2000
本文转自 wqmsl 51CTO博客,原文链接:http://blog.51cto.com/wqmsl/307856,如需转载请自行联系原作者