[AIX 네트워크 관리 20] TCP/IP (14) DHCP와 NIM, DHCPv6 개요와 서버 구조
https://archive.horanglab.com/posts/aix-net-tcpip-14
핵심 정리
- DHCP와 NIM: NIM 객체에는 될 수 있는 대로 호스트 이름을 쓰고, NIM master와 DHCP 서버를 같은 시스템에 둡니다. NIM 클라이언트의 기본 임대 시간은 설치 시간의 두 배로 잡습니다. DNS의 PTR·A 레코드는 모두 dhcpsd 서버가 맡도록 클라이언트
dhcpcd.ini의 updatedns는NONE NONIM, 서버dhcpsd.cnf는BOTH NIM으로 둡니다. BOS 설치 대기 상태는 짧게 합니다. - DHCPv6(RFC 3315): 클라이언트 dhcpcd6이 링크 로컬 주소로
All_DHCP_Relay_Agents_and_Servers에 SOLICIT → 서버가 ADVERTISE → 클라이언트가 REQUEST → 서버가 REPLY로 할당합니다. preferred-lifetime이 끝나면 RENEW, 응답이 없으면 REBIND를 멀티캐스트하고, valid-lifetime이 지나면 인터페이스에서 주소를 지웁니다. DHCPv4 서버와 같은 링크에 함께 있을 수 있습니다. - 클라이언트는 IA_NA(임시가 아닌 주소)와 IA_TA(임시 주소)를 여럿 가질 수 있고, DUID는 재부팅해도 바뀌지 않는 고유 식별자입니다. 서버는 class, vendor, client ID(DUID), inoption 키로 주소와 옵션을 고릅니다.
- DHCPv6 서버(dhcpsdv6)는 데이터베이스(
db_filev6.dhcpo, 파일은 손으로 고치지 말 것, 상태 FREE~BAD, 시각은 2000년 1월 1일부터의 초), 프로토콜 엔진, 스레드(main, src, dadmin, garbage, 패킷 처리기 기본 1·최대 50, 로깅 기본 1·최대 50, table manager, process, reconfigure)로 이루어집니다. SIGUSR1은 구성 데이터베이스를 덤프합니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 DHCPv6 인증 필드와 reconfigure 스레드가 더해짐) |
| 원문 | Networks and communication management — 5.3판 195200쪽, 6.1판 273279쪽 |
| 파일 | /etc/dhcpcd.ini, /etc/dhcpsd.cnf, db_filev6.dhcpo, /etc/dhcpv6/db_file6.cr, /etc/dhcpv6/db_file6.crbk |
| 관련 명령어 | dhcpaction, dhcpcd6, dhcpsdv6, dadmin, autoconf6 |
| 관련 RFC | RFC 3315(DHCPv6), RFC 3041(임시 주소) |
DHCP와 NIM 제안
IP 주소를 동적으로 할당하는 개념은 꽤 새롭습니다. DHCP와 NIM(Network Installation Management)의 상호 작용을 돕는 제안입니다.
- NIM 환경에서 객체를 구성할 때는 될 수 있는 대로 호스트 이름을 씁니다. 그러면 NIM 환경에서 호스트 이름을 IP 주소로 바꿀 때 IP 주소를 갱신하는 동적 이름 서버를 쓸 수 있습니다.
- NIM master와 DHCP 서버를 같은 시스템에 둡니다. DHCP 서버의 DNS 갱신 문자열에는
NIM으로 설정하면, 주소가 바뀔 때 NIM 객체가 정적 IP 주소가 필요한 상태에 머물지 않게 하려고 하는 옵션이 있습니다. - NIM 클라이언트의 기본 임대 시간을 클라이언트 설치에 걸리는 시간의 두 배로 설정합니다. 그러면 설치하는 동안 빌린 IP 주소가 유효합니다. 설치가 끝나면 클라이언트를 다시 시작합니다. 설치 종류에 따라 DHCP가 시작되거나 구성해야 합니다.
dhcpsd서버가 PTR과 A DNS 레코드를 모두 맡아야 합니다. NIM이 기계를 다시 설치하면 RSA가 든 파일이 지워져 클라이언트가 자기 레코드를 갱신할 수 없습니다. 서버가 시스템 레코드를 갱신합니다. 그러려면/etc/dhcpcd.ini의updatedns줄을 다음처럼 바꿉니다.
updatedns "/usr/sbin/dhcpaction ’%s’ ’%s’ ’%s’ ’%s’ ’%s’ NONE NONIM"
/etc/dhcpsd.cnf 파일의 updatedns 줄은 다음처럼 바꿉니다.
updatedns "/usr/sbin/dhcpaction ’%s’ ’%s’ ’%s’ ’%s’ ’%s’ BOTH NIM"
참고: NIM 객체가 BOS 설치 대기(installation-pending) 상태가 되면 dhcpsd 서버가 원래 의도와 다른 인수를 넘길 수 있습니다. 이런 상황을 피하려면 클라이언트가 이 대기 상태에 있는 시간을 줄입니다.
이 제안들로 NIM 환경이 동적 클라이언트와 함께 동작할 수 있습니다.
NIM에 관한 자세한 내용은 AIX 5L Version 5.3 Network Installation Management Guide and Reference를 봅니다.
영어 원문
DHCP and Network Installation Management suggestions
The concept of dynamically assigning Internet Protocol (IP) addresses is fairly new. The following suggestions are provided to help with DHCP and Network Installation Management (NIM) interaction.
When configuring objects in the NIM environment, use host names whenever possible. This allows you to use a dynamic name server that updates the IP addresses when the host name is converted to an IP address in the NIM environment.
Place the NIM master and the DHCP server on the same system. The DHCP server has an option in the update DNS string that, when set to
NIM, attempts to keep the NIM objects out of those states that need static IP addresses when those addresses change.For NIM clients, set the default lease time to twice the time it takes to install a client. This allows a leased IP address to be valid during the installation. After the installation, restart the client. DHCP will be started or will need to be configured, depending on the type of installation.
The
dhcpsdserver should be responsible for both the PTR and the A DNS records. When NIM reinstalls the machine, the file containing the RSA is deleted, and the client cannot update its records. The server updates the system records. To do this, change theupdatednsline in/etc/dhcpcd.inito:
updatedns "/usr/sbin/dhcpaction ’%s’ ’%s’ ’%s’ ’%s’ ’%s’ NONE NONIM"
In the /etc/dhcpsd.cnf file, change the updatedns line to:
updatedns "/usr/sbin/dhcpaction ’%s’ ’%s’ ’%s’ ’%s’ ’%s’ BOTH NIM"
Note: When a NIM object is placed into the BOS installation-pending state, the dhcpsd server might pass arguments that are different from those originally intended. Minimize the time the client is in this pending state to avoid this situation.
These suggestions allow the NIM environment to work with dynamic clients.
For more information on Network Installation Management, see AIX 5L™Version 5.3 Network Installation Management Guide and Reference.
DHCP 버전 6(DHCPv6)
DHCP는 네트워크 구성을 한곳에서 관리하는 방법을 제공합니다. 이 주제는 DHCPv6 전용이며, 따로 밝히지 않는 한 "IP 주소"는 모두 IPv6 주소를, "DHCP"는 모두 DHCPv6을 가리킵니다.
DHCPv4 서버는 같은 링크에서 DHCPv6 서버와 함께 있을 수 있습니다. 프로토콜의 자세한 설명은 RFC 3315를 봅니다.
DHCP는 네트워크의 클라이언트 기계가 서버에서 IP 주소와 다른 구성 매개변수를 얻게 하는 응용 계층 프로토콜입니다. 이 매개변수는 옵션으로 정의됩니다. 옵션은 클라이언트의 데몬과 서버의 데몬이 패킷을 주고받아 얻으며, 이 메시지 교환은 UDP 패킷으로 이루어집니다. 클라이언트는 autoconf6 명령이나 다른 방법으로 얻은 링크 로컬 주소로 서버에 출발지 주소를 알립니다. 서버는 예약된 링크 범위 멀티캐스트 주소에서 기다립니다. 클라이언트와 서버가 같은 링크에 있지 않으면 릴레이 에이전트가 둘이 통신하게 합니다.
이 주제는 IA_NA 하나와 그 IA_NA의 주소 하나가 있는 인터페이스 하나에 대한 네 단계 메시지 교환(핸드셰이크)을 설명합니다. IP 주소를 얻으려고 DHCP 클라이언트 데몬(dhcpcd6)은 All_DHCP_Relay_Agents_and_Servers 주소로 SOLICIT 메시지를 보내고, 서버가 이를 받아 처리합니다(중복성을 위해 네트워크에 서버를 여럿 구성할 수 있습니다). 그 클라이언트에 줄 빈 주소가 있으면 ADVERTISE 메시지를 만들어 클라이언트에 돌려보냅니다. 이 메시지에는 그 클라이언트에 알맞은 IP 주소와 다른 옵션이 들어 있습니다. 클라이언트는 서버의 DHCP ADVERTISE 메시지를 받아 저장하고 다른 광고를 기다립니다. 가장 좋은 광고를 고르면 어느 서버의 광고를 원하는지 지정한 DHCP REQUEST를 All_DHCP_Relay_Agents_and_Servers 주소로 보냅니다.
구성된 모든 DHCP 서버가 REQUEST 메시지를 받습니다. 각 서버는 자기가 요청된 서버인지 확인합니다. 서버는 서버 DUID가 자기 것과 맞지 않는 패킷은 처리하지 않습니다. 요청된 서버는 주소를 할당됨으로 표시하고 DHCP REPLY를 돌려주며, 이때 트랜잭션이 끝납니다. 클라이언트는 서버가 정한 기간(valid-lifetime) 동안 주소를 가집니다.
주소의 preferred-lifetime이 끝나면 클라이언트는 임대 시간을 늘리려고 서버에 RENEW 패킷을 보냅니다. 서버가 주소를 갱신해 주려면 DHCP REPLY를 보냅니다. 현재 주소를 소유한 서버에서 응답을 받지 못하면, 예를 들어 서버가 다른 네트워크로 옮겨졌을 때를 대비해 DHCP REBIND 패킷을 멀티캐스트합니다. valid-lifetime이 지나도록 주소를 갱신하지 못하면 인터페이스에서 주소를 지우고 과정을 처음부터 다시 시작합니다. 이 주기 덕분에 네트워크의 여러 클라이언트에 같은 주소가 할당되지 않습니다.
클라이언트는 IA_NA 옵션을 여럿 가질 수 있고, 각 IA_NA는 주소를 여럿 가질 수 있습니다. 클라이언트는 IA_TA 옵션도 여럿 가질 수 있으며 각각 주소를 여럿 가질 수 있습니다.
| 용어 | 뜻 |
|---|---|
| IA_NA(Identity association for non-temporary addresses) | 임시 주소가 아닌 할당 주소를 나르는 IA |
| IA_TA(Identity association for temporary addresses) | 임시 주소를 나르는 IA(RFC 3041 참고) |
| DUID | DHCP 참여자의 DHCP 고유 식별자(DHCP-Unique identifier). 각 DHCP 클라이언트와 서버에는 재부팅해도 바뀌지 않는 고유 DUID가 있습니다. |
DHCP 서버는 키를 바탕으로 주소를 줍니다. 흔한 키 네 가지는 class, vendor, client ID, inoption입니다. 서버는 이 키로 주소를 할당하고 클라이언트에 돌려줄 구성 옵션 묶음을 정합니다.
| 키 | 설명 |
|---|---|
| class | 클라이언트가 완전히 구성할 수 있습니다. 주소와 옵션을 지정할 수 있습니다. 네트워크에서 기계의 역할이나 관리 목적으로 기계를 어떻게 묶는지를 나타내는 데 쓸 수 있습니다. 예를 들어 네트워크 관리자는 NetBIOS 클라이언트용 옵션이 든 NetBIOS 클래스나, 특정 프린터에 접근해야 하는 회계 부서 기계를 나타내는 accounting 클래스를 만들 수 있습니다. |
| vendor | 하드웨어와 소프트웨어 플랫폼으로 클라이언트를 식별하는 데 도움을 줍니다. |
| client ID | DUID로 클라이언트를 식별합니다. client ID는 dhcpcd 데몬의 duid 파일에 지정합니다. 서버는 client ID로 특정 클라이언트에 옵션을 주거나, 특정 클라이언트가 어떤 매개변수도 받지 못하게 할 수 있습니다. |
| inoption | 클라이언트가 요청한 옵션으로 클라이언트를 식별합니다. |
이 키들은 하나만 쓰거나 조합해 쓸 수 있습니다. 클라이언트가 여러 키를 주고 여러 주소를 할당할 수 있으면 하나만 고르며, 옵션 묶음은 고른 키에서 먼저 가져옵니다.
클라이언트의 첫 멀티캐스트가 로컬 네트워크를 벗어나려면 릴레이 에이전트가 필요합니다. 릴레이 에이전트는 DHCP 패킷의 전달 에이전트 역할을 합니다.
영어 원문
Dynamic Host Configuration Protocol version 6
The Dynamic Host Configuration Protocol (DHCP) provides a method to maintain network configurations in a centralized location. This topic is DHCPv6-specific; all references to "IP address" refer to IPv6 addresses, and all references to "DHCP" refer to DHCPv6 (unless otherwise stated).
A DHCPv4 server can coexist on the same link with a DHCPv6 server. For an in-depth explanation of the protocol, see RFC 3315.
DHCP is an application-layer protocol that allows a client machine on the network to get IP addresses and other configuration parameters from the server. These parameters are defined in options. Options are obtained by exchanging packets between a daemon on the client and another on the server. These message exchanges are in the form of UDP packets. A client uses a link-local address, whether through the autoconf6 command or other methods, to identify its source address to the server. The server listens on a reserved link-scope multicast address. A relay agent will allow the client and server to communicate if they are not located on the same link.
This topic explains the four-message exchange handshake for a single interface with one IA_NA and one address for this IA_NA. To obtain an IP address, the DHCP client daemon (dhcpcd6) sends a SOLICIT message to the All_DHCP_Relay_Agents_and_Servers address, which is received by the server and processed. (Multiple servers can be configured on the network for redundancy.) If a free address is available for that client, an ADVERTISE message is created and sent back to the client. This message contains an IP address and other options that are appropriate for that client. The client receives the server DHCP ADVERTISE message and stores it while waiting for other advertisements. When the client has chosen the best advertisement, it sends a DHCP REQUEST to the All_DHCP_Relay_Agents_and_Servers address specifying which server advertisement it wants.
All configured DHCP servers receive the REQUEST message. Each checks to see if it is the requested server. The server does not process any packet with a server DUID that does not match its own. The requested server marks the address as assigned and returns a DHCP REPLY, at which time, the transaction is complete. The client has an address for the period of time (valid-lifetime) designated by the server.
When the preferred-lifetime expires for the address, the client sends the server a RENEW packet to extend the lease time. If the server is willing to renew the address, it sends a DHCP REPLY. If the client does not get a response from the server that owns its current address, it multicasts a DHCP REBIND packet if, for example, the server has been moved from one network to another. If the client has not renewed its address after the valid-lifetime, the address is removed from the interface and the process starts over. This cycle prevents multiple clients on a network from being assigned the same address.
A client can have multiple IA_NA options, and each IA_NA can have multiple addresses. A client can also have multiple IA_TA options and each can also have multiple addresses:
Identity association for non-temporary addresses (
IA_NA): An IA® that carries assigned addresses that are not temporary addressesIdentity association for temporary addresses (
IA_TA): An IA that carries temporary addresses (see RFC 3041).DUID: A DHCP-Unique identifier for a DHCP participant; each DHCP client and server has a unique DUID which remains the same across reboots.
The DHCP server assigns addresses based on keys. Four common keys are class, vendor, client ID, and inoption. The server uses these keys to allocate an address, and the set of configuration options to return to the client.
class The class key is completely client-configurable. It can specify an address and options. This key can be used to denote machine function in the network or to describe how machines are grouped for administrative purposes. For example, the network administrator might want to create a
NetBIOS class that contains options for NetBIOS clients or an accounting class that represents accounting department machines that need access to a specific printer.
vendor
The vendor key helps identify the client by its hardware and software platform.
client ID
The client ID keyidentifies the client through the DUID. The client ID is specified in the duid file of the dhcpcd daemon. Also, the client ID can be used by the server to pass options to a specific client or prohibit a particular client from receiving any parameters.
Inoption
The inoption key identifies the client by the option requested by the client.
These keys can be used either singularly or in combinations. If multiple keys are provided by the client and multiple addresses can be assigned, only one is chosen, and the option set is derived from the chosen key first.
A relay agent is needed so initial multicast from the client can leave the local network. The relay agents act as forwarding agents for DHCP packets.
DHCPv6 서버
DHCPv6 서버의 주요 구성 요소는 세 가지입니다.
DHCP 서버는 데이터베이스, 프로토콜 엔진, 서비스 스레드 묶음의 세 주요 구성 요소로 나뉩니다. 구성 요소마다 자기 구성 정보가 있습니다.
DHCPv6 데이터베이스
db_filev6.dhcpo 데이터베이스는 클라이언트와 주소를 추적하고 접근을 제어하는 데 씁니다.
옵션도 데이터베이스에 저장해 꺼내 클라이언트에 줍니다. 데이터베이스는 동적으로 적재할 수 있는 객체로 구현되어 있습니다.
구성 파일의 정보로 데이터베이스를 준비하고 일관성을 검증합니다. 데이터베이스에는 주소와 옵션 풀도 들어 있습니다.
주 저장 파일과 그 백업은 ASCII 파일입니다. 데이터베이스 주 저장 파일의 형식은 다음과 같습니다.
참고: 이 파일들을 손으로 고치지 마십시오.
DB6-1.0
Client-Info {
duid 1-0006085b68e20004ace491d3
state 7
authinfo {
protocol 2
algorithm 1
rdm 0
replay 1206567640
}
Interface 0 {
Inoptions {
interface-id "en1"
policies 2
maxopcode 16
numiana 1
Ianalist {
option 3 40 00000001000000320000005000050018deaddeadaaaaaaaa000000000000000600000064000000c8
}
numiata 0
Optiontable {
option 6 10 00030004001700180237
option 8 2 e659
option 15 14 000369626d000373756e00026870
option 16 18 000004d2000730783131313131000369626d
}
}
Ianarec {
IAID 1
t1 50
t2 80
Addrec {
Address dead:dead:aaaa:aaaa::6
state 3
starttime 1087592918
preferred-lifetime 100
valid-lifetime 200
}
}
}
}
첫 줄은 파일의 버전 식별자 DB6-1.0입니다. 그다음 줄들은 클라이언트 레코드 정의 줄입니다. 서버는 둘째 줄부터 파일 끝까지 읽습니다(따옴표 안의 매개변수는 따옴표로 감싸야 합니다).
| 필드 | 설명 |
|---|---|
| duid | 클라이언트가 서버에 자기를 나타내는 데 쓰는 ID |
| Interface | 클라이언트는 인터페이스를 여럿 가질 수 있습니다. 인터페이스가 하나뿐인 클라이언트가 IA_NA나 IA_TA마다 SOLICIT 메시지를 따로 만들면 파일에 이 클라이언트의 인터페이스가 여럿 들어갑니다. |
| Inoptions | 클라이언트에서 들어온 옵션 |
| policies | unicast, reconfig-option, rapid-commit을 나타내는 플래그 |
| maxopcode | 가장 큰 옵션 코드 |
| numiana | 이 인터페이스의 IA_NA 수 |
| Ianalist | 클라이언트에서 들어온 IA_NA 옵션 목록 |
| numiata | 이 인터페이스의 IA_TA 수 |
| Optiontable | IA_NA와 IA_TA 옵션을 뺀, 클라이언트가 요청한 옵션 목록 |
| Ianarec | 서버 데이터베이스에 저장한 IA_NA 레코드 컨테이너 |
| IAID | IA_NA의 ID |
| t1 | 이 IA_NA의 preferred-lifetime 백분율 |
| t2 | 이 IA_NA의 valid-lifetime 백분율 |
| Addrec | 서버 데이터베이스의 주소 레코드 컨테이너 |
| Address | 이 주소 레코드로 클라이언트에 준 주소 |
| state | 클라이언트의 현재 상태. 허용되는 상태 묶음은 DHCP 프로토콜 엔진에 있고, 상태는 DHCP 데이터베이스에서 유지합니다. state 옆의 숫자가 그 값입니다(아래 표). |
| Starttime | 이 주소를 나눠 준 시각(2000년 1월 1일부터 지난 초) |
| preferred-lifetime | 이 주소를 갱신해야 할 때까지의 초 |
| valid-lifetime | 이 주소가 무효가 되어 더 쓸 수 없게 될 때까지의 초 |
| protocol | (6.1) 클라이언트가 쓰는 인증 프로토콜. (1) DELAYED: 지연 인증을 씀. (2) RECONFIGURE KEY: 재구성 키 인증을 씀 |
| algorithm | (6.1) 클라이언트가 쓰는 인증 알고리즘. (1) HMAC-MD5: 키 있는 MD5 알고리즘으로 메시지 다이제스트를 만듦 |
| rdm | (6.1) 클라이언트가 쓰는 재전송(replay) 감지 방법. (0) 단조 증가 카운터: 단조 증가 카운터로 replay 값을 바꿈 |
| replay | (6.1) replay 필드의 현재 값 |
주소 상태
| 상태 | 설명 |
|---|---|
| (1) FREE | 쓸 수 있는 주소를 나타냅니다. 보통 클라이언트는 주소가 할당되지 않았을 때만 이 상태입니다. dadmin과 lssrc 명령은 이 상태를 Free로 보고합니다. |
| (2) BOUND | 클라이언트와 주소가 묶여 있고 클라이언트가 얼마 동안 이 주소를 할당받았음을 나타냅니다. dadmin과 lssrc 명령은 Leased로 보고합니다. |
| (3) EXPIRED | 클라이언트와 주소가 묶여 있지만, 해제한 주소처럼 정보용일 뿐입니다. 다만 expired 상태는 임대를 만료되게 둔 클라이언트를 나타냅니다. 만료된 주소는 쓸 수 있으며, 빈 주소가 모두 바닥난 뒤, 해제한 주소를 다시 주기 전에 다시 할당됩니다. dadmin과 lssrc 명령은 Expired로 보고합니다. |
| (4) RELEASED | 클라이언트와 주소가 정보용으로만 묶여 있음을 나타냅니다. DHCP 프로토콜은 DHCP 서버가 나중을 위해(주로 예전에 그 주소를 받은 클라이언트에 같은 주소를 다시 주려고) 자기가 서비스한 클라이언트 정보를 유지하라고 제안합니다. 이 상태는 클라이언트가 주소를 해제했음을 나타냅니다. 다른 주소가 없으면 다른 클라이언트가 이 주소를 쓸 수 있습니다. dadmin과 lssrc 명령은 Released로 보고합니다. |
| (5) RESERVED | 클라이언트와 주소가 느슨하게 묶여 있음을 나타냅니다. 클라이언트가 DHCP discover 메시지를 보내고 서버가 응답했지만, 클라이언트가 아직 그 주소에 대한 DHCP request로 응답하지 않았습니다. dadmin과 lssrc 명령은 Reserved로 보고합니다. |
| (6) BAD | DHCP 서버가 나눠 주지 않았는데 네트워크에서 쓰이는 주소를 나타냅니다. 클라이언트가 거부한 주소도 이 상태입니다. 클라이언트에는 해당하지 않습니다. dadmin 명령은 Used, lssrc 명령은 Bad로 보고합니다. |
체크포인트 파일의 구문은 정해져 있지 않습니다. 서버가 멈추거나, 종료해야 해서 데이터베이스를 정상적으로 닫지 못하면, 서버는 체크포인트와 백업 파일을 처리해 올바른 데이터베이스를 다시 만들 수 있습니다. 서버가 멈출 때 체크포인트 파일에 쓰이지 않은 클라이언트는 잃습니다. 지금은 클라이언트를 처리할 때 중간 저장을 하지 않습니다. 기본 파일은 다음과 같습니다.
| 파일 | 쓰임 |
|---|---|
/etc/dhcpv6/db_file6.cr |
일반 데이터베이스 동작 |
/etc/dhcpv6/db_file6.crbk |
데이터베이스 백업 |
DHCP 스레드 작업
DHCP 서버의 마지막 부분은 서버가 계속 돌아가게 하는 작업 묶음입니다.
DHCP 서버는 스레드로 동작하므로, 이 작업들은 가끔 일을 해서 모든 것이 맞게 돌아가게 하는 스레드로 설정되어 있습니다.
| 스레드 | 설명 |
|---|---|
| main 스레드 | 신호를 처리합니다. 예: SIGHUP(-1)은 구성 파일의 모든 데이터베이스를 새로 고칩니다. SIGTERM(-15)은 서버를 정상적으로 멈춥니다. SIGUSR1(-30)은 서버가 구성 데이터베이스를 덤프하게 합니다. |
| src 스레드 | SRC 요청(startsrc, stopsrc, lssrc, traceson, refresh 등)을 처리합니다. |
| dadmin 스레드 | dadmin 클라이언트 프로그램과 DHCP 서버 사이를 잇습니다. dadmin 도구로 상태를 얻고, 데이터베이스 파일을 손으로 편집하지 않고 데이터베이스를 고칠 수 있습니다. dadmin과 src 스레드가 더해져 서버는 서비스 요청을 처리하면서도 클라이언트 요청을 처리할 수 있습니다. |
| garbage 스레드 | 주기적으로 데이터베이스를 정리하고, 저장하고, 주소가 없는 클라이언트를 없애고, 너무 오래 예약 상태에 있는 예약 주소를 지우는 타이머를 실행합니다. 이 타이머들은 모두 구성할 수 있습니다. |
| 패킷 처리기 | 각각 DHCPv6 클라이언트의 요청 하나를 처리할 수 있습니다. 필요한 패킷 처리기 수는 부하와 기계에 따라 어느 정도 다릅니다. 수는 구성할 수 있으며 기본은 1, 최대 패킷 스레드 수는 50입니다. |
| 로깅 스레드 | 로그 파일에 많은 데이터를 기록하는 시스템에서는 로깅 스레드 수를 기본값(1)보다 늘려 최대(50)까지 쓸 수 있습니다. |
| table manager 스레드 | dhcpsdv6 데몬이 중복 패킷을 처리하지 않게 합니다. |
| process 스레드 | DHCPv6 클라이언트 패킷을 처리합니다. |
| reconfigure 스레드 | (6.1) 서버를 새로 고칠 때(예: dadmin -x 6 -i 명령) 클라이언트 재구성을 관리합니다. |
영어 원문
DHCPv6 server
There are three main components of the DHCPv6 server.
The DHCP server has been segmented into three main components: a database, a protocol engine, and a set of service threads. Each component has its own configuration information.
DHCPv6 database
The db_filev6.dhcpo database is used to track clients and addresses and for access control.
Options are also stored in the database for retrieval and delivery to clients. The database is implemented as a dynamically-loadable object.
Using the information in the configuration file, the database is primed and verified for consistency. The database also contains the address and option pools
The main storage file and its back up are ASCII files. The format for the database main storage files are as follows:
Note: Do not manually edit these files.
(41줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
The first line is a version identifier for the file: DB6-1.0. The lines that follow are client record definition lines. The server reads from the second line to the end of the file. (The parameters in quotes must be enclosed in quotes.)
duid The ID the client uses to represent itself to the server.
Interface
A client can have multiple interfaces. If a client has a single interface and creates individual SOLICIT messages for each IA_NA or IA_TA, the file will contain multiple interfaces for this client.
Inoptions
The incoming options from the client.
policies
Flag to identify unicast, reconfig-option, and rapid-commit.
maxopcode
The largest option code.
numiana
The number of IA_NAs for this interface.
Ianalist
The list of IA_NA options incoming from the client.
numiata
Number of IA_TAs for this interface.
Optiontable
The list of options requested by the client excluding the IA_NA and IA_TA options.
Ianarec
The saved IA_NA record container from the server database.
IAID The ID of the IA_NA.
t1 The preferred-lifetime percent for this IA_NA.
t2 The valid-lifetime percent for this IA_NA.
Addrec
The address record container from the server database.
Address
Address given to the client for this address record.
state The current state of the client. The DHCP protocol engine contains the allowable set, and the states are maintained in the DHCP database. The number next to state represents its value. The states can be:
(1) FREE
Represents addresses that are available for use. In general, clients do not have this state unless they have no address assigned. The dadmin and lssrc commands report this state as Free.
(2) BOUND
Indicates client and address are tied and that the client has been assigned this address for some amount of time. The dadmin and lssrc commands report this state as Leased.
(3) EXPIRED
Indicates the client and address are tied together, but only for informational purposes, in a similar manner to released addresses. The expired state, however, represents clients that let their leases expire. An expired address is available for use and is reassigned after all free addresses are unavailable and before released addresses are reassigned. The dadmin and lssrc commands report this state as Expired.
(4) RELEASED
Indicates the client and address are tied for informational purposes only. The DHCP protocol suggests that DHCP servers maintain information about the clients it has served for future reference (mainly to try giving the same address to that client that has been assigned that address in the past). This state indicates that the client has released the address. The address is available for use by other clients, if no other addresses are available. The dadmin and lssrc commands report this state as Released.
(5) RESERVED
Indicates client and address are tied, but loosely. The client has issued a DHCP discover message and the DHCP server has responded, but the client has not yet responded with a DHCP request for that address. The dadmin and lssrc commands report this state as Reserved.
(6) BAD
Represents an address that is in use in the network but has not been handed out by the DHCP server. This state also represents addresses that clients have rejected. This state does not apply to clients. The dadmin command reports this state as Used, and the lssrc command reports this state Bad.
Starttime
The time that this address was handed out, represented as seconds since January 1, 2000.
preferred-lifetime
Number in seconds before this address needs to be renewed.
valid-lifetime
Number in seconds before this address becomes invalid and can no longer be used.
protocol
The authentication protocol the client is using:
(1) DELAYED
The client is using delayed authentication.
(2) RECONFIGURE KEY
The client is using reconfigure key authentication.
algorithm
The authentication algorithm the client is using:
(1) HMAC-MD5
The client is using the keyed MD5 algorithm to create the message digest.
rdm The replay detection method the client is using:
(0) Monotonically increasing counter
The client is using a monotonically increasing counter to modify the replay value.
replay The current value of the replay field.
The syntax for the checkpoint files is not specified. If the server crashes or you have to shut down and cannot do a normal closing of the database, the server can process the checkpoint and backup files to reconstruct a valid database. Any client not written to the checkpoint file when the server crashes is lost. Currently, there are no intermittent saves when a client is processed. The default files are: /etc/dhcpv6/db_file6.cr Normal database operation /etc/dhcpv6/db_file6.crbk Backups for the database
DHCP threaded operations
The last piece of the DHCP server is actually a set of operations that are used to keep things running.
Because the DHCP server is threaded, these operations are actually set up as threads that occasionally do things to make sure everything is together.
main thread
This thread handles signals. For example,
A SIGHUP (-1) causes a refresh of all databases in the configuration file.
A SIGTERM (-15) will cause the server to gracefully stop.
A SIGUSR1 (-30) will cause the server to dump the configuration database
src thread
This thread handles the SRC requests (such as startsrc, stopsrc, lssrc, traceson, and refresh).
dadmin thread
This thread interfaces with the dadmin client program and the DHCP server. The dadmin tool can be used to get status as well as modify the database to avoid editing the database files manually. With the addition of the dadmin and src threads, the server can handle service requests and still handle client requests.
garbage thread
This thread runs timers that periodically clean the database, save the database, purge clients that do not have addresses, and remove reserved addresses that have been in reserve state for too long. All these timers are configurable.
packet processors
Each of these can handle a request from a DHCPv6 client. The number of packet processors required is somewhat load and machine-dependent. The number of these is configurable; the default is 1. The maximum number of packet threads is 50.
logging threads
In a system where significant amounts of data is being logged to log files, the number of logging threads can be increased more than the default (1) to max (50).
table manager thread
This thread ensures that the dhcpsdv6 daemon does not process duplicate packets.
process threads
These threads process the DHCPv6 client packets.
reconfigure thread
This thread manages client reconfiguration when the server is refreshed (with the dadmin -x 6 -i command, for example).