0

I am trying to understand how Iphone decides which IP address to use from 2 IP addresses returned in dns response in this specific scenario below.

Scenario is like this:

1- Iphone sends dns query for an Arecord like "bsf.mncxx.mccxx.pub.3gppnetwork.org" and gets 2 IP addresses in the response.

2- Iphone sends GET requests to one of the IP address to authenticate itself (not important which BSF IP selected at this step)

3- BSF returns 401 Unauthorized with authentication challenge

4- Iphone calculates the response and sends it in 2nd GET request.

Problem starts here. Iphone selects BSF randomly here. The expectation is to send this 2nd GET(with calculated response) to the same BSF in step2. All other phones (Samsung, Huawei, Sony etc) sends it to BSF in step2. But it seems Iphone just randomly selects. If other BSF is selected, authentication fails.

As a workaround, we configured BSF to send Connection:keep-alive in http 401 response, but unfortunately it didn't help. Iphone still selects it randomly.

Here in our setup, BSF IP addresses are in close subnets (BSF1 = 172.31.59.165, BSF2= 172.31.59.181)

It's very strange that, in another setup (not exactly same BSFs with ours but http request and responses similar) same Iphone always selects the same BSF in step2 and step4 (BSF1=10.216.138.78, BSF2= 10.210.149.79). If it selects BSF1 in step2, continues with BSF1 in step4. Same for BSF2.

Is it possible that Iphone checks subnets during decision? Any other guess or suggestion will be highly appreciated.

Thanks White

White11
  • 11
  • 1
  • 1
    It is valid to connect to either IP address on subsequent requests. Your application needs to be able to handle this. – Michael Hampton Aug 28 '21 at 17:48
  • Thanks, you may be right but it does not explain why the same iphone behaves different in 2 different setups. Its just very easy to face the problem in first setup, but in the second setup it is impossible to produce it. I am not talking about a few calls, thousands of calls and all are successful. – White11 Aug 28 '21 at 18:40
  • 1
    It isn't worth the time to wonder why iPhone works like it does. It works according to the DNS specification, and the only sensible way forward is to fix the application. – Tero Kilkanen Aug 28 '21 at 21:01
  • You have 50% chance of using the same server. Some implementations might reuse last working first, others might try the different result first to help balance, it's still is around 1/4 - 1/3 be chance of using different results. If you have different records you must expect it to chang on EVERY request. – NiKiZe Aug 29 '21 at 09:17

0 Answers0