Skip to main content

DHCP Interface

DHCP interfaces configure DHCP server or relay functionality on network interfaces. The scm CLI provides commands to create, update, delete, and load DHCP interfaces.

Overview​

The dhcp-interface commands allow you to:

  • Create DHCP interfaces with server or relay configurations
  • Update existing DHCP interface settings
  • Delete DHCP interfaces that are no longer needed
  • Bulk import DHCP interfaces from YAML files
  • Export DHCP interfaces for backup or migration

Set DHCP Interface​

Create or update a DHCP interface.

Syntax​

scm set network dhcp-interface NAME [OPTIONS]

Arguments​

ArgumentDescriptionRequired
NAMEName of the DHCP interfaceYes

Options​

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--server-json TEXTDHCP server config as JSONNo
--relay-json TEXTDHCP relay config as JSONNo

* Exactly one of --folder, --snippet, or --device is required.

Examples​

Create a DHCP Server Interface​

$ scm set network dhcp-interface ethernet1/1 \
--folder Texas \
--server-json '{"ip_pool": [{"name": "pool1", "start_ip": "10.0.0.100", "end_ip": "10.0.0.200"}]}'
---> 100%
Created DHCP interface: ethernet1/1 in folder Texas

Create a DHCP Relay Interface​

$ scm set network dhcp-interface ethernet1/2 \
--folder Texas \
--relay-json '{"server_addresses": ["10.0.1.1", "10.0.1.2"]}'
---> 100%
Created DHCP interface: ethernet1/2 in folder Texas

Delete DHCP Interface​

Delete a DHCP interface from SCM.

Syntax​

scm delete network dhcp-interface NAME [OPTIONS]

Arguments​

ArgumentDescriptionRequired
NAMEName of the DHCP interface to deleteYes

Options​

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--forceSkip confirmation promptNo

* Exactly one of --folder, --snippet, or --device is required.

Example​

$ scm delete network dhcp-interface ethernet1/1 --folder Texas --force
---> 100%
Deleted DHCP interface: ethernet1/1 from folder Texas

Load DHCP Interface​

Load multiple DHCP interfaces from a YAML file.

Syntax​

scm load network dhcp-interface [OPTIONS]

Options​

OptionDescriptionRequired
--file TEXTPath to YAML fileYes
--folder TEXTOverride folder location for all objectsNo
--snippet TEXTOverride snippet location for all objectsNo
--device TEXTOverride device location for all objectsNo
--dry-runPreview changes without applyingNo

YAML File Format​

---
dhcp_interfaces:
- name: ethernet1/1
folder: Texas
server:
ip_pool:
- name: "pool1"
start_ip: "10.0.0.100"
end_ip: "10.0.0.200"

- name: ethernet1/2
folder: Texas
relay:
server_addresses:
- "10.0.1.1"
- "10.0.1.2"

Examples​

Load with Original Locations​

$ scm load network dhcp-interface --file dhcp.yml
---> 100%
✓ Loaded DHCP interface: ethernet1/1
✓ Loaded DHCP interface: ethernet1/2

Successfully loaded 2 out of 2 DHCP interfaces from 'dhcp.yml'

Load with Folder Override​

$ scm load network dhcp-interface --file dhcp.yml --folder Austin
---> 100%
✓ Loaded DHCP interface: ethernet1/1
✓ Loaded DHCP interface: ethernet1/2

Successfully loaded 2 out of 2 DHCP interfaces from 'dhcp.yml'
note

When using container override options (--folder, --snippet, --device), all DHCP interfaces will be loaded into the specified container, ignoring the container specified in the YAML file.

Show DHCP Interface​

Display DHCP interface objects.

Syntax​

scm show network dhcp-interface [NAME] [OPTIONS]

Arguments​

ArgumentDescriptionRequired
NAMEName of the DHCP interface to show; omit to list allNo

Options​

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--max-results INTEGERMaximum number of results to displayNo
--output [table|json|yaml]Output format (default: table)No

* Exactly one of --folder, --snippet, or --device is required.

note

When no NAME argument is provided, all items are listed by default.

Examples​

Show Specific DHCP Interface​

$ scm show network dhcp-interface ethernet1/1 --folder Texas
---> 100%
DHCP Interface: ethernet1/1
Location: Folder 'Texas'
Mode: Server
IP Pool: 10.0.0.100 - 10.0.0.200

List All DHCP Interfaces (Default Behavior)​

$ scm show network dhcp-interface --folder Texas
---> 100%
DHCP interfaces in folder 'Texas':
------------------------------------------------------------
Name: ethernet1/1
Mode: Server
------------------------------------------------------------
Name: ethernet1/2
Mode: Relay
------------------------------------------------------------

Backup DHCP Interfaces​

Backup all DHCP interface objects from a specified location to a YAML file.

Syntax​

scm backup network dhcp-interface [OPTIONS]

Options​

OptionDescriptionRequired
--folder TEXTFolder locationNo*
--snippet TEXTSnippet locationNo*
--device TEXTDevice locationNo*
--file TEXTCustom output filenameNo

* One of --folder, --snippet, or --device is required.

Examples​

Backup from Folder​

$ scm backup network dhcp-interface --folder Texas
---> 100%
Successfully backed up 5 DHCP interfaces to dhcp_interface_folder_texas_20240115_120530.yaml

Backup with Custom Filename​

$ scm backup network dhcp-interface --folder Texas --file texas-dhcp.yaml
---> 100%
Successfully backed up 5 DHCP interfaces to texas-dhcp.yaml

Best Practices​

  1. Avoid IP Pool Overlap: Ensure DHCP server IP pools do not overlap with static IP assignments on the network.
  2. Configure Redundant Relays: When using DHCP relay, specify multiple server addresses for high availability.
  3. Test with Dry Run: Use --dry-run when loading configurations to preview changes before applying.
  4. Backup Before Changes: Always backup existing DHCP configurations before making bulk modifications.
  5. Document Pool Assignments: Maintain records of which interfaces serve which DHCP pools for troubleshooting.