entOS 5.4 下配置DHCP服务器全过程
2013-09-18 15:12
393 查看
entOS 5.4 下配置DHCP服务器全过程2010-06-03 10:58:55标签:DHCP服务器休闲职场CentOS原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://sdbaby.blog.51cto.com/149645/325905首先检查DHCP服务是否安装:
[root@DHCPserver /]# rpm -q dhcp
package dhcp is not installed
将光盘放入光驱,通过mount命令进行挂载。
[root@DHCPserver /]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@DHCPserver /]# cd /mnt/CentOS/
[root@DHCPserver CentOS]# ls | grep dhcp //查看关键字“dhcp”文件
dhcp-3.0.5-21.el5.i386.rpm
dhcp-devel-3.0.5-21.el5.i386.rpm
dhcpv6-1.0.10-17.el5.i386.rpm
dhcpv6-client-1.0.10-17.el5.i386.rpm
libdhcp-1.20-10.el5.i386.rpm
libdhcp4client-3.0.5-21.el5.i386.rpm
libdhcp4client-devel-3.0.5-21.el5.i386.rpm
libdhcp6client-1.0.10-17.el5.i386.rpm
libdhcp6client-devel-1.0.10-17.el5.i386.rpm
libdhcp-devel-1.20-10.el5.i386.rpm
sblim-cmpi-dhcp-0.5.5-35.el5.i386.rpm
sblim-cmpi-dhcp-devel-1-35.el5.i386.rpm
sblim-cmpi-dhcp-test-1-35.el5.i386.rpm
------------------注解----------------------
dhcp-* DHCP服务器软件包
dhclient-* DHCP客户机软件包
dhcp-devel-* DHCP开发工具,非必需
--------------------------------------------
在这个目录下有DHCP的安装包,使用rpm命令进行安装。[root@DHCPserver CentOS]# rpm -ivh dhcp-3.0.5-21.el5.i386.rpm
warning: dhcp-3.0.5-21.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]安装完之后检查是否安装到机器上。[root@DHCPserver CentOS]# rpm -q dhcp
dhcp-3.0.5-21.el5在安装目录下有一个模板(/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample),通过CP命令进行覆盖。
[root@DHCPserver CentOS]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆盖“/etc/dhcpd.conf”? y通过vi进入dhcpd.conf配置文件进行配置
[root@DHCPserver CentOS]# vi /etc/dhcpd.conf
ddns-update-style interim; #配置使用过渡性 DHCP-DNS互动更新模式。
ignore client-updates; #忽略客户端更新
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1; #路由器地址
option subnet-mask 255.255.255.0; #子网掩码选项
option nis-domain "xfbaydhcp.com";
option domain-name "xfbaydhcp.com"; #域名
option domain-name-servers 202.102.152.3; #DNS地址
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.1.100 192.168.1.200; #租用IP地址的范围
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;
}
}
设置完成,DHCP服务就搭建好了,启动服务即可。[root@DHCPserver CentOS]# service dhcpd start-----------------------注释-----------------service dhcpd start #启动服务service dhcpd stop #停止服务service dhcpd restart #重启服务
----------------------------------------------
linux客户端:
修改ifcfg-eth0的文件,将BOOTPROTO选项改为DHCP,自动获取。
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:D1:8D:D2
ONBOOT=dhcp
重新启动网络服务
[root@localhost ~]# service network restart
通过ifconfig命令可以看到已经获取到了IP地址eth0 Link encap:Ethernet HWaddr 00:0C:29:D1:8D:D2
inet addr:192.168.1.101 Bcast:192.168.1.1 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed1:8dd2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2093 errors:2 dropped:0 overruns:0 frame:0
TX packets:634 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:184237 (179.9 KiB) TX bytes:73399 (71.6 KiB)
Interrupt:169 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1129 errors:0 dropped:0 overruns:0 frame:0
TX packets:1129 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2006336 (1.9 MiB) TX bytes:2006336 (1.9 MiB)
本文出自 “SDbaby” 博客,请务必保留此出处http://sdbaby.blog.51cto.com/149645/325905
[root@DHCPserver /]# rpm -q dhcp
package dhcp is not installed
将光盘放入光驱,通过mount命令进行挂载。
[root@DHCPserver /]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@DHCPserver /]# cd /mnt/CentOS/
[root@DHCPserver CentOS]# ls | grep dhcp //查看关键字“dhcp”文件
dhcp-3.0.5-21.el5.i386.rpm
dhcp-devel-3.0.5-21.el5.i386.rpm
dhcpv6-1.0.10-17.el5.i386.rpm
dhcpv6-client-1.0.10-17.el5.i386.rpm
libdhcp-1.20-10.el5.i386.rpm
libdhcp4client-3.0.5-21.el5.i386.rpm
libdhcp4client-devel-3.0.5-21.el5.i386.rpm
libdhcp6client-1.0.10-17.el5.i386.rpm
libdhcp6client-devel-1.0.10-17.el5.i386.rpm
libdhcp-devel-1.20-10.el5.i386.rpm
sblim-cmpi-dhcp-0.5.5-35.el5.i386.rpm
sblim-cmpi-dhcp-devel-1-35.el5.i386.rpm
sblim-cmpi-dhcp-test-1-35.el5.i386.rpm
------------------注解----------------------
dhcp-* DHCP服务器软件包
dhclient-* DHCP客户机软件包
dhcp-devel-* DHCP开发工具,非必需
--------------------------------------------
在这个目录下有DHCP的安装包,使用rpm命令进行安装。[root@DHCPserver CentOS]# rpm -ivh dhcp-3.0.5-21.el5.i386.rpm
warning: dhcp-3.0.5-21.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]安装完之后检查是否安装到机器上。[root@DHCPserver CentOS]# rpm -q dhcp
dhcp-3.0.5-21.el5在安装目录下有一个模板(/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample),通过CP命令进行覆盖。
[root@DHCPserver CentOS]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆盖“/etc/dhcpd.conf”? y通过vi进入dhcpd.conf配置文件进行配置
[root@DHCPserver CentOS]# vi /etc/dhcpd.conf
ddns-update-style interim; #配置使用过渡性 DHCP-DNS互动更新模式。
ignore client-updates; #忽略客户端更新
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1; #路由器地址
option subnet-mask 255.255.255.0; #子网掩码选项
option nis-domain "xfbaydhcp.com";
option domain-name "xfbaydhcp.com"; #域名
option domain-name-servers 202.102.152.3; #DNS地址
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.1.100 192.168.1.200; #租用IP地址的范围
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;
}
}
设置完成,DHCP服务就搭建好了,启动服务即可。[root@DHCPserver CentOS]# service dhcpd start-----------------------注释-----------------service dhcpd start #启动服务service dhcpd stop #停止服务service dhcpd restart #重启服务
----------------------------------------------
linux客户端:
修改ifcfg-eth0的文件,将BOOTPROTO选项改为DHCP,自动获取。
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:D1:8D:D2
ONBOOT=dhcp
重新启动网络服务
[root@localhost ~]# service network restart
通过ifconfig命令可以看到已经获取到了IP地址eth0 Link encap:Ethernet HWaddr 00:0C:29:D1:8D:D2
inet addr:192.168.1.101 Bcast:192.168.1.1 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed1:8dd2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2093 errors:2 dropped:0 overruns:0 frame:0
TX packets:634 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:184237 (179.9 KiB) TX bytes:73399 (71.6 KiB)
Interrupt:169 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1129 errors:0 dropped:0 overruns:0 frame:0
TX packets:1129 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2006336 (1.9 MiB) TX bytes:2006336 (1.9 MiB)
本文出自 “SDbaby” 博客,请务必保留此出处http://sdbaby.blog.51cto.com/149645/325905
相关文章推荐
- CentOS 5.4 下配置DHCP服务器全过程
- CentOS 5.4 dhcp 服务器配置笔记
- Linux(CentOS 5.4 Linux)服务器配置之DHCP服务器配置应用
- DHCP 服务器的配置过程
- 构建DHCP服务器及配置DHCP中继的安装过程
- CentOS5.4安装配置dhcp服务器
- Linux下DHCP服务器配置全过程
- Linux(CentOS 5.4 Linux)服务器配置之DHCP服务器配置应用
- Linux下的DHCP服务器配置
- linux下的dhcp服务器配置总结
- CISCO 3550配置作为DHCP服务器实例
- redhat5 DHCP服务器配置
- linux DHCP服务器配置,基于CentOS6.4
- sql server 2008安装过程中服务器配置出错
- CentOS6.5配置DHCP服务器
- 在linux系统中配置DHCP服务器及DHCP中继代理
- DHCP服务器典型配置举例(路由应用)
- PHP5.4 for Apache ; php 5.4.0安装过程、方法、配置