Posted in : Windows Server Av Petter Vikström Översätt med Google ⟶

6 years ago

In some cases you will come across DHCP-scopes that are configured on the edge-device or similar and wanting to move it to your dedicated Windows Server instead.
Below is an example where you can export DHCP-leases from your Palo Alto Networks device and add them to your dedicated Windows Server.
In this example I will be using Putty.
Step 1.
Start Putty and connect to your Palo Alto Networks firewall. Then go to the Putty Reconfiguration page, Session > Logging and select ”All Session output”.
Choose your filename and where to save it. Select Apply.

Step 2.
Log in to your Palo Alto Networks firewall and issue one of the below commands. Choose the second one if you need to specify an interface. For example if you have several DHCP-scopes configured on your firewall.

>show dhcp server lease all
>show dhcp server lease ethernetx/x.x

Close your session when the output has been printed.
Step 3.
Inactivate the DHCP-scope on your Palo Alto Netoworks firewall so there are no new leases being added.
Step 4.
Open the file where the output has been pasted and remove any unnecessary information.
Import the values to Excel and it should look something like this: (We are only importing IP, MAC and Hostname in this example)

Step 5.
Now we need to add the information to the command that we will be using in Powershell on the new DHCP-server.

Add-DhcpServerv4Lease -IPAddress <IP-Adress>  -ScopeId <ScopeID> -ClientId <MAC-Adress> -Hostname <HostName>

Go to a new column on the same sheet and add the below:

="Add-DhcpServerv4Lease -IPAddress "&A2&" -ScopeId -ClientId "&B2&" -Hostname "&C2

This will get the information for the IP on column A and row 2, MAC-adress on column B and row 2 and the Hostname on column C and row 2.
Go the new cell and hover to the right corner. Drag down to fill in the rest of the rows.

Step 6.
If you have not already created the new DHCP-scope this is the time to do it.
Step 7.
Start Powershell on your DHCP-server and paste the below commands.

Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-01 -Hostname Example1
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-02 -Hostname Example2
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-03 -Hostname Example3
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-04 -Hostname Example4
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-05 -Hostname Example5
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-06 -Hostname Example6
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-07 -Hostname Example7
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-08 -Hostname Example8
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-09 -Hostname Example9
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-10 -Hostname Example10
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-11 -Hostname Example11
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-12 -Hostname Example12
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-13 -Hostname Example13
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-14 -Hostname Example14
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-15 -Hostname Example15
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-16 -Hostname Example16
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-17 -Hostname Example17
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-18 -Hostname Example18
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-19 -Hostname Example19
Add-DhcpServerv4Lease -IPAddress -ScopeId -ClientId 00-00-00-00-00-20 -Hostname Example20

Step 8.
Activate the new scope and remember to configure DHCP-relay on your Palo Alto Networks firewall if needed.

Tags : DHCP, DHCP-lease, Palo Alto, Windows Server

Personlig rådgivning

Vi erbjuder personlig rådgivning med författaren för 1400 SEK per timme. Anmäl ditt intresse i här så återkommer vi så snart vi kan.

Add comment

Your comment will be revised by the site if needed.