Technical Tip: Add per-device mapping to VLAN in FortiSwitch Manager using Script and JSON API.
| Description | This article describes how to add per-device mapping to VLANs in FortiSwitch Manager. |
| Scope | FortiManager. |
| Solution | Per-Device mapping for VLANs in FortiSwitch Manager can be added by following in bulk by using Script and also via JSON API:
config fsp vlan edit "<VLAN_NAME>" set vlanid <VLAN_ID> config dynamic_mapping edit "<DEVICE_NAME>"-"<VDOM>" set _dhcp-status enable config interface set ip <IP> <MASK> set vlanid <VLAN_ID> end config dhcp-server set default-gateway <IP> set netmask <MASK> set dns-service default set ntp-service default
config ip-range edit 1 set start-ip <IP> set end-ip <IP> next end end next end next end
{ "method": "add", "params": [ { "data": [ { "interface": { "ip": [ "{{IP_ADDRESS}}", "{{NETMASK}}" ], "secondary-IP": 0, "secondaryip": null, "vlanid": {{VLAN_ID}} }, "dhcp-server": { "auto-configuration": 1, "auto-managed-status": 1, "conflicted-ip-timeout": 1800, "default-gateway": "{{IP_ADDRESS}}", "id": 0, "ip-range": [ { "start-ip": "{{DHCP_START_IP}}", "end-ip": "{{DHCP_END_IP}}", "id": 1 } ], "lease-time": 604800, "netmask": "{{NETMASK}}", "server-type": 1, "status": 1 }, "_scope": [ { "name": "{{DEVICE_NAME}}", "vdom": "{{VDOM}}" } ], "_dhcp-status": 1 } ], "url": "/pm/config/adom/{{ADOM_NAME}}/obj/fsp/vlan/{{VLAN_NAME}}/dynamic_mapping" } ], "id": 1, "session": "{{session}}" }
Related documents: Add a Script |
