mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Sep 2006
Posts: 7
B
Broekie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2006
Posts: 7
It has come to our attention, that even though the Round Robin pools distribute the lists in random order for every query made, mIRC seems to sort the given IP's, unrandomizing the list.

It seems to order them numericaly, lowest IP first. For what we've got from statistical point of view, it looks like mIRC will attempt to use the first IP about 50% of the time, and will actually use another random IP the rest of the time.


Is this a feature or a bug? It sure is a pain in the ass for a lot of IRC networks out there, cause clients don't get spread over all the servers equally. For example, we've got 10 servers, and the IP-based-lowest one always has about 30% of the entire user count.

Why can't mIRC just use the first IP it gets back from the DNS query?

Last edited by Broekie; 27/09/06 09:12 AM.
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
mIRC uses the IP pool list in the order that it is provided by Winsock, and it performs no sorting of the list. It attempts to connect to the first IP in the list and if that attempt fails, it tries the next IP in the list.

Joined: Sep 2006
Posts: 7
B
Broekie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2006
Posts: 7
So it should be winsock who's doing the sorting? That s*cks...

I was kinda hoping it was mIRC, seeing for example nslookup doesn't sort (guess nslookup doesn't use winsock?).

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
The dns entries do seem to be sorted (somewhere). nslookup shows them in whatever order they appear, but the mIRC /dns command displays them sorted. I guess that is why my server is getting such a large portion of the network load.

It seems to me that mIRC used to display them in a rotating fashion (as nslookup does). I can't remember which version appeared to do it that way, but if Khaled says mIRC doesn't sort the entries, maybe the way mIRC queries winsock has changed, or maybe M$ has made some update to winsock.

-genius_at_work

Joined: Sep 2006
Posts: 7
B
Broekie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2006
Posts: 7
Quote:
The dns entries do seem to be sorted (somewhere). nslookup shows them in whatever order they appear, but the mIRC /dns command displays them sorted. I guess that is why my server is getting such a large portion of the network load.

It seems to me that mIRC used to display them in a rotating fashion (as nslookup does). I can't remember which version appeared to do it that way, but if Khaled says mIRC doesn't sort the entries, maybe the way mIRC queries winsock has changed, or maybe M$ has made some update to winsock.

-genius_at_work


Exactly my point. It's been bothering us for I can't even recall how long already, but now that we've got a new server being the lowest IP which is a tad bit splitty lately, it's starting to bug our clients as well.

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
Of course mIRC could randomize the list itself after getting it, in the future..


Saturn, QuakeNet staff
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
I compared the outputs of mIRC and nslookup and they were the same here (unsorted). You can see the exact order of IPs that mIRC uses by using the script below and issuing eg. /dns irc.efnet.net

Code:
on 1:dns:{
  echo 3 I: $iaddress N: $naddress R: $raddress
  var %n = $dns(0)
  echo 3 n: %n for $dns(0).nick $dns(0).addr $dns(0).ip
  var %m = 1
  while ((%m <= %n) && $dns(%m)) {
    echo 4 %m dns: $dns(%m) nick: $dns(%m).nick addr: $dns(%m).addr ip: $dns(%m).ip
    inc %m
  }
}


It may be that for some people Windows (or perhaps firewall software) caches the dns results and re-orders them in some way?

Joined: Sep 2006
Posts: 7
B
Broekie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2006
Posts: 7
Code:
I: 65.23.154.67 N: irc.sorcery.net R: 65.23.154.67
n: 8 for irc.sorcery.net
1 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 65.23.154.67
2 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 66.196.45.122
3 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 66.252.19.229
4 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 69.26.202.173
5 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 145.89.150.59
6 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 195.35.83.67
7 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 195.169.138.124
8 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 216.150.31.130


I wouldn't call that unsorted :-)

I've got mIRC v6.03 here by the way (not a mIRC user myself since quite a while), I'll try the newest in a few.

Edit: The result is exactly the same in v6.2

And here's the output of a nslookup four times in a row:

Code:
> irc.sorcery.net
Server:  ns1.activedomaindns.net
Address:  217.148.161.5

Non-authoritative answer:
Name:    irc.sorcery.net
Addresses:  69.26.202.173, 145.89.150.59, 195.35.83.67, 195.169.138.124
          216.150.31.130, 65.23.154.67, 66.196.45.122, 66.252.19.229

> irc.sorcery.net
Server:  ns1.activedomaindns.net
Address:  217.148.161.5

