Configuring a DHCPv4 server on a VRF
Prerequisites
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).
Procedure
- 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
域名
. - 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
- 退出DHCPv4上下文wi服务器池th 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 VRFprimary-vrf.
Enables authoritative mode.
Defines the poolprimary-poolwith the following settings:
Address range:10.0.0.1to10.0.0.100.
Lease time: 12 hours.
Domain name:example.org.in.
Default routers:10.30.30.1and10.30.30.2.
DNS servers:125.0.0.1and125.0.0.2.
Static binding of10.0.0.11for MAC address24:be:05:24:75:73.
DHCP custom option3with IP address10.30.30.3.
Enables the DHCPv4 server.
switch(config)#dhcp-server vrf primaryswitch(config-dhcp-server)#pool primary-poolswitch(config-dhcp-server-pool)#range 10.0.0.1 10.0.0.100switch(config-dhcp-server-pool)#lease 12:00:00switch(config-dhcp-server-pool)#域名example.org.inswitch(config-dhcp-server-pool)#default-router ip 10.30.30.1 10.30.30.2switch(config-dhcp-server-pool)#dns-server 125.0.0.1 125.0.0.2switch(config-dhcp-server-pool)#static-bind ip 10.0.0.11 mac 24:be:05:24:75:73switch(config-dhcp-server-pool)#option 3 ip 10.30.30.3switch(config-dhcp-server-pool)#exitswitch(config-dhcp-server)#enable