Configure DHCP in RedHat Linux AS 4

Source: Internet
Author: User

The Dynamic Host Configuration Protocol of DHCP (Dynamic Host Configuration Protocol) is mainly used to automatically assign IP addresses to internal network or network service providers, it provides users or internal network administrators with central management measures for all computers. This article describes how to install and configure the DHCP server on RedHat Linux AS 4.

Dhcp ip Address Allocation Method

DHCP supports Automatic, Dynamic, and manual IP Address Allocation.

1. Automatic allocation. Once the DHCP Client successfully rents the IP address from the DHCP server for the first time, it will be used far away.

2. dynamic allocation. The IP address is not permanently used after DHCP is rented from the DHCP server for the first time. As long as the lease term expires, the client must release the IP address for use by other clients.

3. manually, in some strictly managed network environments, you often need to set a fixed IP address for some machines for special purposes. DHCP supports assigning a fixed IP address based on the MAC address.

Install the DHCP server

The Installation File for linux AS4 can be found on 4th CDs.

# Rpm-ivh dhcp-3.0.1-12-EL. i386.rpm \ install DHCP Software

# Rpm-qa | grep dhcp \ check whether it is installed

# Rpm-ql dhcp \ find the dhcpd. conf. sample Template File

# Cp dhcpd. conf. sample/etc/dhcpd. conf \ Copy the template file to/etc

#/Etc/rc. d/init. d/dhcpd start \ start DHCP

# Ps-ef | grep dhpcd \ view DHCP Process

# Netstat-nutap | grep dhcpd \ view the port running DHCP

Configure DHCP Service

# Vi dhcpd. conf \ edit the configuration file

Subnet 192.168.0.0 netmask 255.255.255.0 {\ defines the network segment, that is, DHCP can assign the IP address of this network segment.

# --- Default gateway

Option routers 192.168.0.1; \\set the gateway and router IP Address

Option subnet-mask limit 255.0; \\sets the subnet mask.

Option nis-domain "domain.org ";\\

Option domain-name "domain.org"; \ sets the DNS domain name

Option domain-name-servers 192.168.1.1; \ sets the IP address of the DNS server (separate the IDs of multiple DNS servers)

Option broadcast-address 192.1681.255 \ set the broadcast address of the DHCP Client

Option time-offset-18000; # Eastern Standard Time \ sets the deviation from Greenwich Mean time

#

#

Range dynamic-bootp 192.168.0.128 192.168.0.254; \ The range of IP addresses can be specified through the range statement (multiple ranges can be set)

Default-lease-time 21600; \ specify the default lease duration of the Client IP address (in seconds)

Max-lease-time 4320; \ sets the maximum lease IP time of the customer (in seconds)

#

Host ns {\ bind fixed IP addresses to some hosts (multiple IP addresses can be set)

Next-server marvin.redhat.com; \ sets the host name used to define the server load from the boot file. Generally, this parameter is not used (only for setting diskless workstation)

Hardware ethernet 12: 34: 56: 78: AB: CD; \ the MAC address of the NIC with a fixed IP address needs to be set

Fixed-address 207.175.42.254; \ assign an IP address to the specified MAC address

}

}

Restart the DHCP server

#/Etc/rc. d/init. d/dhcpd {[start] [stop] [restart]} \ start DHCP to disable DHCP and restart DHCP

Or

# Service dhcpd {[start] [stop] [restart]} \ start DHCP disable DHCP restart DHCP

View DHCP allocation

# Vi/var/lib/dhcp/dhcpd. lease

Retain two specific IP addresses

# Vi/etc/dhcpd. conf

Host pc1 {

Hardware ethernet 10.26.c4.04.a7.19;

Fixed-address 192.168.2.20;

}

Host pc2 {

Hardware ethernet 10.26.c4.04.a7.19;

Fixed-address 192.168.2.20;

}

# Service dhcpd restart \ restart DHCP

Client Configuration

1. Use netconfig for configuration

2 run the # vi/etc/sysconfig/network-scritps/ifcfg-eth0 configuration file

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.