1. Install the DHCP server
linux ipv6 dhcp client
1. Check whether DHCP is installed in the system.
# Rpm-Qa | grep DHCP
2. Install the RPM package. If the rea Hat Linux9 installation package is in the second chapter of the CD, linux interfaces dhcp you can find the DHCP package by using the find command after mounting it to the optical drive.
# Find/mnt/CDROM/-name "DHCP"
3. Check the file path found by the find command for installation.
# Rpm-IVH/mnt/CDROM/RedHat/RPMS/DHCP */DHCPD * (based on your actual file path)
4. After the installation is complete, copy the configuration file template to/etc/DHCPD. conf. You can also manually write
# Cp/usr/share/doc/DHCP-*/DHCP. conf. Sample/dev/DHCPD. conf
5. modify the configuration file/etc/DHCPD. conf. The parameters are described below.
Ddns-Update-style interim;
# Configure interaction update mode using transitional DHCP-DNS
Ignore client-updates;
# Ignore client updates
Subnet 192.168.0.0 netmask 255.255.255.0 {
# Set subnet Declaration
# -- Default getway
Optionrouters 192.168.0.1
# Set the default network bit 192.168.0.1
Option subnet-mask limit 255.0
# Set the client Subnet Mask
Option Nis-domain "domain.org"
# Set the NIS domain for the customer
Option domain-name "domain.org"
# Domain name setting by a customer
Option domain-name0servers 192.168.1.1
# Set a Domain Name Server for the customer
Option time-offset-18000; # Eastern Standard Time
# Set the offset time
# Option NTP-server 192.1668.1.1
# Set NTP server
Option netbios-name-servers192.168.1.1
Set the WINS Server
# -- Selects point-to-point node (default is hybrid) Don't change this unless
# -- You understand NetBIOS very well
# Option NetBIOS-node-type 2;
# Set the NetBIOS Node Type
Range dynamic-BOOTP 192.168.0.128 192.168.0.255;
# Set a dynamic address pool.
Default-lease-time 21600;
# Set the default address rental period (in seconds, 6 hours by default ).
Max-lease-time 43200;
# Set the maximum address lease period for the client (unit: seconds, default: 12 hours)
# We want the nameserver to appear at a fixed address
# Set to retain the IP address to the specified client,
Host NS {
Next-server marvin.redhat.com;
# Set the host name that the server installs from the boot file for diskless websites.
Hardware Ethernet 12: 34: 56: 78: AB: CD;
Specifies the MAC address of a DHCP client.
Fixed-address 207.175.42.254;
Assign an IP address to a specified MAC address
}
}
6. Start the DHCPD service after setting
# Service DHCPD start
linux dhcp server configuration pdf
7. view the IP address allocated to the server
# Cat/var/lib/DHCPD. Leases
linux gui dhcp server
II. the Linux client automatically obtains the IP address
Method 1. Modify the/etc/sysconfig/network-scriptes/ifcfg-eth0 File
These rows should be included
Device = eth0
Bootproto = DHCP
Onboot = Yes
Method 2: run the setup or netconfig command to enter the graphic interface and modify the network config TCP/IP Settings
Select use ddynamic IP (BOOTP/DHCP ).
Iii. Linux DHCP network troubleshooting examples
One day, linux enable dhcp command line an SuSE Linux 9.1 DHCP server was deployed on the network. DHCP is the Dynamic Host Configuration Protocol.
It is used to automatically provide IP addresses, subnet masks, and route information to the computer. Software Installation on servers and clients is simple.
. However, clients in the network (using the operating system: Mandrake Linux 9.0 and SuSE Linux 9.1) cannot obtain
IP address. Based on experience, it may be that the Linux DHCP server cannot receive DHCP clients from 255.255.255.
REQUEST packets. Run the ifconfig-a command to query the NIC settings of the server:
[Root @ WWW Cao] # ifconfig
Eth0 link encap: Ethernet hwaddr 00: 50: FC: 56: 75: F5
Inet ADDR: 192.168.1.4 bcast: 192.168.1.255 mask: 255.255.255.0
Up broadcast running MTU: 1500 Metric: 1
RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 4 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 100
RX Bytes: 0 (0.0 B) TX Bytes: 240 (240.0 B)
Interrupt: 10 Base Address: 0x2000
......
I did not find the multicast settings above. Why does the system need the multicast function? The reason is:
To enable the DHCPD (DHCP daemon) to communicate with the DHCP client normally, DHCPD must send packets
255.255.255.255, but in some Linux systems, 255.255.255.255 is used as a monitoring IP address.
The IP address of the listener region subdomain (local subnet) broadcast, so you need to add it to the route table
Limit limit 255 to activate the multicast function. Run the command: Route add-host route limit 255 Dev.
Eth0
Troubleshooting.
If an error message indicating 255.255.255.255: Unknown host occurs, first modify the file:/etc/hosts and add
Input row:
255.255.255.255 DHCP
After saving the disk, run the following command: (you can also add this line to/etc/rc. d/rc. Local to boot and run the command)
Route add-host route 255.255.255 Dev eth0
To save the settings, add a line to the/etc/sysconfig/static-routes file:
Eth0 host 255.255.255.255
When the server is restarted, the route table is automatically set ). Then use the ifconfig query command to check
Check and find that clients using SuSE Linux 9.1 are working normally, but those using the Mandrake Linux 9.0 client are still not
Obtain the IP address. According to the Linux tool book and discussions with friends in the Linux community, we found that the problem lies in the manrake Linux
9.0 The DHCP client used by the client is incompatible with the DHCP server.
Troubleshooting method: run the RPM command to uninstall the default DHCP Client program used by the Mandrake Linux 9.0 client:
Dhclient; install other client programs compatible with the DHCP server: dhcpcd.
#/Etc/rc. d/init. d/network stop
# Rpm-e dhclient
# Rpm-IVH dhcpcd-1.3.22pl4-2mdk.i586.rpm
#/Etc/rc. d/init. d/network start
The network and the new DHCP client will be started several seconds later. Use the ifconfig command to view each Mandrake
The linux 9.0 client has been assigned an IP address. Setting IP addresses for each computer in the network is troublesome,
DHCP can be used to solve these problems. The DHCP server can automatically assign IP addresses, but sometimes the server and client
If there is incompatibility, you must replace the client program. Linux provides four DHCP client programs: pump,
Dhclient, dhcp xd, and dhcpcd. Understand the client programs of different Linux releases for Linux network administrators
Important.