DHCP policies

نستطيع تعيين خيارات الـDHCP اللي هي الـoptions باستخدام سياسات معينة مثل الـMACاو فيئة المستخدم user class أو فيئة البائع vendor class أو بعوامل أخرى ايضا . وفي مايلي جميع العوامل

Vendor Class
User Class
MAC Address
Client Identifier
Fully Qualified Domain Name
Relay Agent Information

لذلك مسؤول الشبكة يستطيع التحكم بتجميع الأجهزة بناءا على عوامل مختلفة لتطبيق الـDHCP عليها ولنذكر بعض السيناريوهات المهمة:-

1-Multiple device types: عندما يكون لديك في الشبكة اجهزة مختلفة مثلا طابعات كمبيوترات وغيرها تستطيع عمل policy لكل فئة مثلا عمل سياسة للطابعات على أن تاخذ الطابعات عناوين من مجال معين وهكذا لباقي المتغيرات التي يتم توزيعها عن طريق الـDHCP
2-Multiple roles: يمكن لمسؤول الشبكة عمل قواعد معينة على حسب نوع الجهاز مثلا اﻷجهزة المتصلة عن طريق الوايرلس تاخذ عناوين من مجال محدد وتعيين لها مدة زمنية محدد للـ lease duration وبالطبع يمكن للمشؤول تعطيل تحديث سجلات هذه اﻷجهزة في سيرفر DNS وكذلك يمكنه عمل قاعدة جديدة خاصة بالسيرفرات حسب عنوان الـMAC للسيرفرات بحيث تاخذ عناوين من مجال محدد وكذلك تعيين lease duratiuon بحيث يكون 12 يوم أو اكثر وهكذا
3- Virtualization: في بيئية العمل اﻷفتراضية يكون اﻷجهزة VM لها عناوين MAC وبناءا عليها يمكن تحديد المجال للعناوين التي ستاخذ منه وكذلك تحدبد العبارة الأفتراضية لها.

ملاحظة :-
و
عند إنشاء السياسة هناك مستويين للـDHCP policies وهما:-
1- server-level policies
وتطبق على جميع الـscopes

2- scope-level policies
وتطبق على الـscope المحدد فقط

ملاحظة:-
إذا تم تعيين policy على كلا من المستويين اللي هما server-level و scope-level يتم تطبيق السياسات الموجودة في الـscope-level أولا .

عند إنشاء policy هناك بعض المعلومات التي يجب أن تعرفها:-
1- إنشاء أسم للـpolicy ويفضل أن يدل اﻷسم على عملها.
2- الشروط المطبقة على الـpolicy مثل يساوي أو لايساوي وعند وجود أكثر من شرط يمكن تطبيقهم جميعا باخيتار AND أو تطبيق أحدهم بأختيار OR كما هو موضح في الصورة التالية :-

والشروط غالبا تكون ضمن :-

Vendor Class
User Class
MAC Address
Client Identifier
Fully Qualified Domain Name
Relay Agent Information

3- يمكنك أختيار وتحديد مجال العناوين IP Addresses range وهذا في حالة scope-level policies فقط
4- يمكنك أختيار وتحديد الخيارات options وهذا في حالة scope-level policies فقط, الخيارات مثل

003 Router
006 DNS Server
015 DNS Domain Name.

ماهي اﻷشياء التي يمكنك تعديلها على الـpolicy بعد إنشائها

يمكنك عمل التالي:-
1-يمكنك تعديل مدة الـpolicy أو مايسمى الـduration وذلك من General TAB
2-يمكنك إعادة إعدادات الـشروط وذلك من condition TAB
3-يمكنك أختيار وتحديد مجال العناوين IP Addresses range وهذا في حالة scope-level policies فقط
4- يمكنك التعديل على الـoptions وذلك من options TAB
5- يمكنك التعديل على الـDNS وذلك من خلال التبويب DNS

ويتم تطبيق هذه السياسات أما عن طريق الـDHCP console Windows PowerShellأو باستخدام الـ

حيث أن الأمر المستخدم في الـWindows PowerShell هو :-

Add-DhcpServerv4Policy

سيناريو تطبيق الـpolicy

تم تنزيل خدمة الـDHCP والـDNS والـDHCP على السيرفر الذي عنوانه 10.20.10.100/24
ولمعرفة كيف تم ذلك أنقر هنا

سنقوم اﻵن بإنشاء DHCP scope على السيرفر باتباع الخطوات التالية:-

  1. On the Server Manager menu bar, click Tools and then click DHCP. The DHCP console opens.
  2. In the DHCP console tree, navigate to IPv4. Right-click IPv4 and then click New Scope. The New Scope Wizard opens.
  3. Click Next and then type a name for the new scope next to Name (ex: mcsa-scope1).
  4. Click Next and then in IP Address Range, type 10.20.10.1 next to Start IP address, type 10.20.10.254 next to End IP address, and type 24 next to Length. The value of Subnet mask will change automatically to 255.255.255.0.
  5. Click Next, and then in Add Exclusions and Delay type 10.20.10.1 under Start IP address, type 10.20.10.100 under End IP address, and then click Add. This allows the first hundred IP addresses in the 10.20.10.0/24 subnet to be used for static addressing of servers on the network.
    150
  6. Click Next and then in Lease Duration under Limited to enter 0 Days, 0 Hours, and 2 Minutes. This very short lease duration will simplify the DHCP demonstration.
  7. Click Next three times, and then in Domain Name and DNS Servers, verify that the Parent domain is mcsa.com and 10.20.10.100 is listed as the only DNS server.


  8. Click Next twice, and then in Activate Scope select Yes, I want to activate this scope now.
    تستطيع أن تضع العبارة الأفتراضية 10.20.10.1
    150

  1. Click Next, and then click Finish.
  1. In the DHCP console tree, right-click SRV2016.mcsa.com, and then click Authorize.
  2. Refresh the view in the DHCP console and verify that DHCP1 is authorized and that the mcsa-scope1 is active.

وللتأكد من اﻹعدادات نفذ الأمر get-dhcpserverv4scope في الـpowershell

إنشاء السياسات Create policies

To create policies

هام:- تأكد من تحديد مجلد السياسة ضمن مجلد scope. هذا هو المجلد على scope-level. المجلد “السياسات” الآخر مخصص للسياسات على server-level وإذا قمت بإنشاء سياسة في server-level فلن تتمكن من إنشاء سياسة نطاق عناوين IP لهذا التمرين.

يجب معرفة العنوان الفيزائي MAC Address ويمكن أستخراجه من سيرفر الـDHCP كما يلي:-

  1. In the DHCP console, under Scope, right-click Policies and then click New Policy.

  2. Next to Policy Name, type Client01 Policy, and then click Next.
  1. On the Configure Conditions for the policy page, click Add.

  2. In the Add/Edit Condition dialog box, choose MAC Address next to Criteria, type the MAC address for Client01 next to Value (0800273255C3 in this example), and then click Add, then click OK.

  3. Click Next, and then in Configure settings for the policy, type 10.20.10.200 next to Start IP address and type 10.20.10.250 next to End IP address.

  4. Click Next, and then under Available Options, select 003 Router, type 10.20.10.1 under IP address, and click Add.
    0800273255C3
  5. Click Next, and then click Finish.
  6. Repeat the previous steps for Client02 using the following conditions, IP address ranges, and options:
    1. Policy Name: Client02 Policy
    2. Condition: MAC Address equals (in this example) 0800273E29913.
    3. Start IP address: 10.20.10.251
    4. End IP address: 10.20.10.254
    5. 003 Router: 10.20.10.2