Non-authoritative answer:
Name:    irc.sorcery.net
Addresses:  65.23.154.67, 66.196.45.122, 66.252.19.229, 69.26.202.173
          145.89.150.59, 195.35.83.67, 195.169.138.124, 216.150.31.130

> irc.sorcery.net
Server:  ns1.activedomaindns.net
Address:  217.148.161.5

Non-authoritative answer:
Name:    irc.sorcery.net
Addresses:  216.150.31.130, 65.23.154.67, 66.196.45.122, 66.252.19.229
          69.26.202.173, 145.89.150.59, 195.35.83.67, 195.169.138.124

> irc.sorcery.net
Server:  ns1.activedomaindns.net
Address:  217.148.161.5

Non-authoritative answer:
Name:    irc.sorcery.net
Addresses:  66.252.19.229, 69.26.202.173, 145.89.150.59, 195.35.83.67
          195.169.138.124, 216.150.31.130, 65.23.154.67, 66.196.45.122

Last edited by Broekie; 29/09/06 03:19 PM.
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
It's definitely not mIRC that's sorting it, I've quadruple checked it :-) Here are my results:

Code:
I: 66.196.45.122 N: irc.sorcery.net R: 66.196.45.122
n: 8 for irc.sorcery.net 66.196.45.122
1 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 66.196.45.122
2 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 66.252.19.229
3 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 69.26.202.173
4 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 145.89.150.59
5 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 195.35.83.67
6 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 195.169.138.124
7 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 216.150.31.130
8 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 65.23.154.67

I have just noticed that after issuing nslookup or /dns several times for irc.efnet.net, neither nslookup nor /dns return the full IP pool list. They only return the first address in the list. This could explain the problem that you're seeing.

I have no idea how to explain it I'm afraid. It seems to be a Windows issue since it is affecting both nslookup and mIRC here.

Joined: Sep 2006
Posts: 7
B
Broekie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2006
Posts: 7
Yeah, I only now noticed that even nslookup orders them.

Even though it has a random first entry, the rest of the entries are always in order...

It looks like you're right, and that Windows sorts them.

But uhm, could you maybe do a lot of IRC networks out there a favour and make mIRC undo the ordering, as in, pick a random IP out of the list it gets from winsock? ;-)

Joined: Sep 2006
Posts: 7
B
Broekie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2006
Posts: 7
Just to show you I'm not kidding when I say it's causing the clients to be shoved towards the server with the lowest IP in the pool (in this case being nova), here's part of a /map output. I've removed the exact user counts cause one of my fellow admins didn't want me to paste them here (don't ask me why...).

