Centos6.5-DHCPServer安裝,

來源:互聯網
上載者:User

Centos6.5-DHCPServer安裝,

1、查詢dhcp有沒有被安裝,如下沒有被安裝

[zfp@localhost ~]$ rpm -q dhcp
package dhcp is not installed
[zfp@localhost ~]$

2、查詢yum網路源中有關dhcp的rpm包

[root@localhost zfp]# yum list |grep dhcp
dhcp.x86_64                        12:4.1.1-53.P1.el6.centos.1 updates         
dhcp-common.x86_64                 12:4.1.1-53.P1.el6.centos.1 updates         
dhcp-devel.i686                    12:4.1.1-53.P1.el6.centos.1 updates         
dhcp-devel.x86_64                  12:4.1.1-53.P1.el6.centos.1 updates         
sblim-cmpi-dhcp.i686               1.0-1.el6                   base            
sblim-cmpi-dhcp.x86_64             1.0-1.el6                   base            
sblim-cmpi-dhcp-devel.i686         1.0-1.el6                   base            
sblim-cmpi-dhcp-devel.x86_64       1.0-1.el6                   base            
sblim-cmpi-dhcp-test.x86_64        1.0-1.el6                   base 

3、安裝dhcp

[root@localhost zfp]# yum install dhcp -y

4、查詢是否安裝成功

[root@localhost zfp]# rpm -q dhcp
dhcp-4.1.1-53.P1.el6.centos.1.x86_64
[root@localhost zfp]#

查詢安裝的含有dhcp字串包名的rpm包
[root@localhost zfp]# rpm -qa |grep dhcp
dhcp-common-4.1.1-53.P1.el6.centos.1.x86_64
dhcp-4.1.1-53.P1.el6.centos.1.x86_64

5、修改設定檔/etc/dhcp/dhcpd.conf

不同的發行版不一定是/etc/dhcp/dhcpd.conf這個檔案,也可能是/etc/dhcpd.conf,centos6.5發行版是/etc/dhcp/dhcpd.conf

[root@localhost zfp]#vim /etc/dhcp/dhcpd.conf

ddns-update-style interim;      #表示dhcp伺服器和dns伺服器的動態資訊更新模式 

ignore client-updates;          #忽略用戶端更新

subnet 192.168.145.0 netmask 255.255.255.0 {        #意思是我所分配的ip地址所在的網段為192.168.145.0 子網路遮罩為255.255.255.0

   range 192.168.145.200 192.168.145.210;            #租用IP地址的範圍

  option domain-name-servers 8.8.8.8;

  option domain-name "example.org";

  option routers 192.168.145.100;                    #路由器地址,這裡是當前 dhcp 機器的IP地址

  option subnet-mask 255.255.255.0;                  #子網路遮罩

  default-lease-time 600;                            #預設租約時間

  max-lease-time 7200;                              #最大租約時間

#host myhost {                                      #設定主機聲明

#hardware ethernet 08:00:27:2C:30:8C;            #指定dhcp客戶的mac地址

#fixed-address 192.168.145.155;                  #給指定的mac地址分配ip

# }

}


[root@localhost zfp]#vim /etc/sysconfig/dhcpd
DHCPDARGS=eth0     #指定在eth0網卡上提供dhcpserver服務

6、開啟dhcp服務

[root@localhost zfp]# service dhcpd status
dhcpd (pid  4478) 正在運行...
[root@localhost zfp]#

如果有報錯,查看dhcp服務開啟的時候,報什麼錯誤cat /var/log/messages  或者tail -f /var/log/messages &

如下是正常開啟dhcp服務的log資訊

Jan  1 03:09:42 localhost dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1
Jan  1 03:09:42 localhost dhcpd: Copyright 2004-2010 Internet Systems Consortium.
Jan  1 03:09:42 localhost dhcpd: All rights reserved.
Jan  1 03:09:42 localhost dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Jan  1 03:09:42 localhost dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Jan  1 03:09:42 localhost dhcpd: Wrote 0 leases to leases file.
Jan  1 03:09:42 localhost dhcpd: Listening on LPF/eth0/00:0c:29:9b:2d:be/192.168.145.0/24
Jan  1 03:09:42 localhost dhcpd: Sending on   LPF/eth0/00:0c:29:9b:2d:be/192.168.145.0/24
Jan  1 03:09:42 localhost dhcpd: Sending on   Socket/fallback/fallback-net

[root@localhost network-scripts]# netstat -anulp | grep :67
udp        0      0 0.0.0.0:67                  0.0.0.0:*                               4591/dhcpd         
[root@localhost network-scripts]#

End Of File

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.