您的位置:首页 > 运维架构 > Linux

linux_DHCP配置文档

2015-07-18 00:17 656 查看
1、配置YUM

vim /etc/yum.repos.d/rhel-debuginfo.repo

[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///misc/cd/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

2、配置IP

vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:FC:E2:45
ONBOOT=yes
IPADDR=192.168.100.1
NETMASK=255.255.255.0

vim /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
BOOTPROTO=none
HWADDR=12:34:56:78:90:ab
ONBOOT=yes
IPADDR=192.168.200.1
NETMASK=255.255.255.0

service network restart

3、安装、配置DHCP服务

yum install dhcp -y

cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

vim /etc/dhcpd.conf

#全局配置
ddns-update-style none; #动态DNS更新方法
ignore client-updates; #忽略客户机更新

#子网配置

#谁写IP谁傻X
subnet 192.168.100.0 netmask 255.255.255.0 {
#分配IP地址池、子网掩码、网关、DNS
range dynamic-bootp 192.168.100.128 192.168.100.254;
option subnet-mask 255.255.255.0;
option routers 192.168.100.1;
option domain-name "benet.com";
option domain-name-servers 192.168.100.1,192.168.100.2;
#租约时间:最大时间,更新时间
default-lease-time 21600;
max-lease-time 43200;

#主机配置(相当于WINDOWS里的保留)
host ns {
#next-server marvin.redhat.com;
#hardware ethernet 12:34:56:78:AB:CD;
#fixed-address 207.175.42.254;
}
subnet 192.168.200.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.200.128 192.168.200.254;
option subnet-mask 255.255.255.0;
option routers 192.168.200.1;
option domain-name "benet.com";
option domain-name-servers 192.168.200.1,192.168.200.2;
default-lease-time 21600;
max-lease-time 43200;

host ftp {
hardware ethernet 00:0C:29:60:E4:AD;
fixed-address 192.168.200.10;
}
host web {
hardware ethernet 12:34:56:78:90:AB;
fixed-address 192.168.200.20;
}
}

service dhcpd start
chkconfig dhcpd on

4、补充:

限制dhcp服务器提供服务的网络接口

vim /etc/sysconfig/dhcpd

DHCPDARGS="eth0 eth1"

租约文件

tail -f /var/lib/dhcpd/dhcpd.leases
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Linux file