Code:
shire.sorcery.net --------------------------- | Users: ( 7.9%)
 `- rivendell.hub.sorcery.net --------------- | Users: ( 0.1%)
     |- nexus.sorcery.net ------------------- | Users: ( 9.9%)
     |- iuturna.sorcery.net ----------------- | Users: (11.6%)
     |- nebula.sorcery.net ------------------ | Users: (12.7%)
     |- terra.sorcery.net ------------------- | Users: ( 9.3%)
     |- wraith.sorcery.net ------------------ | Users: ( 0.0%)
     |   |- luna.sorcery.net ---------------- | Users: ( 5.2%)
     |   |- nova.sorcery.net ---------------- | Users: (26.1%)
     |   `- bonzai.sorcery.net -------------- | Users: (16.8%)
     `- services.sorcery.net ---------------- | Users: ( 0.4%)

Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Okay. It looks like randomizing the IP list is the only way around the issue. I will make mIRC randomize the IP list in the next version. This will apply to /dns and $dns() results as well.

Joined: Feb 2006
Posts: 164
V
Vogon poet
Offline
Vogon poet
V
Joined: Feb 2006
Posts: 164
Code:
I: 145.89.150.59 N: irc.sorcery.net R: 145.89.150.59
n: 8 for irc.sorcery.net 145.89.150.59
1 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 145.89.150.59
2 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 195.35.83.67
3 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 195.169.138.124
4 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 216.150.31.130
5 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 65.23.154.67
6 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 66.196.45.122
7 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 66.252.19.229
8 dns: irc.sorcery.net nick: addr: irc.sorcery.net ip: 69.26.202.173  


And my own dns display puts them in that order too (mIRC 6.17 and 6.2)

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
It may be that different nameservers return different values. My nameserver is my unix firewall, which in turn gets its values from the root servers.

Here are my responses from your script:
Quote:
[5:38:40p] * Dns resolving irc.beyondirc.net
-
I: 69.250.244.150 N: irc.beyondirc.net R: 69.250.244.150
n: 6 for irc.beyondirc.net 69.250.244.150
1 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 69.250.244.150
2 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 70.57.79.243
3 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 71.116.226.183
4 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 75.13.24.210
5 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 75.13.24.215
6 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 208.37.99.142
-
[5:38:40p] * Dns resolved irc.beyondirc.net to 69.250.244.150
-
[5:38:40p] * Dns resolving irc.beyondirc.net
-
I: 69.250.244.150 N: irc.beyondirc.net R: 69.250.244.150
n: 6 for irc.beyondirc.net 69.250.244.150
1 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 69.250.244.150
2 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 70.57.79.243
3 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 71.116.226.183
4 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 75.13.24.210
5 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 75.13.24.215
6 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 208.37.99.142
-
[5:38:40p] * Dns resolved irc.beyondirc.net to 69.250.244.150
-
[5:38:41p] * Dns resolving irc.beyondirc.net
-
I: 69.250.244.150 N: irc.beyondirc.net R: 69.250.244.150
n: 6 for irc.beyondirc.net 69.250.244.150
1 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 69.250.244.150
2 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 70.57.79.243
3 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 71.116.226.183
4 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 75.13.24.210
5 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 75.13.24.215
6 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 208.37.99.142
-
[5:38:41p] * Dns resolved irc.beyondirc.net to 69.250.244.150
-
[5:38:41p] * Dns resolving irc.beyondirc.net
-
I: 69.250.244.150 N: irc.beyondirc.net R: 69.250.244.150
n: 6 for irc.beyondirc.net 69.250.244.150
1 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 69.250.244.150
2 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 70.57.79.243
3 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 71.116.226.183
4 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 75.13.24.210
5 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 75.13.24.215
6 dns: irc.beyondirc.net nick: addr: irc.beyondirc.net ip: 208.37.99.142
-
[5:38:41p] * Dns resolved irc.beyondirc.net to 69.250.244.150

They are always in order.

And here are my responses from nslookup in my windows XP:

Quote:

Non-authoritative answer:
Name: irc.beyondirc.net
Addresses: 208.37.99.142, 69.250.244.150, 70.57.79.243, 71.116.226.1
75.13.24.210, 75.13.24.215

> irc.beyondirc.net
Server: wildtime.beyondirc.net
Address: 192.168.5.1

Non-authoritative answer:
Name: irc.beyondirc.net
Addresses: 75.13.24.215, 208.37.99.142, 69.250.244.150, 70.57.79.243
71.116.226.183, 75.13.24.210

> irc.beyondirc.net
Server: wildtime.beyondirc.net
Address: 192.168.5.1

Non-authoritative answer:
Name: irc.beyondirc.net
Addresses: 75.13.24.210, 75.13.24.215, 208.37.99.142, 69.250.244.150
70.57.79.243, 71.116.226.183

> irc.beyondirc.net
Server: wildtime.beyondirc.net
Address: 192.168.5.1

Non-authoritative answer:
Name: irc.beyondirc.net
Addresses: 71.116.226.183, 75.13.24.210, 75.13.24.215, 208.37.99.142
69.250.244.150, 70.57.79.243

They seem to rotate with each query.

Here is the nslookup responses directly from my firewall:
Quote:

> irc.beyondirc.net
Server: wildtime.beyondirc.net
Address: 192.168.5.1

Non-authoritative answer:
Name: irc.beyondirc.net
Addresses: 69.250.244.150, 70.57.79.243, 71.116.226.183, 75.13.24.210
75.13.24.215, 208.37.99.142

> irc.beyondirc.net
Server: wildtime.beyondirc.net
Address: 192.168.5.1

Non-authoritative answer:
Name: irc.beyondirc.net
Addresses: 208.37.99.142, 69.250.244.150, 70.57.79.243, 71.116.226.183
75.13.24.210, 75.13.24.215

> irc.beyondirc.net
Server: wildtime.beyondirc.net
Address: 192.168.5.1

Non-authoritative answer:
Name: irc.beyondirc.net
Addresses: 75.13.24.215, 208.37.99.142, 69.250.244.150, 70.57.79.243
71.116.226.183, 75.13.24.210

> irc.beyondirc.net
Server: wildtime.beyondirc.net
Address: 192.168.5.1

Non-authoritative answer:
Name: irc.beyondirc.net
Addresses: 75.13.24.210, 75.13.24.215, 208.37.99.142, 69.250.244.150
70.57.79.243, 71.116.226.183

These also seem to rotate with each query.


-genius_at_work

Joined: Aug 2005
Posts: 128
S
Vogon poet
Offline
Vogon poet
S
Joined: Aug 2005
Posts: 128
I don't thing there is such a thing like a order of the IPs. I think the DNS server sends them in a random order, that's why nslookup displays it in different order everytime. However /dns returns them in same order everytime. I think they are cached by winsock, because if you type "iptables /registerdns" the ips on /dns will be displayed in another order.
Example:
//.timer 2 0 dns irc.efnet.net | run ipconfig /registerdns | .timer 1 2 dns irc.efnet.net

Types twice the addresses in the same order, deletes cache(or updates it) and then types the ips again in a different order. Probably nslookup is giving it in different order everytime because it avoids using the cache.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
The IPs must be kept in some kind of order (in memory). From the examples I gave above, my particular nameserver returns them to me in a rotating order. Other nameservers may return their responses in a different order. Whether the reply rotates or is randomized, the fact is that somewhere between the nameserver and mIRC's output, the IPs are being numerically sorted.

-genius_at_work

Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Just testing on the system at work (sans mIRC), I get:

> nslookup irc.efnet.net
Non-authoritative answer:
Server: <blanked>
Address: <blanked>

Name: irc.efnet.net
Addresses: 64.161.255.2, 65.77.140.140, 66.225.225.225, 66.232.155.115
69.16.172.2, 80.240.238.17, 141.213.238.252, 192.116.231.44, 193.109.122.77
193.163.220.3, 194.109.129.220, 195.111.64.195, 198.3.160.3, 198.175.186.5
198.252.144.2, 204.92.73.10, 205.210.145.2, 209.9.224.35, 216.32.207.207
216.193.223.223, 217.17.33.10

Which would appear to be in numerical order.

If I now do your tweak:

> ipconfig /registerdns

Windows 2000 IP Configuration

Registration of the DNS resource records for all adapters of this computer has been initiated. Any errors will be reported in the Event Viewer in 15 minutes.

> nslookup irc.efnet.net
Non-authoritative answer:
Server: <blanked>
Address: <blanked>

Name: irc.efnet.net
Addresses: 65.77.140.140, 66.225.225.225, 66.232.155.115, 69.16.172.2
80.240.238.17, 141.213.238.252, 192.116.231.44, 193.109.122.77, 193.163.220.3
194.109.129.220, 195.111.64.195, 198.3.160.3, 198.175.186.5, 198.252.144.2
204.92.73.10, 205.210.145.2, 209.9.224.35, 216.32.207.207, 216.193.223.223
217.17.33.10, 64.161.255.2

They're still in order....:(

Oh, and I did wonder about that 15 minute notice - the last run of nslookup was done 15 mins after the previous ipconfig. Nothing in the event viewer log, either.

I remember trying it at home, with a linux server performing the DNS, but querying it from windows, and getting randomised responses.

Does that point the issue being in the implementation of the (remote) DNS caches?


Sais
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
In your first example, the response is sorted from lowest to highest, but in your second example, the lowest IP (64.161.255.2) which was first has been sent to the end of the list, and the other IPs have moved one position towards the front.

-genius_at_work

Joined: Sep 2006
Posts: 7
B
Broekie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Sep 2006
Posts: 7
Whatever it is that's causing this, if Khaled indeed makes mIRC pick a random IP every time, regardless of the order of IP's it gets back from winsock, the "problem" is solved.

About what's causing this, it appears that most ISP's DNS Servers order the IP's, rotating them on every request. This has been confirmed for at least all MS based DNS servers.

So, the first request will give back 1, 2, 3, 4, 5, 6
The second will give back 2, 3, 4, 5, 6, 1
The third 3, 4, 5, 6, 1, 2
Etc.

In other words, mIRC (or actually winsock) will almost always get the lowest IP first in the first DNS Query. Add to that the fact that winsock caches, and it explains why the order stays the same within mIRC aswell.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I don't claim to know how Winsock works, but maybe there is some switch/option that can be added to requests which forces winsock to query its nameserver again, regardless of whether the list is already cached or not. For example, if mIRC used a command like /winsock dns irc.network.com a switch could be added like this /winsock dns -f irc.network.com is such a thing existed.

-genius_at_work

Page 1 of 2 1 2

Link Copied to Clipboard