18
18
</section >
19
19
<?hard-pagebreak ?>
20
20
<section ><title >installing a dhcp server</title >
21
- <para >On Debian/Ubuntu </para >
21
+ <para >dhcp server for Debian/Mint </para >
22
22
<screen >debian5:~# aptitude install dhcp3-server
23
23
Reading package lists... Done
24
24
Building dependency tree
@@ -32,28 +32,72 @@ The following NEW packages will be installed:
32
32
<screen >debian5:~# ls -l /etc/dhcp3/dhcpd.conf
33
33
-rw-r--r-- 1 root root 3551 2011-04-10 21:23 /etc/dhcp3/dhcpd.conf</screen >
34
34
</section >
35
- <section ><title >dhcp server on Red Hat</title >
36
- <para >After installing we get a <command >/etc/dhcpd.conf</command > that points us to an example file named <command >dhcpd.conf.sample</command >.</para >
37
- <screen >[root@localhost ~]# cat /etc/dhcpd.conf
35
+ <section ><title >dhcp server for RHEL/CentOS</title >
36
+ <para >Installing is easy with <command >yum</command >.</para >
37
+ <screen >[root@rhel71 ~]# <command >yum install dhcp</command >
38
+ Loaded plugins: product-id, subscription-manager
39
+ Resolving Dependencies
40
+ --> Running transaction check
41
+ ---> Package dhcp.x86_64 12:4.2.5-36.el7 will be installed
42
+ --> Finished Dependency Resolution
43
+
44
+ Dependencies Resolved
45
+
46
+ ================================================================================
47
+ Package Arch Version Repository Size
48
+ ================================================================================
49
+ Installing:
50
+ dhcp x86_64 12:4.2.5-36.el7 rhel-7-server-rpms 510 k
51
+
52
+ Transaction Summary
53
+ ================================================================================
54
+ Install 1 Package
55
+
56
+ Total download size: 510 k
57
+ Installed size: 1.4 M
58
+ Is this ok [y/d/N]: y
59
+ Downloading packages:
60
+ dhcp-4.2.5-36.el7.x86_64.rpm | 510 kB 00:01
61
+ Running transaction check
62
+ Running transaction test
63
+ Transaction test succeeded
64
+ Running transaction
65
+ Installing : 12:dhcp-4.2.5-36.el7.x86_64 1/1
66
+ Verifying : 12:dhcp-4.2.5-36.el7.x86_64 1/1
67
+
68
+ Installed:
69
+ dhcp.x86_64 12:4.2.5-36.el7
70
+
71
+ Complete!
72
+ [root@rhel71 ~]#</screen >
73
+ <para >After installing we get a <command >/etc/dhcp/dhcpd.conf</command > that points us to an example file named <command >dhcpd.conf.sample</command >.</para >
74
+ <screen >[root@rhel71 ~]# <command >cat /etc/dhcp/dhcpd.conf</command >
38
75
#
39
76
# DHCP Server Configuration file.
40
- # see /usr/share/doc/dhcp*/dhcpd.conf.sample</screen >
41
- <para >So we copy the sample and adjust it for our real situation. We name the copy <command >/etc/dhcpd.conf</command >.</para >
42
- <screen >subnet 192.168.1.0 netmask 255.255.255.0 {
43
- range 192.168.1.140 192.168.1.159
44
- option routers 192.168.1.1;
45
- option subnet-mask 255.255.255.0;
46
- option domain-name "classdemo.local";
47
- option domain-name-servers 192.168.1.1;
48
- default-lease-time 21600;
49
- }</screen >
50
- </section >
51
- <section ><title >dhcp options</title >
52
- <para >Options can be set on the global, scope, client-reservation level.</para >
53
- <screen >option subnet-mask 255.255.255.0;
77
+ # see /usr/share/doc/dhcp*/dhcpd.conf.example
78
+ # see dhcpd.conf(5) man page
79
+ #
80
+ [root@rhel71 ~]#</screen >
81
+ <para >So we copy the sample and adjust it for our real situation. We name the copy <command >/etc/dhcp/dhcpd.conf</command >.</para >
82
+ <screen >[root@rhel71 ~]# <command >cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcp\
83
+ d.conf</command >
84
+ [root@rhel71 ~]# <command >vi /etc/dhcp/dhcpd.conf</command >
85
+ [root@rhel71 ~]# <command >cat /etc/dhcp/dhcpd.conf</command >
54
86
option domain-name "linux-training.be";
55
- option domain-name-servers "ns1.openminds.be";
56
- option routers 192.168.42.1;</screen >
87
+ option domain-name-servers 10.42.42.42;
88
+ default-lease-time 600;
89
+ max-lease-time 7200;
90
+ log-facility local7;
91
+
92
+ subnet 10.42.0.0 netmask 255.255.0.0 {
93
+ range 10.42.200.11 10.42.200.120;
94
+ option routers 10.42.200.1;
95
+ }
96
+ [root@rhel71 ~]#</screen >
97
+ <para >The 'routers' option is valid for the subnet alone, whereas the 'domain-name' option is global (for all subnets).</para >
98
+ <para >Time to start the server. Remember to use <command >systemctl start dhcpd</command > on RHEL7/CentOS7 and <command >service dhcpd start</command > on previous versions of RHEL/CentOS.</para >
99
+ <screen >[root@rhel71 ~]# <command >systemctl start dhcpd</command >
100
+ [root@rhel71 ~]#</screen >
57
101
</section >
58
102
<section ><title >client reservations</title >
59
103
<para >You can reserve an ip configuration for a client using the mac address.</para >
0 commit comments