背景

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

一、表格数据、参数说明和下载

1、表格示例

image-20220616213316614

2、表格参数说明

  • virtual_name : 虚拟服务名称
  • vs_destination : 目的地址
  • vs_ip_protocol : 协议,可选参数 tcp udp
  • profiles : 指定配置 profiles ,可选参数 http tcp fastL4
  • translate_address : 地址转换 , 可选参数 enabled disabled
  • translate_port : 端口转换, 可选参数 enabled disabled
  • snat_type : 源地址转换类型 , 可选参数 automap none
  • persistence :会话保持,可选参数 source_addr dest_addr hash none cookie
  • pool_name : pool 名称
  • pool_member : pool 成员,多个成员可以使用回车或者空格进行分隔。
  • pool_monitor : pool 健康检查,可选参数 tcp gateway_icmp http
  • pool_lbmode : pool 成员负载均衡方式 ,可选参数 round-robin least-connections-member

3、表格下载

二、实战演示

1、Windows 操作系统通过表格配置 F5 LTM

(1)下载 Windows 应用程序

(2)运行程序

语法:

1
2
3
4
5
6
7
8
9
10
11
12
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")

执行示例:

1
2
3
4
5
6
7
8
9
10
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.

执行截图:

image-20220616205938025

(3)结果验证

image-20220616210337715

2、Linux 操作系统通过表格配置F5 LTM

(1)配置表格

用户可根据需求填写表格内容。

image-20220616235515832

(2)下载 linux 应用程序

(3)运行程序

上传表格和应用程序至Linux系统指定路径,赋予程序执行权限

1
chmod +x ltm

语法:

1
2
3
4
5
6
7
8
9
10
11
12
13
[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")

执行示例:

1
2
3
4
5
6
7
8
9
10
[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、结果验证

image-20220616235639012

三、注意事项

  1. 表格格式必须为 xlsx 格式,且列的顺序不可变更。
  2. 所有表格内容必须填写完整。不许有空的格子。