RHEL5.3-DHCP安装配置及在Client上获取地址
2009-12-15 17:43
429 查看
-------陈功磊 2009-5-31
(说明:系统镜像:[红帽企业.Linux.5].rhel-5.2-server-i386-dvd.iso)
1、挂载镜像
[root@linux01 ~]# ls -al /media
total 16
drwxr-xr-x 2 root root 4096 Oct 11 2006 .
drwxr-xr-x 24 root root 4096 May 31 19:57 ..
[root@linux01 ~]# mkdir /media/cdrom
[root@linux01 ~]# ls -al /media
total 24
drwxr-xr-x 3 root root 4096 May 31 20:11 .
drwxr-xr-x 24 root root 4096 May 31 19:57 ..
drwxr-xr-x 2 root root 4096 May 31 20:11 cdrom
[root@linux01 ~]# mount -t iso9660 /dev/cdrom /media/cdrom # 挂载镜像
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@linux01 ~]#
2、安装DHCP软件包
[root@linux01 ~]# cd /media/cdrom/Server # 进入rmp软件包文件夹
[root@linux01 Server]# ls -l dhcp*
-rw-r--r-- 243 root root 895219 Apr 16 2008 dhcp-3.0.5-13.el5.i386.rpm
-rw-r--r-- 263 root root 133868 Apr 16 2008 dhcp-devel-3.0.5-13.el5.i386.rpm
-rw-r--r-- 91 root root 194686 Apr 26 2008 dhcpv6-1.0.10-4.el5.i386.rpm
-rw-r--r-- 91 root root 122618 Apr 26 2008 dhcpv6-client-1.0.10-4.el5.i386.rpm
[root@linux01 Server]# rpm -ivh dhcp-3.0.5-13.el5.i386.rpm # i安装 v 详细输出 h进度
warning: dhcp-3.0.5-13.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]
[root@linux01 Server]#
[root@linux01 Server]# rpm -qa | grep dhcp # 查看与dhcp相关的安装软件
dhcpv6-client-1.0.10-4.el5
dhcp-3.0.5-13.el5
[root@linux01 Server]#
3、配置/etc/dhcpd.conf文件
[root@linux01 ~]# vi /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim; # dhcpd启动的必须项
default-lease-time 21600; # 默认租约时间(sec)(6小时)
max-lease-time 43200; # 最大租约时间(sec)(12小时)
option domain-name "benet.com.cn"; # 主机所在域名,可选项
option domain-name-servers 222.172.200.68,202.203.144.33; # DNS域名服务器的ip,可选项
subnet 192.168.7.0 netmask 255.255.255.0 {
range 192.168.7.50 192.168.7.250;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.7.255;
option routers 192.168.7.1;
host linux01{ # 静态ip
hardware ethernet 00:0C:29:BE:87:75;
fixed-address 192.168.7.2;
}
}
~
~
"/etc/dhcpd.conf" 15L, 383C written
[root@linux01 ~]# service dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
[root@linux01 ~]#
4、查看DHCP本机网络情况
[root@linux01 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 # 网卡信息
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.7.255
HWADDR=00:0C:29:BE:87:75
IPADDR=192.168.7.2
NETMASK=255.255.255.0
NETWORK=192.168.7.0
ONBOOT=yes
~
~
[root@linux01 ~]#
[root@linux01 network-scripts]# vi /etc/sysconfig/network # 主机名和网关信息
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=linux01
GATEWAY=192.168.7.1~
~
[root@linux01 ~]#
[root@linux01 etc]# cat hosts # 本机信息
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 linux01 localhost.localdomain localhost # 主机名 主机名.域名 主机别名
::1 localhost6.localdomain6 localhost6
[root@linux01 etc]#
[root@linux01 etc]# cat hosts # 域名解析服务信息
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 linux01 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@linux01 etc]#
说明:在linux安装时有配置好以上项目时,在下面路径下也有这些信息及配置
[root@linux02 ~]# cd /etc/sysconfig/networking/profiles/default
[root@linux02 default]# ls
hosts ifcfg-eth0 network resolv.conf
[root@linux02 default]#
5、客户端获取ip
Linux客户端
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # 客户端网络配置
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp # 使用dhcp自动获取
HWADDR=00:0C:29:CD:40:C8
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@localhost ~]#
[root@linux01 ~]# /etc/init.d/network restart # 重启网络
客户端Xp系统ip地址自动获取验证
![](http://img1.51cto.com/attachment/200906/10/683550_1244630541rSVS.jpg)
6、DHCP相关命令
[root@linux01 ~]# rpm -qa dhcpd # 查询当前系统安装的dhcp包
[root@linux01 ~]# rpm -qa dhcp*
dhcpv6-client-1.0.10-4.el5
dhcp-3.0.5-13.el5
[root@linux01 ~]#
[root@linux01 ~]# service dhcpd status # 查看当前dhcp服务状态
dhcpd (pid 12946) is running...
[root@linux01 ~]#
[root@linux01 ~]# service dhcpd start/stop/restart # 开启/停止/重启dhcp服务
[root@linux01 ~]# chkconfig --list | grep dhcpd # 查看dhcpd的服务在不同模式下的状态
dhcpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@linux01 ~]# chkconfig --level 35 dhcpd on # 配置dhcpd服务在35系统模式下为自动随机开启
[root@linux01 ~]#
本文出自 “Gonglei Chen” 博客,转载请与作者联系!本文出自 51CTO.COM技术博客
(说明:系统镜像:[红帽企业.Linux.5].rhel-5.2-server-i386-dvd.iso)
1、挂载镜像
[root@linux01 ~]# ls -al /media
total 16
drwxr-xr-x 2 root root 4096 Oct 11 2006 .
drwxr-xr-x 24 root root 4096 May 31 19:57 ..
[root@linux01 ~]# mkdir /media/cdrom
[root@linux01 ~]# ls -al /media
total 24
drwxr-xr-x 3 root root 4096 May 31 20:11 .
drwxr-xr-x 24 root root 4096 May 31 19:57 ..
drwxr-xr-x 2 root root 4096 May 31 20:11 cdrom
[root@linux01 ~]# mount -t iso9660 /dev/cdrom /media/cdrom # 挂载镜像
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@linux01 ~]#
2、安装DHCP软件包
[root@linux01 ~]# cd /media/cdrom/Server # 进入rmp软件包文件夹
[root@linux01 Server]# ls -l dhcp*
-rw-r--r-- 243 root root 895219 Apr 16 2008 dhcp-3.0.5-13.el5.i386.rpm
-rw-r--r-- 263 root root 133868 Apr 16 2008 dhcp-devel-3.0.5-13.el5.i386.rpm
-rw-r--r-- 91 root root 194686 Apr 26 2008 dhcpv6-1.0.10-4.el5.i386.rpm
-rw-r--r-- 91 root root 122618 Apr 26 2008 dhcpv6-client-1.0.10-4.el5.i386.rpm
[root@linux01 Server]# rpm -ivh dhcp-3.0.5-13.el5.i386.rpm # i安装 v 详细输出 h进度
warning: dhcp-3.0.5-13.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]
[root@linux01 Server]#
[root@linux01 Server]# rpm -qa | grep dhcp # 查看与dhcp相关的安装软件
dhcpv6-client-1.0.10-4.el5
dhcp-3.0.5-13.el5
[root@linux01 Server]#
3、配置/etc/dhcpd.conf文件
[root@linux01 ~]# vi /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim; # dhcpd启动的必须项
default-lease-time 21600; # 默认租约时间(sec)(6小时)
max-lease-time 43200; # 最大租约时间(sec)(12小时)
option domain-name "benet.com.cn"; # 主机所在域名,可选项
option domain-name-servers 222.172.200.68,202.203.144.33; # DNS域名服务器的ip,可选项
subnet 192.168.7.0 netmask 255.255.255.0 {
range 192.168.7.50 192.168.7.250;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.7.255;
option routers 192.168.7.1;
host linux01{ # 静态ip
hardware ethernet 00:0C:29:BE:87:75;
fixed-address 192.168.7.2;
}
}
~
~
"/etc/dhcpd.conf" 15L, 383C written
[root@linux01 ~]# service dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
[root@linux01 ~]#
4、查看DHCP本机网络情况
[root@linux01 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 # 网卡信息
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.7.255
HWADDR=00:0C:29:BE:87:75
IPADDR=192.168.7.2
NETMASK=255.255.255.0
NETWORK=192.168.7.0
ONBOOT=yes
~
~
[root@linux01 ~]#
[root@linux01 network-scripts]# vi /etc/sysconfig/network # 主机名和网关信息
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=linux01
GATEWAY=192.168.7.1~
~
[root@linux01 ~]#
[root@linux01 etc]# cat hosts # 本机信息
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 linux01 localhost.localdomain localhost # 主机名 主机名.域名 主机别名
::1 localhost6.localdomain6 localhost6
[root@linux01 etc]#
[root@linux01 etc]# cat hosts # 域名解析服务信息
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 linux01 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@linux01 etc]#
说明:在linux安装时有配置好以上项目时,在下面路径下也有这些信息及配置
[root@linux02 ~]# cd /etc/sysconfig/networking/profiles/default
[root@linux02 default]# ls
hosts ifcfg-eth0 network resolv.conf
[root@linux02 default]#
5、客户端获取ip
Linux客户端
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # 客户端网络配置
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp # 使用dhcp自动获取
HWADDR=00:0C:29:CD:40:C8
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@localhost ~]#
[root@linux01 ~]# /etc/init.d/network restart # 重启网络
客户端Xp系统ip地址自动获取验证
![](http://img1.51cto.com/attachment/200906/10/683550_1244630541rSVS.jpg)
6、DHCP相关命令
[root@linux01 ~]# rpm -qa dhcpd # 查询当前系统安装的dhcp包
[root@linux01 ~]# rpm -qa dhcp*
dhcpv6-client-1.0.10-4.el5
dhcp-3.0.5-13.el5
[root@linux01 ~]#
[root@linux01 ~]# service dhcpd status # 查看当前dhcp服务状态
dhcpd (pid 12946) is running...
[root@linux01 ~]#
[root@linux01 ~]# service dhcpd start/stop/restart # 开启/停止/重启dhcp服务
[root@linux01 ~]# chkconfig --list | grep dhcpd # 查看dhcpd的服务在不同模式下的状态
dhcpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@linux01 ~]# chkconfig --level 35 dhcpd on # 配置dhcpd服务在35系统模式下为自动随机开启
[root@linux01 ~]#
本文出自 “Gonglei Chen” 博客,转载请与作者联系!本文出自 51CTO.COM技术博客
相关文章推荐
- RHEL5下安装和配置LotusNotesClient8.5
- RHEL5下安装和配置LotusNotesClient8.5
- RHEL5.3-FTP―vsftpd服务安装和配置
- 【RedHat】RHEL5.3-FTP—vsftpd服务安装和配置
- rhel5.3上Intel 3945无线网卡驱动安装和配置(T60)
- RHEL5.3-FTP—vsftpd服务安装和配置
- RHEL6.5 db2_data_server_client客户端 安装与配置
- 【方法】lwip-2.0.2配置DHCP自动从路由器获取IP地址和DNS服务器地址, 并设置NetBIOS计算机名
- 安装rhel5.3 成功以后的配置
- CentOS5.3安装配置dhcp服务器及dhcp中继服务器
- RHEL 5 PXE+DHCP+NFS+SFTP无人职守网络安装配置 推荐
- RHEL5.3-FTP—vsftpd服务安装和配置
- RHEL6.3 Samba服务器安装配置
- DHCP安装配置
- Linux(CenOS7与RHEL7)下的Apache HTTP 服务器 2.4.29的安装与配置
- linux下安装配置DHCP服务器
- 计算机网络技术组网实习报告(二)——DHCP服务器的安装和配置
- 安装配置dhcp服务器
- 只安装和配置instantclient,用plsql developer,navicat for oracle,sqlplus连接oracle数据库
- oracle 安装检测到系统的主 IP 地址是 DHCP 分配的地址