Forum Discussion

draco_184361's avatar
draco_184361
Icon for Nimbostratus rankNimbostratus
Feb 04, 2018

Add address in bulk to address list in AFM

Hi

 

I need a script to add addresses in an existing address list on AFM using the modify /security firewall address-list White_List addresses add . Can any one help me ?>

 

  • will the below work ?

     

    !/bin/bash

    while read p do tmsh modify /security firewall address-list White_List addresses add { $p } done < address_list.txt

     

  • Hi,

     

    Works like a charm! One question, how to pass different Address List (instead of fixed White_List) name as argument?

     

    Piotr

     

  • Just improving your script...

    !/bin/bash
    while read p
    do
        tmsh modify /security firewall address-list $1 add { $p }
    done < $2
    
    ./script_name "White_List" "address_list.txt"
    
  • This doesn't work for me. I get an issue with bash placing the curly braces on the next line. I had take a different approach.

    I put the following in the IP list file for each IP you want in the list:

    modify security firewall address-list WhiteList addresses add {x.x.x.x}
    

    Then I ran the following:

    tmsh < whitelist.txt
    

    BIG-IP v13.1.0