HA Config For F5 LTM

Problem this snippet solves:

You can Configure Master Slave functionality using REST API which are provided below For F5 LTM device.

How to use this snippet:

Dear friends,

Sharing below rest Apis to config F5 LTM Slave.Someone could get help from this.

=== All Steps=============================================================

Step 1 :: Mirroring config sync on Both Machines(on Master and slave)

In below uri bigip1.myf5.com is hostname of machine (Master)

Here ip in body part is your F5 Vlan self ip ....

https://mgmtip/mgmt/tm/cm/device/~Common~bigip1.myf5.com

Method :: PUT
Body :: {"configsyncIp":"ip","unicastAddress":[{"effectiveIp":"ip","effectivePort":1026,"ip":"ip","port":1026}],"mirrorIp":"ip"}

In below uri bigip2.myf5.com is hostname of machine (Slave)

https://mgmtip/mgmt/tm/cm/device/~Common~bigip2.myf5.com

Body :: {"configsyncIp":"ip","unicastAddress":[{"effectiveIp":"ip","effectivePort":1026,"ip":"ip","port":1026}],"mirrorIp":"ip"}

=====================================================================================================================================

Step 2 :: Add To Trsut On master Only
https://mgmtIp/mgmt/tm/cm/add-to-trust
Method :: POST
Body :: {"command":"run","utilCmdArgs":"modify /cm trust-domain /Common/Root add-device { device deviceIp(slaveDeviceIp) device-name SlaveHostName(e.g.bigip2.myf5.com) username admin password admin1}"}

=====================================================================================================================================

Step 3 :: Create Device Group and add Trusted members To That On Master Only
https://mgmtIp/mgmt/tm/cm/device-group/
Call Post
In below body masterSlave is name of the Device group .You can give your choice name.
Body :: {"name":"masterSlave","type":"sync-failover"}

======================================================================================================================================

Step 3.1

For adding devices to group(Add Both Master and slave to above Group)

On Master We Need To call Below Two steps.

https://mgmtIp/mgmt/tm/cm/device-group/~Common~masterSlave/devices/~Common~bigip1.myf5.com

Call Post
Body :: {"items":[{"name":"bigip1.myf5.com"}]}

https://mgmtIp/mgmt/tm/cm/device-group/~Common~masterSlave/devices/~Common~bigip2.myf5.com
Call Post
Body :: {"items":[{"name":"bigip2.myf5.com"}]}

======================================================================================================================================
Step 4 :: Sync master and slave using below command through REST call

https://mgmtip/mgmt/tm/cm
with Post Call at end
Body :: {"command":"run","utilCmdArgs":"config-sync to-group masterSlave"}

Code :

Dear friends,

Sharing below rest Apis to config F5 LTM Slave.Someone could get help from this.

=== All Steps=============================================================

Step 1 :: Mirroring config sync on Both Machines(on Master and slave)

In below uri bigip1.myf5.com is hostname of machine (Master)

Here **ip** in body part is your F5 Vlan self ip .... https://mgmtip/mgmt/tm/cm/device/~Common~bigip1.myf5.com

Method :: PUT
Body :: {"configsyncIp":"ip","unicastAddress":[{"effectiveIp":"ip","effectivePort":1026,"ip":"ip","port":1026}],"mirrorIp":"ip"}

In below uri bigip2.myf5.com is hostname of machine (Slave)

https://mgmtip/mgmt/tm/cm/device/~Common~bigip2.myf5.com

Body :: {"configsyncIp":"ip","unicastAddress":[{"effectiveIp":"ip","effectivePort":1026,"ip":"ip","port":1026}],"mirrorIp":"ip"}

=====================================================================================================================================

Step 2 :: Add To Trsut On master Only
https://mgmtIp/mgmt/tm/cm/add-to-trust
Method :: POST
Body :: {"command":"run","utilCmdArgs":"modify /cm trust-domain /Common/Root add-device { device deviceIp(slaveDeviceIp) device-name SlaveHostName(e.g.bigip2.myf5.com) username admin password admin1}"}

=====================================================================================================================================
Step 3 :: Create Device Group and add Trusted members To That On Master Only
https://mgmtIp/mgmt/tm/cm/device-group/
Call Post
In below body masterSlave is name of the Device group .You can give your choice name.
Body :: {"name":"masterSlave","type":"sync-failover"}
======================================================================================================================================
Step 3.1
For adding devices to group(Add Both Master and slave to above Group)
On Master We Need To call Below Two steps.
https://mgmtIp/mgmt/tm/cm/device-group/~Common~masterSlave/devices/~Common~bigip1.myf5.com
Call Post
Body :: {"items":[{"name":"bigip1.myf5.com"}]}
https://mgmtIp/mgmt/tm/cm/device-group/~Common~masterSlave/devices/~Common~bigip2.myf5.com
Call Post
Body :: {"items":[{"name":"bigip2.myf5.com"}]}

======================================================================================================================================
Step 4 :: Sync master and slave using below command through REST call
https://mgmtip/mgmt/tm/cm
with Post Call at end
Body :: {"command":"run","utilCmdArgs":"config-sync to-group masterSlave"}
Published Jan 09, 2019
Version 1.0

Was this article helpful?

1 Comment

  • hibino_105426's avatar
    hibino_105426
    Historic F5 Account

    It seems we need to include ca-device parameter for adding peer instead of subordinate: Body :: {"command":"run","utilCmdArgs":"modify /cm trust-domain /Common/Root add-device { device deviceIp(slaveDeviceIp) device-name SlaveHostName(e.g.bigip2.myf5.com) username admin password admin1 ca-device}"}