You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Start flow of dhcprelayd](#start-flow-of-dhcprelayd)
41
+
-[Work flow of dhcprelayd capture db change](#work-flow-of-dhcprelayd-capture-db-change)
39
42
-[CLI](#cli)
40
43
-[Config CLI](#config-cli)
41
44
-[Show CLI](#show-cli)
@@ -48,6 +51,7 @@
48
51
49
52
<!-- /TOC -->
50
53
54
+
51
55
# Revision
52
56
53
57
| Rev | Date | Author | Change Description |
@@ -98,12 +102,12 @@ Configuration of DHCP server feature can be done via:
98
102
## Design Overview
99
103
We use kea-dhcp-server to reply DHCP request packet. kea-dhcp-server natively supports to assign IPs by mac or contents in DHCP packet (like client id or other options), but in our scenario kea-dhcp-server need to know which interface this packet come from. And SONiC has integrated dhcrelay, which can add interface information to option82 in packet when it relay DHCP packet. So we use it to add interface information.
In our design, dhcp_relay container works on host network mode as before. And dhcp_server container works on bridge network mode, means that it can communicate with switch network only via eth0.
104
106
105
107
For broadcast packet (discover, request) sent by client, obviously it would be routed to the related DHCP interface. For unicast packet (release), client will get server IP from Option 54 (server identifier) in DHCP reply packet receivced previously. But in our scenario, server identifier is the ip of `eth0` inside dhcp_server container (240.127.1.2), packet with this destination IP cannot be routed successfully. So we need to specify that kea-dhcp-server replies DHCP request with Option 54 filled with IP of DHCP interface (which is the downstream interface IP of dhcrelay), to let client take relay as server and send unicast packet to relay, and relay would transfer this packet to the real server.
Belows are sample configurations for dhcrelay and kea-dhcp-server:
108
112
109
113
- dhcprelay:
@@ -134,9 +138,15 @@ Belows are sample configurations for dhcrelay and kea-dhcp-server:
134
138
"pools": [
135
139
{
136
140
// Assign ip from this pool for packet tagged as "hostname-etp1"
137
-
"pool": "192.168.0.1 - 192.168.0.1",
141
+
"pool": "192.168.0.2 - 192.168.0.2",
138
142
"client-class": "hostname-etp1"
139
143
}
144
+
],
145
+
"option-data": [
146
+
{
147
+
"name": "dhcp-server-identifier",
148
+
"data": "192.168.0.1"
149
+
}
140
150
]
141
151
}
142
152
]
@@ -166,7 +176,7 @@ A new container dhcp_server based on debian:bookworm, is created to hold DHCP Se
166
176
## DHCP Server Daemon
167
177
### Generate Config
168
178
169
-
dhcpservd is to generate configuration file for kea-dhcp-server while DHCP Server config in CONFIG_DB changed, and then send SIGHUP signal to kea-dhcp-server process to let new config take affect.
179
+
dhcpservd is to generate configuration file for kea-dhcp-server while DHCP Server config in CONFIG_DB changed, and then send SIGHUP signal to kea-dhcp-server process to let new config take effect.
We can customize DHCP Packet options per DHCP interface by kea-dhcp-server.
196
-
197
-
We can set customized options for each DHCP interface, all DHCP clients connected to this interface share one configuration, and DHCP server would add DHCP options by config to each DHCP packet sent to client.
219
+
We can customize DHCP Packet options per DHCP interface by kea-dhcp-server, all DHCP clients connected to this interface share one configuration, and DHCP server would add DHCP options by config to each DHCP packet sent to client.
198
220
```JSON
199
221
{
200
222
"Dhcp4": {
@@ -223,10 +245,15 @@ Have to be aware of is that below options are not supported to customize, becaus
223
245
224
246
Currently support text, ipv4-address, uint8, uint16, uint32.
225
247
248
+
## DHCP Relay Daemon
249
+
For scenario of dhcp_server feature is enabled, we need a daemon process inside dhcp_relay container to manage dhcrelay processes. dhcprelayd would subcribe VLAN/VLAN_MEMBER/DHCP_SERVER_IPV4* table in config_db, and when dhcp_relay container restart or related config changed, dhcprelayd will kill/start/restart dhcrelay process.
-Configuration tables for the DHCP server entries.
229
-
-State tables for the DHCP server lease entries.
254
+
We have two main DB changes:
255
+
-CONFIG_DB change.
256
+
-STATE_DB change.
230
257
231
258
### Config DB
232
259
Following table changes would be added in Config DB, including **DHCP_SERVER_IPV4** table, **DHCP_SERVER_IPV4_RANGE** table, **DHCP_SERVER_IPV4_PORT** table and **DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS** table.
@@ -236,6 +263,56 @@ These new tables are introduced to specify configuration of DHCP Server.
0 commit comments