服务器端:
1. 编辑/etc/dhcpsd.cnf
network 10.0.202.0 10.0.202.30-10.0.202.30
{client 1 0x1601FE4BA603 10.0.202.30
option 1 255.255.255.0
option 3 10.0.202.254
option 6 114.114.114.114
}
numLogFiles 4
logFileSize 100
logFileName /usr/tmp/dhcpsd.log
logItem SYSERR
logItem OBJERR
logItem PROTERR
logItem WARNING
logItem EVENT
logItem ACTION
logItem INFO
logItem ACNTING
logItem TRACE
leaseTimeDefault 30 minute
leaseExpireInterval 3 minute
supportBOOTP Yes
supportUnlistedClients Yes
2. 重启dhcpsd服务
stopsrc -s dhcpsd
startsrc -s dhcpsd
3. 查看dhcpsd状态
# lssrc -ls dhcpsd
Log File: /usr/tmp/dhcpsd.log
Log Level: 0xdfe
Client Expire Interval: 3600
Reserve Expire Interval: 900
Bad Addr Reclaim Interval: 4294967295
Database Save Interval: 3600
IP Address Status Duration Time Stamp Client ID
--------------- -------- -------- ------------ --------------
10.0.202.30 Free
Client端:
1. 查看状态
# lssrc -s dhcpcd
# lssrc -ls dhcpcd
2. 打开client
stopsrc -s dhcpcd
startsrc -s dhcpcd
3. 然后ifconfig查看 dhcp请求的ip.
参考:
1. http://bio.gsi.de/DOCS/www.coredumps.de/doc/ibm/aix/aix_hints_and_tips/1414638.htm
2. http://www-01.ibm.com/support/docview.wss?uid=isg3T1012460
dhcp服务器配置文件:
Configuration of the DHCP Server
Contents
About this documentRelated documentation
What is DHCP?
Configuration of the DHCP server
Different configurations
Troubleshooting and errors commonly found in the DHCP server log file
Additional information
About this document
This document describes basic setup and configuration tips for the DHCP server in conjunction with TCP/IP.
This information applies to AIX Version 4.x.
This document was written and tested with the preceding operating systems. Though the techniques and information contained in this item may work on other levels of the operating system, they have not necessarily been tested. Normal precautions should be taken in adopting these same techniques and procedures in your own environment.
Related documentation
The AIX product documentation contains a detailed description of the DHCP server, client and relay agent processes and their respective configuration file formats. Other related information is also found in the online product documentation using the TCP/IP and DNS search paths.
What is DHCP?
DHCP is Dynamic Host Control Protocol. This protocol allows network clients a way to obtain a proper network configuration without knowledge or understanding of the network. Quite simply, a client can easily obtain an IP address and other ancillary information without knowing anything about the network per se.As a means to distribute to clients IP addresses and parameters such as host names, netmasks, and DNS information, DHCP also works well as a tool for updating DNS zones and with information relevant to the network clients.
DHCP is a mechanism for the automatic network configuration of hosts through IP while IP addresses become "real estate" controlled by the server and are issued (leased) to each client.
Configuration of the DHCP server
There are numerous configurations and network topologies to consider when configuring a DHCP server. The server configuration file /etc/dhcpsd.cnf contains entries for logging information, options to return, machines to configure, and other items.
Different configurations
CASE 1: Simple IP address range
File: /etc/dhcpsd.cnf
NOTE: This information does not contain the usual documentation found inside the /etc/dhcpsd.cnf file.
Please change option 15 to your domain name.
EXAMPLE #1
NOTE: This is a basic configuration for AIX operating system levels up to and including 4.2.1. This configuration is portable on AIX 4.3.1 platforms, but requires file set enhancements other than the 4.3.1 operation system base level installation. See CASE #7, Configuring DHCP at AIX Version 4.3.1.
network 144.21.0.0 144.21.13.191-144.21.13.222 { option 1 255.255.255.0 option 3 144.21.13.11 option 6 144.21.13.31 option 15 austin.ibm.com } numLogFiles 4 logFileSize 100 logFileName /usr/tmp/dhcpsd.log logItem SYSERR logItem OBJERR logItem PROTERR logItem WARNING logItem EVENT logItem ACTION logItem INFO logItem ACNTING logItem TRACE leaseTimeDefault 30 minute leaseExpireInterval 3 minute supportBOOTP Yes supportUnlistedClients Yes
The following two lines of code should appear on one line.
updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' BOTH NONIM >> /tmp/updns.out 2>&1 "EXAMPLE #2
NOTE: This is a basic configuration for AIX operating system levels up to and including 4.2.1. This configuration is portable on AIX 4.3.1 platforms, but requires file set enhancements other than the 4.3.1 operation system base level installation. See CASE #7, Configuring DHCP at AIX version 4.3.1.
network 144.21.0.0 24 { subnet 144.21.16.0 144.21.16.191-144.21.16.222 { option 1 255.255.255.0 option 3 144.21.16.11 option 6 144.21.13.31 option 15 austin.ibm.com } } numLogFiles 4 logFileSize 100 logFileName /usr/tmp/dhcpsd.log logItem SYSERR logItem OBJERR logItem PROTERR logItem WARNING logItem EVENT logItem ACTION logItem INFO logItem ACNTING logItem TRACE leaseTimeDefault 30 minute leaseExpireInterval 3 minute supportBOOTP Yes supportUnlistedClients Yes
The following two lines of code should appear on one line.
updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' BOTH NONIM >> /tmp/updns.out 2>&1 "
CASE 2: Simple IP address range to include subnets and sub-ranges
File: /etc/dhcpsd.cnf
NOTE: This is a basic configuration for AIX operating system levels up to and including 4.2.1. This configuration is portable on AIX 4.3.1 platforms, but requires file set enhancements other than the 4.3.1 operation system base level installation. See CASE #7, Configuring DHCP at AIX version 4.3.1.
This information does not contain the usual documentation found inside the /etc/dhcpsd.cnf file.
Please change option 15 to your domain name.network 171.28.0.0 24 { option 1 255.255.255.0 option 6 144.21.13.31 option 15 subdomain.austin.ibm.com subnet 171.28.4.0 171.28.4.220-171.28.4.250 { option 3 171.28.4.10 } subnet 171.28.7.0 171.28.7.220-171.28.7.250 { option 3 171.28.7.10 } subnet 171.28.16.0 171.28.16.220-171.28.16.250 { option 3 171.28.16.10 } subnet 171.28.17.0 171.28.17.220-171.28.17.250 { option 3 171.28.17.10 } }
numLogFiles 4 logFileSize 100 logFileName /usr/tmp/dhcpsd.log logItem SYSERR logItem OBJERR logItem PROTERR logItem WARNING logItem EVENT logItem ACTION logItem INFO logItem ACNTING logItem TRACE leaseTimeDefault 30 minute leaseExpireInterval 3 minute supportBOOTP Yes supportUnlistedClients Yes
The following two lines of code should appear on one line.
updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' BOTH NONIM >> /tmp/updns.out 2>&1 "
CASE 3: Client IP address assignment and exclusion
File: /etc/dhcpsd.cnf
NOTE: This information does not contain the usual documentation found inside the /etc/dhcpsd.cnf file.
Please change option 15 to your domain name.
The Client assignment line shows how to give this client the same IP address every time. Only this client can receive this IP address.
The Client exclusion line shows how to deny or exclude this IP address. No client can receive this IP address. The server status will show Not Available for this IP address.
network 144.21.0.0 24 { subnet 144.21.16.0 144.21.16.195-144.21.16.220 { client 1 0x00aa00c12c2d 144.21.16.199 # Client assignment client 0 0 144.21.16.200 # Client exclusion option 1 255.255.255.0 option 3 144.21.16.11 option 6 144.21.13.31 option 15 austin.ibm.com } }
numLogFiles 4 logFileSize 100 logFileName /usr/tmp/dhcpsd.log logItem SYSERR logItem OBJERR logItem PROTERR logItem WARNING logItem EVENT logItem ACTION logItem INFO logItem ACNTING logItem TRACE leaseTimeDefault 30 minute leaseExpireInterval 3 minute supportBOOTP Yes supportUnlistedClients Yes
The following two lines of code should appear on one line.
updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' BOTH NONIM >> /tmp/updns.out 2>&1 "
CASE 4: Multiple network assignments
File: /etc/dhcpsd.cnf
Please change option 15 to your domain name.
network 144.21.0.0 144.21.13.191-144.21.13.222 { option 1 255.255.255.0 option 3 144.21.13.11 option 6 144.21.13.31 option 15 austin.ibm.com } network 144.21.0.0 24 { subnet 144.21.16.0 144.21.16.195-144.21.16.220 { option 1 255.255.255.0 option 3 144.21.16.11 option 6 144.21.13.31 option 15 austin.ibm.com } } network 171.28.0.0 24 { option 1 255.255.255.0 option 6 144.21.13.31 option 15 austin.ibm.com subnet 171.28.4.0 171.28.4.220-171.28.4.250 { option 3 171.28.4.10 } subnet 171.28.7.0 171.28.7.220-171.28.7.250 { option 3 171.28.7.10 } subnet 171.28.16.0 171.28.16.220-171.28.16.250 { option 3 171.28.16.10 } subnet 171.28.17.0 171.28.17.220-171.28.17.250 { option 3 171.28.17.10 } }
#Log file and trace information. See other examples in other cases.
The following two lines of code should appear on one line.
updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' BOTH NONIM >> /tmp/updns.out 2>&1 "
CASE 5: Bootp client support
File: /etc/dhcpsd.cnf
NOTE: This information does not contain the usual documentation found inside the /etc/dhcpsd.cnf file.
supportBOOTP Yes supportUnlistedClients Yes
These lines are not mutually exclusive. They should both be yes to support bootp clients. /usr/sbin/bootptodhcp is a converter routine for bootp client support.
The following steps should be taken to support bootp clients:
- Configure bootp clients in /etc/bootptab. Make sure this works.
- Comment out the bootp line in the /etc/inetd.conf file.
- Run the command /usr/sbin/bootptodhcp.
- Edit the /etc/dhcpsd.cnf file and add SA records for the bootp clients in the form sa=<ipaddress> where ipaddress is the bootp server.
- Start the dhcpsd daemon.
See APAR number IX58812 for a problem with a backslash (\) in /etc/bootptab.
CASE 6: DDNS and the nameserver configuration
File: /etc/dhcpsd.cnf
NOTE: This information does not contain the usual documentation found inside the /etc/dhcpsd.cnf file.
The following two lines of code should appear on one line.
updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' BOTH NONIM >>
This line must be uncommented in the /etc/dhcpsd.cnf file. The nameserver must support DDNS. At the time of this writing, AIX 4.1.4, AIX 4.2.0 and AIX 4.3.x are the only operating systems that support DDNS. No other vendor's operating system supports DDNS with the exception of WindowsNT beta v4. This beta or test version of WindowsNT may support DDNS.
Please perform the following steps for DHCP and DDNS.
In the /etc/dhcpsd.cnf file:
- Uncomment the following line; it should appear as one line:
updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' PTR NONIM >>
The PTR means the pointer record will be updated. This is the default value. If you want to update the A record and the pointer record, you should change PTR to BOTH.
That line will read (the following two lines of code should appear on one line):
updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' BOTH NONIM >>
- Change the /etc/named.boot file as follows:
primary domainname.com /etc/named.data dynamic controlled primary in-addr.arpa /etc/named.rev dynamic controlled
The dynamic keyword is required for the named.rev line if the updateDNS line shows the PTR update. Since the updateDNS line shows BOTH NONIM, then the dynamic keyword is required for the named.data and named.rev lines in the /etc/named.boot file.
Add the keyword controlled to the dynamic lines, as it acts like secured and allows updates.
Refresh the named subsystem. Enter: refresh -s named
DDNS is documented in the online product documentation using the following search path:
List of Books AIX System Management Guide: Communications and Networks TCP/IP Name Resolution
EXAMPLE /etc/named.boot file:
primary ztrans.com /etc/named.data dynamic controlled primary 0.0.127.in-addr.arpa /etc/named.local primary 32.3.9.in-addr.arpa /etc/named.rev cache . /etc/named.ca
CASE 7: Simple configuration at AIX Version 4.3.1 and higher
NOTE: For AIX Versions 4.3.1 and later, the DHCP protocol engine has been updated to RFC 2131. It is still compatible with RFC 1541 and can also process options as defined in RFC 2132. The protocol engine uses the database to determine what information should be returned to the client.Overview of DHCP at 4.3.1
As with earlier AIX versions, the DHCP server is configured by reading the /etc/dhcpsd.cnf file, which specifies the server's initial database of options and addresses. The server is started in the /etc/rc.tcpip file, or it can be started from Web-based System Manager, from SMIT, or through SRC commands.Configuring the DHCP server is usually the most difficult part of using DHCP in your network. First, determine what networks must have DHCP clients. Each subnet in your network represents a pool of addresses that the DHCP server must add to its database. For example:
database db_file { subnet 9.3.149.0