通过Excel表格配置F5 LTM
背景
用户新增或者迁移F5需要更新大量配置到另一台F5上,普通人工配置费事费力且容易出错,所以一位优秀的程序员凭空诞生,创建了基于GO语言实现的通过表格配置F5的实用程序。目前此程序支持 Linux、Windows 以及 Mac 操作系统,本文主要演示前两种,目前此项目已经在 Github 开源,并且已经展获了多个star 🌟 ,如果此应该程序帮助了您,您的 star 是作者最大的动力!
一、表格数据、参数说明和下载
1、表格示例

2、表格参数说明
- virtual_name : 虚拟服务名称
- vs_destination : 目的地址
- vs_ip_protocol : 协议,可选参数
tcpudp - profiles : 指定配置 profiles ,可选参数
httptcpfastL4 - translate_address : 地址转换 , 可选参数
enableddisabled - translate_port : 端口转换, 可选参数
enableddisabled - snat_type : 源地址转换类型 , 可选参数
automapnone - persistence :会话保持,可选参数
source_addrdest_addrhashnonecookie - pool_name : pool 名称
- pool_member : pool 成员,多个成员可以使用回车或者空格进行分隔。
- pool_monitor : pool 健康检查,可选参数
tcpgateway_icmphttp - pool_lbmode : pool 成员负载均衡方式 ,可选参数
round-robinleast-connections-member等
3、表格下载
二、实战演示
1、Windows 操作系统通过表格配置 F5 LTM
(1)下载 Windows 应用程序
(2)运行程序
语法:
shell
C:\Users\wangh>C:\Users\wangh\Desktop\ltm.exe -h
Usage of C:\Users\wangh\Desktop\ltm.exe:
-a string
the host ip address. (default "192.168.1.1")
-f string
specifies an alternative configuration file. (default "/tmp/test.xlsx")
-p string
specifies the password of login host. (default "admin")
-s string
specifies the table name of the workbook. (default "Sheet1")
-u string
specifies the username of login host. (default "admin")执行示例:
shell
C:\Users\wangh> C:\Users\wangh\Desktop\ltm.exe -f C:\Users\wangh\Desktop\create.xlsx -a 192.168.6.70 -u admin -p admin
virtualserver name VS_Test_1 create success.
virtualserver name VS_Test_2 create success.
virtualserver name VS_Test_3 create success.
virtualserver name VS_Test_4 create success.
virtualserver name VS_Test_5 create success.
virtualserver name VS_Test_6 create success.
virtualserver name VS_Test_7 create success.
virtualserver name VS_Test_8 create success.
virtualserver name VS_Test_9 create success.执行截图:

(3)结果验证

2、Linux 操作系统通过表格配置F5 LTM
(1)配置表格
用户可根据需求填写表格内容。

(2)下载 linux 应用程序
(3)运行程序
上传表格和应用程序至Linux系统指定路径,赋予程序执行权限
shell
chmod +x ltm语法:
shell
[root@localhost test]# ./ltm -h
Usage of ./ltm:
-a string
the host ip address. (default "192.168.1.1")
-f string
specifies an alternative configuration file. (default "/tmp/test.xlsx")
-p string
specifies the password of login host. (default "admin")
-s string
specifies the table name of the workbook. (default "Sheet1")
-u string
specifies the username of login host. (default "admin")执行示例:
shell
[root@localhost test]# ./ltm -f create.xlsx -u admin -p admin -a 192.168.6.70
virtualserver name VS_Test_1 create success.
virtualserver name VS_Test_2 create success.
virtualserver name VS_Test_3 create success.
virtualserver name VS_Test_4 create success.
virtualserver name VS_Test_5 create success.
virtualserver name VS_Test_6 create success.
virtualserver name VS_Test_7 create success.
virtualserver name VS_Test_8 create success.
virtualserver name VS_Test_9 create success.(4)结果验证

三、注意事项
表格格式必须为 xlsx 格式,且列的顺序不可变更。
所有表格内容必须填写完整。不许有空的格子。