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
# Deploy a DHCP server in Azure on a virtual machine
17
17
18
-
Learn how to deploy a highly available DHCP server in Azure on a virtual machine. This server is used as a target for an on-premises DHCP relay agent to provide dynamic IP address allocation to on-premises clients. Broadcast packets directly from clients to a DHCP Server don't work in an Azure Virtual Network by design.
18
+
Learn how to deploy a highly available DHCP server in Azure on a virtual machine. This server is used as a target for an on-premises DHCP relay agent to provide dynamic IP address allocation to on-premises clients. The DHCP relay agent forwards unicast DHCP requests from on-premises clients to the DHCP servers running in Azure. Direct broadcast packets from clients to a DHCP server don't work in an Azure Virtual Network by design.
19
19
20
20
> [!NOTE]
21
21
> The on-premises client to DHCP Server (source port UDP/68, destination port UDP/67) is still not supported in Azure, since this traffic is intercepted and handled differently. This will result in timeout messages at the time of DHCP RENEW at T1 when the client directly attempts to reach the DHCP Server in Azure. The DHCP RENEW will succeed when the DHCP RENEW attempt is made at T2 via DHCP Relay Agent. For more details on the T1 and T2 DHCP RENEW timers, see [RFC 2131](https://www.ietf.org/rfc/rfc2131.txt).
@@ -26,125 +26,61 @@ Learn how to deploy a highly available DHCP server in Azure on a virtual machine
In this section, you create an internal load balancer that load balances virtual machines. An internal load balancer is used to load balance traffic inside a virtual network with a private IP address.
32
-
33
-
During the creation of the load balancer, you configure:
34
-
35
-
* Frontend IP address
36
-
* Backend pool
37
-
* Inbound load-balancing rules
38
-
39
-
1. In the search box at the top of the portal, enter **Load balancer**. Select **Load balancers** in the search results.
40
-
41
-
1. In the **Load balancer** page, select **Create**.
42
-
43
-
1. In the **Basics** tab of the **Create load balancer** page, enter, or select the following information:
44
-
45
-
| Setting | Value |
46
-
| --- | --- |
47
-
|**Project details**||
48
-
| Subscription | Select your subscription. |
49
-
| Resource group | Select **test-rg**. |
50
-
|**Instance details**||
51
-
| Name | Enter **load-balancer**|
52
-
| Region | Select **(US) East US 2**. |
53
-
| SKU | Leave the default **Standard**. |
54
-
| Type | Select **Internal**. |
55
-
| Tier | Leave the default **Regional**. |
56
-
57
-
1. Select **Next: Frontend IP configuration** at the bottom of the page.
58
-
59
-
1. In **Frontend IP configuration**, select **+ Add a frontend IP configuration**.
60
-
61
-
1. Enter **frontend-1** in **Name**.
62
-
63
-
1. Select **subnet-1 (10.0.0.0/24)** in **Subnet**.
64
-
65
-
1. In **Assignment**, select **Static**.
66
-
67
-
1. In **IP address**, enter **10.0.0.100**.
68
-
69
-
1. Select **Add**.
70
-
71
-
1. Select **Next: Backend pools** at the bottom of the page.
72
-
73
-
1. In the **Backend pools** tab, select **+ Add a backend pool**.
74
-
75
-
1. Enter **backend-pool** for **Name** in **Add backend pool**.
76
-
77
-
1. Select **NIC** or **IP Address** for **Backend Pool Configuration**.
78
-
79
-
1. Select **Save**.
80
-
81
-
1. Select the blue **Review + create** button at the bottom of the page.
82
-
83
-
1. Select **Create**.
84
-
85
-
## Configure second load balancer frontend
86
-
87
-
A second frontend is required for the load balancer to provide high availability for the DHCP server. Use the following steps to add a second frontend to the load balancer.
88
-
89
-
1. In the Azure portal, search for and select **Load balancers**.
90
-
91
-
1. Select **load-balancer**.
92
-
93
-
1. In **Settings**, select **Frontend IP configuration**.
94
-
95
-
1. Select **+ Add**.
96
-
97
-
1. Enter or select the following information in **Add frontend IP configuration**:
1. Verify that in **Frontend IP configuration**, you have **frontend-1** and **frontend-2**.
110
-
111
-
## Create load balancer rules
112
-
113
-
The load balancer rules are used to distribute traffic to the virtual machines. Use the following steps to create the load balancer rules.
114
-
115
-
1. In the Azure portal, search for and select **Load balancers**.
116
-
117
-
1. Select **load-balancer**.
118
-
119
-
1. In **Settings**, select **Load balancing rules**.
120
-
121
-
1. Select **+ Add**.
122
-
123
-
1. Enter or select the following information in **Add load balancing rule**:
124
-
125
-
| Setting | Value |
126
-
| --- | --- |
127
-
|**Name**| Enter **lb-rule-1**. |
128
-
|**IP version**| Select **IPv4**. |
129
-
|**Frontend IP address**| Select **frontend-1**. |
130
-
|**Backend pool**| Select **backend-pool**. |
131
-
|**Protocol**| Select **UDP**. |
132
-
|**Port**| Enter **67**. |
133
-
|**Backend port**| Enter **67**. |
134
-
|**Health probe**| Select **Create new**. </br> Enter **dhcp-health-probe** for **Name**. </br> Select **TCP** for **Protocol**. </br> Enter **3389** for **Port**. </br> Enter **67** for **Interval**. </br> Enter **5** for **Unhealthy threshold**. </br> Select **Save**. |
135
-
|**Enable Floating IP**| Select the box. |
136
-
137
-
1. Select **Save**.
138
-
139
-
1. Repeat the previous steps to create the second load balancing rule. Replace the following values with the values for the second frontend:
140
-
141
-
| Setting | Value |
142
-
| --- | --- |
143
-
|**Name**| Enter **lb-rule-2**. |
144
-
|**Frontend IP address**| Select **frontend-2**. |
In this section, you create two VMs (**vm-1** and **vm-2**) in two different availability zones (**Zone 1** and **Zone 2**) to provide high availability for your DHCP service.
32
+
33
+
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
34
+
35
+
1. Select **+ Create** then **Azure virtual machine**.
36
+
37
+
1. In **Create a virtual machine**, type or select the values in the **Basics** tab:
| VM architecture | Leave the default of **x64**. |
52
+
| Size | Select a size. |
53
+
|**Administrator account**||
54
+
| Authentication type | Select **Password**. |
55
+
| Username | Enter **azureuser**. |
56
+
| Password | Enter a password. |
57
+
| Confirm password | Reenter the password. |
58
+
|**Inbound port rules**||
59
+
| Public inbound ports | Select **None**. |
60
+
61
+
1. Select the **Networking** tab, or select **Next: Disks**, then **Next: Networking**.
62
+
63
+
1. In the Networking tab, enter or select the following information:
64
+
65
+
| Setting | Value |
66
+
|-|-|
67
+
|**Network interface**||
68
+
| Virtual network | Select **vnet-1**. |
69
+
| Subnet | Select **subnet-1 (10.0.0.0/24)**. |
70
+
| Public IP | Select **None**. |
71
+
| NIC network security group | Select **Basic**. |
72
+
| Public inbound ports | Leave the default of **None**. |
73
+
74
+
1. Select **Review + create**.
75
+
76
+
1. Review the settings, and then select **Create**.
77
+
78
+
1. Follow the previous steps to create a second VM with the following values and all the other settings the same as **vm-1**:
79
+
80
+
| Setting | VM 2 |
81
+
| ------- | ----- |
82
+
| Name |**vm-2**|
83
+
| Availability zone |**Zone 2**|
148
84
149
85
## Configure DHCP server network adapters
150
86
@@ -219,6 +155,34 @@ Use the following steps to set a static IP address for the Microsoft Loopback Ad
219
155
220
156
1. Select **Close**.
221
157
158
+
### Add loopback IP address as secondary IP configuration in Azure
159
+
160
+
After configuring the loopback adapter IP address on the virtual machine, you must add the same IP address as a secondary IP configuration on the Azure VM's network interface. This critical step ensures that Azure can route unicast DHCP requests to the DHCP server.
161
+
162
+
1. In the Azure portal, search for and select **Virtual machines**.
163
+
164
+
1. Select **vm-1**.
165
+
166
+
1. In the **vm-1** page, select **Networking** then **Network settings**.
167
+
168
+
1. Select the network interface name next to **Network interface**. The network interface name is similar to **vm-1123**.
169
+
170
+
1. In the network interface page, select **IP configurations** in **Settings**.
171
+
172
+
1. Select **+ Add**.
173
+
174
+
1. Enter or select the following information in **Add IP configuration**:
175
+
176
+
| Setting | Value |
177
+
| --- | --- |
178
+
| **Name** | Enter **ipconfig2**. |
179
+
| **Allocation** | Select **Static**. |
180
+
| **IP address** | Enter **10.0.0.100**. |
181
+
182
+
1. Select **OK**.
183
+
184
+
1. Verify that in **IP configurations**, you have **ipconfig1** and **ipconfig2** listed.
185
+
222
186
### Enable routing between the loopback interface and the network adapter
223
187
224
188
Use the following steps to enable routing between the loopback interface and the network adapter:
@@ -262,8 +226,45 @@ Use the following steps to enable routing between the loopback interface and the
262
226
263
227
1. Close the bastion connection to **vm-1**.
264
228
265
-
1. Repeat the previous steps to configure **vm-2**. Replace the IP address of **10.0.0.100** with **10.0.0.200** in the static IP address configuration of the loopback adapter.
229
+
1. Repeat the previous steps to configure **vm-2**. Replace the IP address of **10.0.0.100** with **10.0.0.200** in both the static IP address configuration of the loopback adapter and the secondary IP configuration in the Azure portal.
230
+
231
+
### Verify DHCP server binding
232
+
233
+
After completing the configuration, verify that the DHCP server is correctly bound to the loopback adapter IP address.
234
+
235
+
1. Connect to **vm-1** via Azure Bastion.
236
+
237
+
1. Open **PowerShell** as an administrator.
238
+
239
+
1. Run the following command to verify the DHCP server is listening on the loopback IP address:
240
+
241
+
```powershell
242
+
netstat -an | Select-String "67"
243
+
```
244
+
245
+
You should see output showing UDP port 67 bound to **10.0.0.100**:
246
+
247
+
```output
248
+
UDP 10.0.0.100:67 *:*
249
+
```
250
+
251
+
1. Alternatively, open the **DHCP** management console and verify that the loopback adapter is listed and bound to the IP address **10.0.0.100** in the DHCP console.
252
+
253
+
1. Close the bastion connection to **vm-1**.
254
+
255
+
## Configure DHCP relay agent
256
+
257
+
Configure your on-premises DHCP relay agent to forward DHCP requests to the loopback IP addresses of the DHCP servers in Azure. For high availability, configure the relay agent with both server addresses:
258
+
259
+
- **10.0.0.100** (vm-1)
260
+
- **10.0.0.200** (vm-2)
261
+
262
+
DHCP relay agents natively support specifying multiple DHCP servers in their configuration, providing failover and redundancy without requiring additional load-balancing components.
263
+
264
+
Consult your DHCP relay agent manufacturer's documentation for specific configuration steps.
266
265
267
266
## Next step
268
267
269
-
In this article, you learned how to deploy a highly available DHCP server in Azure on a virtual machine. You also learned how to configure the network adapters and installed the DHCP role on the virtual machines. Further configuration of the DHCP server is required to provide DHCP services to on-premises clients from the Azure Virtual Machines. The DHCP relay agent on the on-premises network must be configured to forward DHCP requests to the DHCP servers in Azure. Consult the manufacturer's documentation for the DHCP relay agent for configuration steps.
268
+
In this article, you learned how to deploy a highly available DHCP server in Azure on a virtual machine. You configured the network adapters with loopback adapters and added the loopback IP addresses as secondary IP configurations in Azure to ensure proper routing. You also installed the DHCP role on the virtual machines.
269
+
270
+
Further configuration of the DHCP server is required to provide DHCP services to on-premises clients from the Azure Virtual Machines. The DHCP relay agent on the on-premises network must be configured to forward DHCP requests to the loopback IP addresses (10.0.0.100 and 10.0.0.200) of the DHCP servers in Azure. Consult the manufacturer's documentation for the DHCP relay agent for configuration steps.
0 commit comments