Configuring a DHCPv4 server on a VRF
An enabled layer 3 interface.
A VRF.
An external TFTP server to host BOOTP image files (optional).
An external storage device installed and configured (optional).
-
Assign the DHCPv4 server to a VRF with the command
dhcp-server vrf
. This switches to the DHCPv4 server configuration context. -
If you want the DHCPv4 server to be the sole authority for IP addresses on the VRF, enable authoritative mode with the command
.authoritative
-
Define an address pool for the VRF with the command
pool
. This switches to the DHCPv4 server pool context. Customize pool settings as follows:- Define the range of addresses in the pool with the command
range
. - Set the lease time for addresses in the pool with the command
lease
. - Set the domain name for the pool with the command
domain-name
. - Define up to four default routers with the command
default-router
. - Define up to four DNS servers with the command
dns-server
. - Create static bindings for specific addresses in the pool with the command
static-bind
. - Configure custom DHCPv4 options for the pool with the command
option
. - Configure NetBIOS support with the commands
netbios-name-server
andnetbios-node-type
. - Configure BOOTP options with the command
.bootp
- Exit the DHCPv4 server pool context with the command
exit
.
- Define the range of addresses in the pool with the command
-
Enable the DHCP server on the VRF with the command
enable
. -
Configure support for persistent external storage of DHCP settings with the command
dhcp-server external-storage
. -
View DHCPv4 server configuration settings with the command
show dhcp-server all-vrfs
.
Example
This example creates the following configuration:
- Configures the DHCPv4 server on VRF primary-vrf.
Enables authoritative mode.
Defines the pool primary-pool with the following settings:
Address range: 10.0.0.1 to 10.0.0.100.
Lease time: 12 hours.
Domain name: example.org.in.
Default routers: 10.30.30.1 and 10.30.30.2.
DNS servers: 125.0.0.1 and 125.0.0.2.
Static binding of 10.0.0.11 for MAC address 24:be:05:24:75:73.
DHCP custom option 3 with IP address 10.30.30.3.
Enables the DHCPv4 server.
switch(config)# dhcp-server vrf primary switch(config-dhcp-server)# pool primary-pool switch(config-dhcp-server-pool)# range 10.0.0.1 10.0.0.100 switch(config-dhcp-server-pool)# lease 12:00:00 switch(config-dhcp-server-pool)# domain-name example.org.in switch(config-dhcp-server-pool)# default-router ip 10.30.30.1 10.30.30.2 switch(config-dhcp-server-pool)# dns-server 125.0.0.1 125.0.0.2 switch(config-dhcp-server-pool)# static-bind ip 10.0.0.11 mac 24:be:05:24:75:73 switch(config-dhcp-server-pool)# option 3 ip 10.30.30.3 switch(config-dhcp-server-pool)# exit switch(config-dhcp-server)# enable