您的位置:首页 > 其它

用实验快速配置DHCP

2005-03-12 20:25 429 查看
前言: DHCP,Dynamic Host Configuration Protocal,它方便了计算机网络管理。本文用实验的方式快速学会配置DHCP
[实验目的]
1.配置一个DHCP服务器。
2.用客户端检验DHCP服务器。
[实验要求]
1.两台RH9.0的机器。
2.机器1,IP:192.168.0.1
3.机器1是1个DNS服务器,网络名:example.com,192.168.0.1的host叫server1,
192.168.0.2的host叫station2.
[实验步骤]
1.机器1上,检查并安装dhcp包。
2.机器1上,到dhcpd的文档复制一分配置例子。
cp /usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample /etc/dhcpd.conf
3.机器1上,编辑/etc/dhcpd.conf内容如下:
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
# option nis-domain "domain.org";
option domain-name "example.com";
option domain-name-servers 192.168.0.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). Dont change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range 192.168.0.1 192.168.0.2;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host station2 {
hardware ethernet 00:E0:4E:E8:9B:BC;
fixed-address 192.168.0.2;
}
}
注意:这里假设机器2的网卡Mac地址为: 00:E0:4E:E8:9B:BC,你可以用ifconfig查看机
器2的Mac地址,作相应修改。
4.机器1上,用ifconfig观察结果,是否子网卡的广播地址设置正确:如:192.168.0.255。
若不正确,请修改网络配置。
5.机器1上,启动dhcpd服务。
# service dhcpd restart
注意:若不能启动,观察/var/log/message.
6.机器2上,修改/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
7.机器2上,删除/etc/resolv.conf的所有内容。
8.机器2上,初试化网卡。
# ifdown eth0
# ifup eth1
9.机器2上,用ifconfig观察结果,机器2的ip地址为192.168.0.2吗?
10.DNS能够解析吗?
# host server1.example.com
# host station2.example.com
[实验结论]
本文只是简单快速的实现了DHCP设置,如果想了解更多内容,请参考DHCP的文档/usr/share/doc/dhcp-*目录。本文的IP地址是根据Mac地址定制的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: