Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

iControl REST curl command to create VLAN

James_Thomson
F5 Employee
F5 Employee

If you have a CURL command to create a VLAN using iControl REST which has a name, tag, and an interface assigned, can you please post it here? Here's a sample of what i'm looking for for a self IP create: curl -sk -u admin:admin https://10.0.0.20/mgmt/tm/net/self/ -H 'Content-Type: application/json' -X POST -d '{"name":"self3","address":"10.1.0.26/24","vlan":"external"}'

 

3 REPLIES 3

James_Thomson
F5 Employee
F5 Employee

I figured it out. You have to do it in 2 steps, create the vlan, then modify it and assign an interface. Why? I have no idea.

 

Create VLAN external

 

Tagged:

 

curl -sk -u admin:admin https://192.168.153.140/mgmt/tm/net/vlan/ -H 'Content-Type: application/json' -X POST -d '{"name":"vlan33","tag":"33"}'

 

Untagged:

 

curl -sk -u admin:admin https://192.168.153.140/mgmt/tm/net/vlan/ -H 'Content-Type: application/json' -X POST -d '{"name":"vlan34"}'

 

Associate an interface with VLAN external and use the tag

 

curl -k -u "admin:admin" https://192.168.153.140/mgmt/tm/net/vlan/vlan33 -H "Content-Type:application/json" -X PUT -d '{"name":"interfaces", "interfaces":[{"name":"1.3","tagged":null}]}'

 

Associate an interface with VLAN external and make it untagged

 

curl -k -u "admin:admin" https://192.168.153.140/mgmt/tm/net/vlan/vlan34 -H "Content-Type:application/json" -X PUT -d '{"name":"interfaces", "interfaces":[{"name":"1.3"}]}'

 

devopsdd_183664
Altostratus
Altostratus

Better late than never I suppose :). Subcollections can be a bit of a pain. You can create a vlan, assign it to an interface, and tag it in one shot like so:

 

curl -sk -u admin:admin -H "Content-type: application/json" -X POST -d '{"name":"external","tag":"2","interfaces": [{"name":"1.1","tagged":true}]}' https://192.168.153.140/mgmt/tm/net/vlan

 

This works for me in ver=11.6.0

 

Worked for me. Thanks!