How to mass import network-group CIDR


#1

I have a scenario where I have to create a network-group to apply to a firewall rule. The network-group is a very a large number of items and manually entering ea CIDR is a daunting task.
Is there a recommended method in exporting the list in to vyos?

TIA

Kevin


#2

When you are logged into a vyos box, the command line is actually a modified bash shell. So you can do things like:

configure
. myloader
commit
save
exit

where “myloader” is a simple text file containing four lines:

delete firewall group network-group mygroup
cat myentries | while read cidr; do
set firewall group network-group mygroup network $cidr
done

and “myentries” is a file containing your list of entries.

Put myentries and myloader in /home/vyos.