pt_server_dhcp
Creates or edits a DHCP pool on a Packet Tracer server and turns the DHCP service on or off, with options to set gateway, DNS, IP range, mask, and exclusions.
Instructions
A Server-PT's Services > DHCP: creates or edits a pool and switches it on.
pool: name ("serverPool" is the factory one: editing it is the most common case). Touched only if a pool field below is given; if it doesn't exist it is created with those values.
gateway, dns, start_ip, mask ("255.255.255.0" or "24"), max_users, tftp, wlc: empty/0 = leave alone. PT's script API has no TFTP/WLC setter, so tftp/wlc always come back in not_applied (set them in the GUI). Every field is read back: any PT does not hold comes back in not_applied, with ok=false.
enable: True = Service On (default), False = Off, None = leave alone.
remove_pool: deletes that pool (alone, it creates nothing).
exclude: ranges to exclude, ["192.168.1.1-192.168.1.9"]; they apply to the port's DHCP server, never create or edit a pool.
interface: the server's port (default: the first one). Hosts use it with pt_host_ip_config(mode="dhcp").
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"device": "<device>"
},
"name": "pt_server_dhcp"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dns | No | ||
| wlc | No | ||
| mask | No | ||
| pool | No | serverPool | |
| show | No | ||
| tftp | No | ||
| device | Yes | ||
| enable | No | ||
| capture | No | ||
| exclude | No | ||
| gateway | No | ||
| start_ip | No | ||
| interface | No | ||
| max_users | No | ||
| output_dir | No | screenshots | |
| remove_pool | No |