K81271448: Merging BIG-IP configuration objects into the running configuration using tmsh

Non-Diagnostic

Original Publication Date: Dec 20, 2017
Updated Date: Feb 22, 2018

Topic

You should consider using this procedure under the following condition:

  • You want to create or modify BIG-IP configuration objects by merging the configuration changes into the existing running configuration from a text file or from the terminal.

Description

You can change the behavior of the tmsh load sys config command with the merge option. During a configuration load, instead of replacing the entire BIG-IP configuration, the merge option allows you to merge configuration changes that you specify in a text file or from the terminal into the existing running configuration. You can create or modify BIG-IP configuration objects with a merge operation. This option can be very helpful when you want to create a large number of configuration objects on the BIG-IP system in one operation.

Configuration object paths

The following procedures assume you have included the administrative partition path in the object names and the object references of the BIG-IP configuration that you plan to merge. If the administrative partition path is omitted in configuration objects, the system creates or modifies the object in the current administrative partition or looks for the reference to an object in the current administrative partition. The following example shows a configuration object that does not include the administrative partition path in the object name or in the Virtual Local Area Network (VLAN) referenced by the vlan property:

net self example_self {
    address 10.250.250.1/24
    allow-service {
        default
    }
    traffic-group /Common/traffic-group-local-only
    vlan example_vlan
}

To change the current administrative partition from the TMOS Shell (tmsh), use the following command syntax:

cd </path/to/partition>

In this example if you wanted to merge example_self into the configuration in example_partition you would need to change to this administrative partition using the cd command mentioned previously. For example:

cd /example_partition

The VLAN referenced in the vlan property would need to reside in the example_partition or you would need to add the full administrative partition path.

The following example shows BIG-IP configuration objects that include the administrative partition path in the object names and object references. The example also illustrates that you can merge configuration objects into multiple different administrative partitions in a single merge operation by specifying the full path in the object name:

net self /Common/example_self {
    address 10.250.250.1/24
    allow-service {
        default
    }
    traffic-group /Common/traffic-group-local-only
    vlan /Common/example_vlan
}

net self /example_partition/example_self_2 {
    address 10.251.251.1/24
    allow-service {
        default
    }
    traffic-group /Common/traffic-group-local-only
    vlan /example_partition/example_vlan_2
}

Since the path is specified in the object name, you can run the tmsh load sys config merge command from any administrative partition. For example, when you issue the command, if the current administrative partition is Common, the example_self_2 self IP will merge into the example_partition as specified and not the Common partition. The result of a merge operation in the context of the previous example is the system will create and merge example_self self IP into the running configuration in the Common administrative partition and create and merge example_self_2 into the running configuration in the example_partition administrative partition. The tmsh save sys config command saves the changes you merge in the running configuration to disk.

Modifying existing configuration objects with a merge operation

In addition to creating objects, you can also modify existing configuration objects with a merge operation. For example, you want to replace the pool on the following virtual server:

ltm virtual /Common/example_vs {
    destination /Common/172.16.1.1:0
    ip-protocol tcp
    mask 255.255.255.255
    pool /Common/example_pool
    profiles {
        /Common/tcp { }
    }
    source 0.0.0.0/0
    source-address-translation {
        type automap
    }
    translate-address enabled
    translate-port disabled
}

Ensuring the object path and name match, you can merge the following stanza with a change to the value of the pool property:

ltm virtual /Common/example_vs {
    destination /Common/172.16.1.1:0
    ip-protocol tcp
    mask 255.255.255.255
    pool /Common/another_pool
    profiles {
        /Common/tcp { }
    }
    source 0.0.0.0/0
    source-address-translation {
        type automap
    }
    translate-address enabled
    translate-port disabled
}

Prerequisites

You must meet the following prerequisite to use this procedure:

  • You have access to tmsh.

Procedures

Merging a BIG-IP configuration from a specified file into the running configuration

To load the configuration from a specified file and merge its contents into the running configuration, perform the following procedure:

Impact of procedure: Performing the following procedure modifies the running configuration on your BIG-IP system.

  1. Log in to the BIG-IP command line.
  2. In the /var/local/scf directory, import or create a text file with the BIG-IP configuration objects that you want to merge. The specific format depends on the BIG-IP version. Additionally, the procedure assumes you have included the administrative partition path in the object names and references. For more information, review the Configuration object paths section.
  3. Log in to tmsh by typing the following command:

    tmsh

  4. (Optional) To validate the merge operation without changing the running configuration, use the following command syntax:

    load /sys config merge file <filename> verify

    For example, to validate the file example_config.inc, type the following command:

    load /sys config merge file example_config.inc verify

    If the system finds configuration errors, it reports them on the command line.

    Note: For loading a file with a relative path in shell mode, the system uses the default directory, /var/local/scf. For loading a file with a relative path in bash mode, the system first searches the current directory, and if the system can't find the file in the current directory, it searches /var/local/scf. If the file is not stored in the default directory or the current directory, you can specify the full path to the file. For example: load /sys config merge file /var/tmp/example_config.inc.

  5. To merge the BIG-IP configuration from a specified file into the running configuration, use the following command syntax:

    load /sys config merge file <filename>

    For example, to merge the configuration in the file example_config.inc into the running configuration, type the following command:

    load /sys config merge file example_config.inc

  6. Save the configuration by typing the following command:

    save /sys config
     

Merging a BIG-IP configuration from the terminal into the running configuration

To load the configuration from the terminal and merge it into the running configuration, perform the following procedure:

Impact of procedure: Performing the following procedure modifies the running configuration on your BIG-IP system.

  1. Log in to tmsh by typing the following command: fhi

    tmsh

  2. (Optional) To validate the merge operation without changing the running configuration, perform the following steps:
    1. Type the following command:

      load /sys config merge from-terminal verify

      The prompt displays the following message:

      Enter configuration. Press CTRL-D to submit or CTRL-C to cancel.

    2. Paste the BIG-IP configuration objects you want to validate into the terminal window. The specific format depends on the BIG-IP version. Additionally, the procedure assumes you have included the administrative partition path in the object names and references. For more information, review the Configuration object paths section.
    3. When you're finished, press Ctrl + D to submit the changes. The prompt displays the following message:

      Validating configuration...

      If the system finds configuration errors, it reports them on the command line.

  3. To merge the BIG-IP configuration from the terminal into the running configuration, type the following command:

    load /sys config merge from-terminal

    The prompt displays the following message:

    Enter configuration. Press CTRL-D to submit or CTRL-C to cancel.

  4. Paste the BIG-IP configuration objects you want to merge into the terminal window. The specific format depends on the BIG-IP version. Additionally, the procedure assumes you have included the administrative partition path in the object names and references. For more information, review the Configuration object paths section.
  5. When you're finished, press Ctrl + D to submit the changes. The prompt displays the following message:

    Loading configuration...

  6. Save the configuration by typing the following command:

    save /sys config

Applies to:

Product: BIG-IP, BIG-IP AAM, BIG-IP AFM, BIG-IP Analytics, BIG-IP APM, BIG-IP ASM, BIG-IP DNS, BIG-IP FPS, BIG-IP GTM, BIG-IP Link Controller, BIG-IP LTM, BIG-IP PEM
13.X.X, 12.X.X, 11.X.X