二、dhcp服务安装
[root@BenX /]# yum install -y dhcp
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package dhcp.x86_64 12:4.1.1-38.P1.el6.centos will be installed
–> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================
Package Arch Version Repository Size
================================================================================================================
Installing:
dhcp x86_64 12:4.1.1-38.P1.el6.centos local_server 817 k
Transaction Summary
================================================================================================================
Install 1 Package(s)
Total download size: 817 k
Installed size: 1.9 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 12:dhcp-4.1.1-38.P1.el6.centos.x86_64 1/1
Verifying : 12:dhcp-4.1.1-38.P1.el6.centos.x86_64 1/1
Installed:
dhcp.x86_64 12:4.1.1-38.P1.el6.centos
Complete!
[root@BenX /]# vi /etc/dhcp/dhcpd
dhcpd6.conf dhcpd.conf
[root@BenX /]# vi /etc/dhcp/dhcpd.conf
[root@BenX /]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see ‘man 5 dhcpd.conf’
#
[root@BenX /]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd001.conf
[root@BenX /]# cd /etc/dhcp
[root@BenX dhcp]# ls
dhclient.d dhcpd001.conf dhcpd6.conf dhcpd.conf
[root@BenX dhcp]# mv dhcpd.conf dhcpd.conf.bak242
[root@BenX dhcp]# mv dhcpd001.conf dhcpd.conf
[root@BenX ~ 22:36]#vi /etc/dhcp/dhcpd.conf
[root@BenX ~ 22:38]#cat /etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks…
option routers 192.168.242.1;
option subnet-mask 255.255.255.0;
option domain-name “example.org”;
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.242.0 netmask 255.255.255.0 {
range 192.168.242.100192.168.242.150;
range 192.168.242.180192.168.242.240;
}
[root@BenX ~ 22:38]#service dhcpd start
[root@BenX ~ 22:39]#service dhcpd status
dhcpd (pid 3497) 正在运行…
[root@BenX ~ 22:39]#
[root@BenX ~ 22:39]#cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.1.1-P1
server-duid “\000\001\000\001)\313GO\000\014)\212\322]”;
lease 192.168.242.100 {
starts 1 2022/03/21 14:25:46;
ends 1 2022/03/21 14:35:46;
cltt 1 2022/03/21 14:25:46;
binding state active;
next binding state free;
hardware ethernet 00:50:56:c0:00:08;
uid “\001\000PV\300\000\010”;
client-hostname “Ben”;
}
lease 192.168.242.101 {
starts 1 2022/03/21 14:29:11;
ends 1 2022/03/21 14:39:11;
cltt 1 2022/03/21 14:29:11;
binding state active;
next binding state free;
hardware ethernet 00:0c:29:4b:70:fc;
uid “\001\000\014)Kp\374”;
client-hostname “ks3”;
}
没有回应