最近
学习并研究了DHCP的搭建。
遇到了一下几个问题:
1. download dhcp时,
yum源找不到
2. dhcp 无法启动
问题1:
红帽中出现This system is not registered with RHN这个的原因是因为红帽中没有注册RHN。解决办法:(假定你已安装yum,且网络畅通)更改yum的源,即更换/etc/yum.repos.d /rhel-debuginfo.repo 这个文件。进入/etc/yum.repos.d/目录,终端中输入wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo即可在此目录下得到CentOS- Base.repo文件,这是centos的源文件,只需将其重命名为rhel-debuginfo.repo即可,以前的文件做个备份。
问题2:
service dhcp start failed的原因很多,在修改
dhcpd.conf文件时一定要细心,也许一个分号的丢失就会导致server启动失败,我就是粗心丢失了一个大括号,后来花了很多时间查找这个fail的原因。
ddns-update-style. interim;
#ignore client-updates;
#ignore client-updates;
#网上有网友说有的fail是因为这个client-updates没有屏蔽(屏蔽掉以减少fail 概率)
subnet 10.1.2.0 netmask 255.255.255.0{
#子网一定要覆盖本机的ip(这里搭建server的ip是10.1.2.28)
# --- default gateway
option routers 10.1.2.1;
option routers 10.1.2.1;
#网关
option subnet-mask 255.255.255.0;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 10.1.0.26;
option domain-name "domain.org";
option domain-name-servers 10.1.0.26;
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;
# 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 10.1.2.28 10.1.2.28;
default-lease-time 21600;
max-lease-time 43200;
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;
}
}
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}