In this blog post we will look at the workflow how to configure gateway DHCP server in NSX-T as a service. This DHCP service will run as service router in the edge node and can be configured on Tier-0 or Tier-1 gateways.
This gateway DHCP server option is global dhcp server for all the segments attached to this Tier-0 or Tier-1 gateway. In my demonstration, I am using Tier-1 gateway and two segments “GlobalDHCP-ls” and GlobalDHCP2-ls”
So, we are going to configure T1 gateway as DHCP service and IP allocation will take place to both the segments which are configured as DHCP segments.
Navigate to Networking > IP Management > DHCP. Click on Add DHCP Profile, select the profile type as DHCP Server, Set Service IP address and Assign edge cluster to it where DHCP service will run as Service Router.
Now, Go to tier1 gateway, I have expanded my prod-t1-gw a.) Select the same edge cluster which was assigned in DHCP Profile Wizard b.) Set DHCP configuration, select type as DHCP server, select profile and click on save.
I have already created my two segments “GlobalDHCP-ls” : 172.16.5.0/24 and GlobalDHCP2-ls” : 172.16.6.0/24 which are going to be configured as DHCP Clients.
Now, Edit segment GlobalDHCP-ls and click on set DHCP config option, select DHCP type as gateway DHCP server. There are three DHCP type options 1.) Local DHCP Server 2.) DHCP Relay 3.) Gateway DHCP server. As I have configured Gateway DHCP server, I am choosing this option.
In this step, Toggle DHCP Config option to enable and set the DHCP IP range (172.16.5.2-172.16.5.10) for the segment, you can also set DNS and lease values. Click on Save and close editing.
Edit segment GlobalDHCP2-ls and click on set DHCP config option and configure the range 172.16.6.2-172.16.6.10
Now, at this point, DHCP Profile, T1-GW and two segments are configured as per DHCP configuration.
Now, I am going to attach two VMs to these segments.
dhcptest is connected to GlobalDHCP-ls (172.16.5.0/24)
dhcptest2 is connected to Global2DHCP-ls (172.16.6.0/24)
Now here is the test, When I power on these VMs, they should get DHCP IP address from DHCP service configured on T1-GW. As per below screenshots, we can see that VM dhcptest has got 172.16.5.2 and VM dhcptest2 has got 172.16.6.2 from their respective dhcp configured ranges.
Now, look at the some useful commands to check from edges.
edge-1> get dhcp servers Wed Jan 20 2021 UTC 12:16:09.062 EDGE_CLUSTER_ID: 63a5a9d4-5afa-4ece-a133-53899b24eef1 EDGE_NODE_ID: b82a93b3-a529-468f-b621-59d0bd2b563f 548f7860-9064-4db3-bd1c-5b0910a6801f ID: d2b9a229-b235-47d7-85c2-14693e5316b1 IPV6_SERVER_PREFIX: IPV6: fe80::50:56ff:fe98:7dd7 PREFIX_LENGTH: 128 MSG_TIMESTAMP: 2021-01-20 12:02:28.879000 (timestamp: 1611144148879) OPTIONS: GENERIC_OPTION: CODE: 54 (Server identifier) VALUE: 192.168.20.10 CODE: 3 (Router) VALUE: 192.168.20.1 CODE: 1 (Subnet Mask) VALUE: 255.255.255.0 POOL_MONITORING_ENABLED: False SERVER_MAC: MAC: 00:50:56:98:7d:d7 SERVER_PREFIX: IPV4: 192.168.20.10 PREFIX_LENGTH: 24
edge-1> get dhcp servers status Wed Jan 20 2021 UTC 12:16:55.181 DHCP_ID: d2b9a229-b235-47d7-85c2-14693e5316b1 STATUS: READY
edge-1> get dhcp leases Wed Jan 20 2021 UTC 12:17:07.213 DHCP_ID: d2b9a229-b235-47d7-85c2-14693e5316b1 DHCP_SUBNET_MAC: d2b9a229-b235-47d7-85c2-14693e5316b1_172.16.5.2_00:50:56:88:63:c9 EXPIRE_TIME: 2021-01-21 12:13:12.044000 (timestamp: 1611231192044) IP: IPV4: 172.16.5.2 LEASE_TIME: 86400 MAC: MAC: 00:50:56:88:63:c9 START_TIME: 2021-01-20 12:13:12.044000 (timestamp: 1611144792044) SUBNET: 172.16.5.0 DHCP_ID: d2b9a229-b235-47d7-85c2-14693e5316b1 DHCP_SUBNET_MAC: d2b9a229-b235-47d7-85c2-14693e5316b1_172.16.6.2_00:50:56:88:4f:83 EXPIRE_TIME: 2021-01-21 12:08:08.298000 (timestamp: 1611230888298) IP: IPV4: 172.16.6.2 LEASE_TIME: 86400 MAC: MAC: 00:50:56:88:4f:83 START_TIME: 2021-01-20 12:08:08.298000 (timestamp: 1611144488298) SUBNET: 172.16.6.0
edge-1> get logical-router <<<<<< T1 SR is created for DHCP service Wed Jan 20 2021 UTC 12:18:46.405 Logical Router UUID VRF LR-ID Name Type Ports Neighbors b40de280-1c60-463a-8eb5-199c2ac6a706 14 1042 SR-prod-t1-gw SERVICE_ROUTER_TIER1 5 2/50000 <Truncated output>
edge-1(tier1_sr)> get forwarding <<<<DHCP Server routes have been added in T1-GW Wed Jan 20 2021 UTC 12:19:05.662 192.168.20.0/24 route 35cee197-7ad2-40e6-8c94-3db9606d6409 192.168.20.1/32 route be72a7ca-3cc9-5458-afe8-318d185336c7 <Truncated output>
I hope this blog post has been informative to you. Next, we are going to discuss DHCP relay configuration and lab tests.
Thank you and happy learning!