分类: LINUX
2010-02-05 22:43:39
1.检查DHCP安装情况
[root@lihua ~]# rpm -qa | grep dhcp
dhcp-
dhcpv6_client-0.10-8
[root@lihua ~]#
2.dhcpd.conf 默认情况下是没有安装的,需要自行配置,不过有默认的文档
[root@lihua ~]# cd /usr/share/doc/dhcp-
[root@lihua dhcp-
dhcpd.conf.sample README RELNOTES
[root@lihua dhcp-
3.作为网络管理者应该有自行编写的能力
[root@lihua dhcp-
ddns-update-style none;
default-lease-time 21600;
max-lease-time 43200;
option domain-name "test.com";
option domain-name-servers 172.16.19.125;
subnet 172.16.0.0 netmask 255.255.0.0 {
range 172.16.19.126 172.16.19.254;
option routers 172.16.16.1;
option subnet-mask 255.255.0.0;
host windowsXP {
hardware ethernet 00:
fixed-address 172.16.19.222;
}
}
4.重启dhcpd 服务
[root@lihua dhcp-
Internet Systems Consortium DHCP Server V
Copyright 2004 Internet Systems Consortium.
All rights reserved.
For info, please visit
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
[root@lihua dhcp-
5.测试客户端情况
Windows 下 ipconfig /release ipconfig /renew
Linux 下 dhclient
DHCP中继
1.检查DHCP 安装情况
[root@benet02 ~]# rpm -qa | grep dhcp
dhcpv6_client-0.10-8
没有安装挂载光盘
[root@benet02 ~]# mount /dev/cdrom /mnt/
mount: block device /dev/cdrom is write-protected, mounting read-only
安装DHCP
[root@benet02 ~]# rpm -ivh /mnt/RedHat/RPMS/dhcp-
warning: /mnt/RedHat/RPMS/dhcp-
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]
[root@benet02 ~]#
编辑
[root@benet02 ~]# vi /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 1 ///////更改的内容
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
在DHCP服务器上添加网关
[root@lihua /]# route add default gw 172.16.18.248 ///也就是DHCP中继的和DHCP服务器相连的那块网卡的IP
编辑 /etc/dhcpd.conf
ddns-update-style none;
default-lease-time 21600;
max-lease-time 43200;
option domain-name "test.com";
option domain-name-servers 172.16.19.125;
subnet 172.16.0.0 netmask 255.255.0.0 {
range 172.16.19.126 172.16.19.254;
option routers 172.16.16.1;
option subnet-mask 255.255.0.0;
host windowsXP {
hardware ethernet 00:
fixed-address 172.16.19.222;
}
}
subnet
range
option routers
option subnet-mask 255.255.255.0;
}
重启服务 [root@lihua /]# service dhcpd restart
DHCP中继上做中继转发
[root@benet02 ~]# dhcrelay 172.16.19.125 ///IP是DHCP 服务器的IP
Internet Systems Consortium DHCP Relay Agent V
Copyright 2004 Internet Systems Consortium.
All rights reserved.
For info, please visit
Listening on LPF/eth1/00:
Sending on LPF/eth1/00:
Listening on LPF/eth0/00:
Sending on LPF/eth0/00:
Sending on Socket/fallback
客户端验证是否获得