Set up a DHCP server in Linux

Source: Internet
Author: User
Set up a DHCP server in Linux-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Original: Actors

I was studying how to set up a DNS server. I have been reading a DNS book recently. I have a big head. I want to change it to play, so I chose DHCP, I thought it would take a day to get it done. The result was just a look at the theory, and it was really easy. I was still looking for a book dedicated to studying DHCP. If I went deeper, I couldn't find the result. Khan, is DHCP so simple?

1. OS version
[Root @ server ~] # More/etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)

2. Check whether the DHCP server software has been installed in the system.
[Root @ server ~] # Rpm-qa | grep dhcp
Dhcpv6_client-0.10-14_EL4

3. mount the disc and install the DHCP server software.
[Root @ server ~] # Mount/media/cdrom
Mount: block device/dev/hdc is write-protected, mounting read-only
[Root @ server RPMS] # find/media/cdrom-name "dhcp *"
/Media/cdrom/RedHat/RPMS/dhcpv6-0.10-14_EL4.i386.rpm
/Media/cdrom/RedHat/RPMS/dhcpv6_client-0.10-14_EL4.i386.rpm
/Media/cdrom/RedHat/RPMS/dhcp-3.0.1-58.EL4.i386.rpm
/Media/cdrom/RedHat/RPMS/dhcp-devel-3.0.1-58.EL4.i386.rpm
[Root @ server RPMS] # rpm-ivh/media/cdrom/RedHat/RPMS/dhcp-3.0.1-58.EL4.i386.rpm
[Root @ server RPMS] # rpm-qa | grep dhcp
Dhcp-3.0.1-58.EL4
Dhcpv6_client-0.10-14_EL4

The installation has been successful, haha

4. Check the files.
[Root @ server RPMS] # rpm-ql grep dhcp
...
/Etc/dhcpd. conf -------------------------- dhcp configuration file
/Etc/rc. d/init. d/dhcpd
/Etc/rc. d/init. d/dhcrelay
/Etc/sysconfig/dhcpd
/Etc/sysconfig/dhcrelay
/Usr/bin/omshell
/Usr/sbin/dhcpd
/Usr/sbin/dhcrelay
/Usr/share/doc/dhcp-3.0.1
/Usr/share/doc/dhcp-3.0.1/README
/Usr/share/doc/dhcp-3.0.1/RELNOTES
/Usr/share/doc/dhcp-3.0.1/dhcpd. conf. sample ----- template of the dhcp configuration file
/Usr/share/man/man1/omshell.1.gz
/Usr/share/man/man5/dhcp-eval.5.gz
/Usr/share/man/man5/dhcpd.conf.5.gz
/Usr/share/man/man5/dhcpd.leases.5.gz
/Usr/share/man/man8/dhcpd.8.gz
/Usr/share/man/man8/dhcrelay.8.gz
/Var/lib/dhcp
/Var/lib/dhcp/dhcpd. leases ----------------- The log file for IP Address Allocation

5. [root @ server RPMS] # more/etc/dhcpd. conf
Is there anything here? COPY the template file.
[Root @ server RPMS] # cp/usr/share/doc/dhcp-3.0.1/dhcpd. conf. sample/etc/dhcpd. conf

6. view the configuration file and change it as required.
[Root @ server RPMS] # more/etc/dhcpd. conf
Ddns-update-style interim;
Ignore client-updates;
Subnet 192.168.0.0 netmask 255.255.255.0 {
# --- Default gateway
Option routers 192.168.0.1;
Option subnet-mask limit 255.0;
# Option nis-domain "domain.org ";
Option domain-name "wiscom.com.cn ";
Option domain-name-servers 219.141.136.10, 211.147.6.3;
Option time-offset-18000; # Eastern Standard Time
# Option ntp-servers 192.168.1.1;
# Option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- You understand Netbios very well
# Option netbios-node-type 2;
Range dynamic-bootp 192.168.0.128 192.168.0.254;
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;
}
}

It is already clear that all configurations of this configuration have been configured.

7. Start the DHCP server.
[Root @ server RPMS] # service dhcpd start
Starting dhcpd: [OK]

8. Check the log to see if there are any errors.
[Root @ server RPMS] # tail-20/var/log/messages
Dec 9 18:05:19 server dhcpd: Wrote 0 deleted host decls to leases file.
Dec 9 18:05:19 server dhcpd: Wrote 0 new dynamic host decls to leases file.
Dec 9 18:05:19 server dhcpd: Wrote 0 leases to leases file.
Dec 9 18:05:19 server dhcpd: Internet Systems Consortium DHCP Server V3.0.1
Dec 9 18:05:19 server dhcpd:
Dec 9 18:05:19 server dhcpd: Copyright 2004 Internet Systems Consortium.
Dec 9 18:05:19 server dhcpd: All rights reserved.
Dec 9 18:05:19 server dhcpd: For info, please visit http://www.isc.org/sw/dhcp/
Dec 9 18:05:19 server dhcpd: Wrote 0 deleted host decls to leases file.
Dec 9 18:05:19 server dhcpd: Wrote 0 new dynamic host decls to leases file.
Dec 9 18:05:19 server dhcpd: Listening on LPF/eth0/00: 0c: 29: c5: 06: fc/192.168.0/24
Dec 9 18:05:19 server dhcpd: Wrote 0 leases to leases file.
Dec 9 18:05:19 server dhcpd: Listening on LPF/eth0/00: 0c: 29: c5: 06: fc/192.168.0/24
Dec 9 18:05:19 server dhcpd: Sending on LPF/eth0/00: 0c: 29: c5: 06: fc/192.168.0/24
Dec 9 18:05:19 server dhcpd: Sending on LPF/eth0/00: 0c: 29: c5: 06: fc/192.168.0/24
Dec 9 18:05:19 server dhcpd:
Dec 9 18:05:19 server dhcpd: Sending on Socket/fallback-net
Dec 9 18:05:19 server dhcpd: Sending on Socket/fallback-net
Dec 9 18:05:19 server dhcpd:
Dec 9 18:05:20 server dhcpd: dhcpd startup succeeded

9. OK. It is okay. It seems that it is too easy to configure a DHCP under LINUX, as long as the principle is understood.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.