侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

出口规划及F5调整

2023-01-03 星期二 / 0 评论 / 0 点赞 / 53 阅读 / 8705 字

涉及到客户信息,部分详细资料没有公布概述某公司的有三条出口网络,一条名为襄阳联通,另一条为上海富亚,还有一条为湖北和数,出口网络由第三方的 ISP 运营商提供。三条出口的规划是襄阳联通作为主要业务使用

. .

涉及到客户信息,部分详细资料没有公布

概述

.

某公司的有三条出口网络,一条名为襄阳联通,另一条为上海富亚,还有一条为湖北和数,出口网络由第三方的 ISP 运营商提供。三条出口的规划是襄阳联通作为主要业务使用,上海富亚作为 维护人员使用,湖北和数提供给领导专用。

在 2017 年的 7 月份开始,上海富亚和湖北和数的公网地址被屏蔽,已经不能使用了。同月,襄阳联通因为 ISP 改造,线路和割接等等原因,出现了频繁的震荡,震荡频率和周期最高为一天 20 几次,持续时间最长为 12 小时,导致主要业务外网访问不正常,瞬断,还引起了负载均衡 F5 的故障。在 2017 年的 8 月中旬,襄阳联通的 ISP 在没有及时通知的情况下,擅自更改公网地址,导致的端口映射策略失效,影响 *** 和线路监控等主要业务的访问,造成了恶劣影响。

为了解决以上问题,特意寻求了一个专门的,稳定的公网地址,由其他公司提供。公网地址为 xx.xx.xx.xx ,设备互联地址 172.31.0.253/29, 出口指向网关 172.31.0.254/29 。 SNAT 访问外网采用多对一的方式, DNAT 端口映射采用一一对应转换的方式。公网地址为联通地址。

!

网络拓扑规划

外网访问规划

端口映射规划

链路负载均衡

由于规划使用有两条 ISP 出口网络,联通电信都有,需要使用 F5 进行链路负载均衡。

为了进行链路负载均衡,就需要配置相应的资源池,添加相应的节点。

链路负载均衡的工作过程如下图所示:

说明:

1 . 对于备用流量优先走襄阳联通,故障时,走平台出口;

2 . 对于主用流量,优先走平台出口,故障时,走襄阳联通出口。

选路原则

省广电的 F5 负载均衡主要是由定义好的 irules 规则来决定网口网络的选择,区别于传统的路由策略。

大致的 irules 规则如下图所示

说明:

1 . Class_master 是定义好的主要业务访问的 IP 地址的类别;

2 . Class_backup 是定义好的备用那个访问需求的 IP 地址的类别;

F5_2 负载均衡配置

创建 VLAN 以及 VLAN 配置


创建 VLAN 92 名为 pingtaichukou_link ,标签 tag 为 92 ,绑定接口 1/1.4s

创建 VLAN selfIP


VLAN 92 的 selfIP 为 172.31.0.253 , 29 位掩码,绑定到 VLAN 92 pingtaichukou_link 。

配置 node


新增 nodes ,名为 node_pingtaichukou_link , , 配置 node 地址为 172.31.0.254.

配置 Pool


选择 Health Monitors 为 gateway_icmp_hbgd

配置 members ,添加 node_xy_cnc ,选择负载均衡算法 ROUND ROBIN( 轮询)

调整 pool 优先级

将两个 node 添加到两个 pool 中,并调整各个 node 优先级

配置类地址

进入 irules->datagrouplist 配置类地址

配置类地址 class_master

配置类地址 class_backup

修改 rules


(图: vs_outbound 使用 irule )

irules 添加 snat

irules 添加 class

irules 添加判断脚本

红色下划线部分为修改添加的语句====================================================================when RULE_INIT { # Use a local array to configure SNAT addresses. # These addresses do not need to be defined in a SNAT pool or elsewhere. # They simply need to be free IP addresses LTM can use to source serverside connections from. # In this example, we use 10 addresses of any subnet.  You will probably want to change these to be in the same subnet. # Any number of addresses can be used.# SNAT Pool for pingtaichukou_cncset  static::snat_pingtaichukou_ips(0) XX.XX.XX.XX# SNAT Pool for XYcncset  static::snat_XY_ips(0) XX.XX.XX.XXset  static::snat_XY_ips(1) XX.XX.XX.XXset  static::snat_XY_ips(2) XX.XX.XX.XXset  static::snat_XY_ips(3) XX.XX.XX.XX# SNAT Pool for SHFYctc_Client_VIP# set  static::snat_shfy_ctc_ips(0) 1.82.184.78# SNAT Pool for XYcnc_Client_VIP# set  static::snat_xy_cnc_ips(0) 58.19.180.83# SNAT Pool for hs_link1set  static::snat_hs1_ips(0) 183.47.203.212}when CLIENT_ACCEPTED {#log local0.info "Client Accepted [IP::client_addr] -> [IP::local_addr]"if { [class match [IP::client_addr] equals class_backup ] }{#log local0.info "client connected, hit class_backup "pool xy_cnc_first}elseif { [class match [IP::client_addr] equals class_master ] }{#log local0.info "client connected, hit class_maste r"pool pingtai_cnc_frist}elseif { [class match [IP::client_addr] equals class_manage ] }{#log local0.info "client connected, hit class_manage"pool shfy_ctc_first}}when LB_SELECTED {#log local0.info "LB_SELECTED, Router: [LB::server addr]"if {[IP::addr [LB::server addr] equals 2.1.1.41 ]} {    if { [class match [IP::client_addr] equals class_clientvip] } { # Calculate the crc32 checksum of the client IP # Use the modulo of the checksum and the number of SNAT IPs to choose from to select a SNAT IP snat $static::snat_hs1_ips([expr {[crc32 [IP::client_addr]] % [array size static::snat_hs1_ips]}])    set snataddress $static::snat_hs1_ips([expr {[crc32 [IP::client_addr]] % [array size static::snat_hs1_ips]}])    #log local0.info "Hits hs link1, snat address is $snataddress"}}elseif {[IP::addr [LB::server addr] equals 10.254.248.1 ]} { if { [class match [IP::client_addr] equals class_backup ] } {  # Calculate the crc32 checksum of the client IP  # Use the modulo of the checksum and the number of SNAT IPs to choose from to select a SNAT IP  snat $static::snat_XY_ips([expr {[crc32 [IP::client_addr]] % [array size static::snat_XY_ips]}])  set snataddress $static::snat_XY_ips([expr {[crc32 [IP::client_addr]] % [array size static::snat_XY_ips]}])  #log local0.info "Hits XYcnc link, snat address is $snataddress"  }}elseif {[IP::addr [LB::server addr] equals 172.31.0.254 ]} {    if { [class match [IP::client_addr] equals class_master ] } {  # Calculate the crc32 checksum of the client IP  # Use the modulo of the checksum and the number of SNAT IPs to choose from to select a SNAT IP  snat $static::snat_pingtaichukou_ips([expr {[crc32 [IP::client_addr]] % [array size static::snat_pingtaichukou_ips]}])  set snataddress $static::snat_pingtaichukou_ips([expr {[crc32 [IP::client_addr]] % [array size static::snat_pingtaichukou_ips]}])  #log local0.info "Hits  pingtaichukou link, snat address is $snataddress"  }}else { snat none}}

增加路由 routes

重置会话保持和连接

在应用 irules 之后,在命令行重置会话保持和连接。

b conn all delete
删除所有的当前连接

b persist all delete
删除所有 会话保持

.

广告 广告

评论区