Print

配置基于域名的负载分担后访问部分域名存在问题

组网及说明



1. 客户配置了基于域名的负载分担,内网用户通过域名访问外网服务器,先通过DNS 查询获得外网服务器的地址。后续流 量通过DNS 应答返回的地址去访问外网服务器。

2. 配置了出链路负载均衡,匹配到特征域名的报文通过link2出去

其他的就是直接转发匹配对应的默认路由,走link1。

问题描述

访问某个网站,走了link2.

但是该网站不在特征域名的类中,且访问该网站的DNS请求也不经过LB.

应该直接三层转发走link1才对.

过程分析

首先查看会话,发现报文从RAGG2接口出去,走了link2.

<H3C>dis session table ipv4 source-ip 10.36.12.236 destination-ip 116.163.42.70 verbose

CPU 1 on slot 7 in chassis 2:

Initiator:

  Source      IP/port: 10.36.12.236/1

  Destination IP/port: 116.163.42.70/2048

  DS-Lite tunnel peer: -

  VPN instance/VLAN ID/Inline ID: -/-/-

  Protocol: ICMP(1)

  Inbound interface: Route-Aggregation1.101

  Source security zone: Trust

Responder:

  Source      IP/port: 116.163.42.70/1

  Destination IP/port: 10.36.12.236/0

  DS-Lite tunnel peer: -

  VPN instance/VLAN ID/Inline ID: -/-/-

  Protocol: ICMP(1)

  Inbound interface: Route-Aggregation2

  Source security zone: student

State: ICMP_REPLY

Application: ICMP

Rule ID: 1

Rule name: 1

Start time: 2021-11-09 09:18:35  TTL: 29s

Initiator->Responder:        14624 packets     878080 bytes

Responder->Initiator:        14604 packets     876240 bytes

 

查看负载均衡效果,发现匹配到了类为test的LB策略,并进行选路走了link2,但是test中并不包括这个域名。

[Student_Unicom]loadbalance schedule-test ip protocol tcp destination 116.163.42.70 destination-port 443 source 10.36.12.236 source-port 50420

Chassis 1 Slot 7 CPU 1:

    Matched virtual server: test

    Matched class: test

    Forward type: Forwarding to link

    Selected link: link2

        Scheduling algorithm: Predictor


查看LB设备上DNS缓存发现域名类中有一个域名解析得到的IP地址与我们访问的地址一致.

Domain name: french.people.com.cn

Aging time: 60 min

IPv4 addresses: 116.163.43.184

                116.163.42.70


分析:基于域名的负载均衡是通过DNS 查询的结果建立域名和地址的对应关系,引导后续访问特定域名的流量走特定的链路。

本质上还是基于IP的负载分担.

解决方法

可以删除该域名临时规避,但是不能保证其他的域名是否会对应同样的IP地址.