sábado, 31 de enero de 2015

Testing LAN on Wifi Yosemite

Hello,

As a continuation on my previous post (3) I've been doing additional tests.

Finally I managed to install a web server in the LAN, and I change my tests to include it:
---
#!/bin/bash

# Network checking script
 while true; do 
        # By doing this, I check only the TCP part of the connection and DNS is not involved
/usr/local/sbin/check_http -H www.google.es -I 74.125.21.94 -u / -t 3; 
if [ "x$?" != "x0" ]; then
echo "HTTP Failure. "
fi
        # My web server is in another box, in the IP 192.168.0.14
  /usr/local/sbin/check_http -H localhost -I 192.168.0.14 -p 81 -u / -t 3; 
if [ "x$?" != "x0" ]; then
echo "LOCAL HTTP Failure. "
fi
/usr/local/sbin/check_dns -H www.google.es -s 8.8.4.4 -t3; 
if [ "x$?" != "x0" ]; then
echo "Fallo DNS."
fi
echo -n "# Connections: "; netstat -n -p tcp | wc -l ; 
sleep 1; 

 done
-------

So, the first HTTP check is about internet, the second one is for a web server in LAN, and the third, is for a DNS in internet.

When failing, I got this result:
------
This is a 
CRITICAL - Socket timeout after 3 seconds
HTTP Failure. 
HTTP OK: HTTP/1.1 200 OK - 11566 bytes in 0,015 second response time |time=0,015339s;;;0,000000 size=11566B;;;0
DNS OK: 0,010 seconds response time. www.google.es returns 74.125.21.94|time=0,009805s;;;0,000000

# Connections:       14
-----

The problem is localized in the router part on my pair Wifi device/ MBA as other devices work well with my Wifi device (that I can't change because it's capped by provider).

I tried to install a Wifi USB device (Cisco Linksys WUSB54GC but it seems it's a bit outdated), so I'm working on using VirtualBox to redirect the USB device to a VM with Linux, then configure that Wifi device inside the VM, and finally, redirect all the OS X traffic through the VM. I'll publish my results whenever I finish.


martes, 27 de enero de 2015

More tests on Wifi OS X problems

I go on investigating the issues with Wifi communications on OS X Yosemite 10.10.2 (14C106a).
[ This is my third post on this subject: previous post 1 | 2 ]
I was wondering if it's related specifically to the Wifi Interface or not:

So, I activated Apache HTTPD server and then I run Apache Bench with a concurrency of 100.

# ab -c 100 -n 100000 http://localhost/


With the URL http://localhost I'm using the IP 127.0.0.1, so the connection is
from: lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 ::1 prefixlen 128 
inet 127.0.0.1 netmask 0xff000000 
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
nd6 options=1<PERFORMNUD>

to: lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 ::1 prefixlen 128 
inet 127.0.0.1 netmask 0xff000000 
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
nd6 options=1<PERFORMNUD>
This way, Wifi was not involved in the testing. With Apache Bench I can add 100 new connections to the stack. Nevertheless, my check script go on without any changes. Conclusion: it's not a general TCP/IP stack problem but specific for WiFi.

The same test using the IP of the WiFi got interrupted:

MacBook-Air:private root# ab -c 100 -n 100000 http://192.168.0.13/
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.0.13 (be patient)
Completed 10000 requests
apr_socket_recv: Connection refused (61)

Total of 16447 requests completed

So, there is something here...
Nevertheless, if I change the concurrency into 50, Apache Bench is working well, and the check connection script is doing well too:
---
HTTP OK: HTTP/1.1 200 OK - 19222 bytes in 0,225 second response time |time=0,225253s;;;0,000000 size=19222B;;;0
DNS OK: 0,118 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,117735s;;;0,000000
      57
HTTP OK: HTTP/1.1 200 OK - 19222 bytes in 0,225 second response time |time=0,225253s;;;0,000000 size=19222B;;;0
DNS OK: 0,105 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,104543s;;;0,000000
      57
HTTP OK: HTTP/1.1 200 OK - 19205 bytes in 0,234 second response time |time=0,234407s;;;0,000000 size=19205B;;;0

DNS OK: 0,064 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,063649s;;;0,000000
---
So it seems not to affect if Wireless is not used (well, if packets aren't going over the air).

I think I'm going to test if it's something related to the Router part of the Wifi Access Point or it affects the Layer-2 too. I'll install an apache2 httpd server in the same Wifi LAN and I'll do the same tests.

viernes, 23 de enero de 2015

WiFi problems on Yosemite 10.10.2 - further investigations

Hi,

I upgraded today to Yosemite 10.10.2 beta (14C106a) but WiFi connection is still broken.

I've been doing some tests and it seems I can reproduce the issue consistently.

First, I installed nagios-plugins to use check_http and check_dns tools. I'm using both tools to check both TCP and UDP packets.
# brew install nagios-plugins


Then, I have used an bash command to get some log:
---

while true; do /usr/local/sbin/check_http -H www.google.es -I www.google.es -u / -t 3; /usr/local/sbin/check_dns -H www.google.es -s 8.8.8.8 -t3; netstat -n | wc -l ; sleep 1; done


I'm recording the average time to get the google homepage (TCP/80), then a DNS request (UDP/53) and finally I get the number of current connections on the system
-----
HTTP OK: HTTP/1.1 200 OK - 19221 bytes in 0,242 second response time |time=0,241633s;;;0,000000 size=19221B;;;0
DNS OK: 0,066 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,066390s;;;0,000000
     188
HTTP OK: HTTP/1.1 200 OK - 19206 bytes in 0,200 second response time |time=0,200444s;;;0,000000 size=19206B;;;0
DNS OK: 0,074 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,073538s;;;0,000000
     188
HTTP OK: HTTP/1.1 200 OK - 19190 bytes in 0,637 second response time |time=0,637000s;;;0,000000 size=19190B;;;0
DNS OK: 0,066 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,065658s;;;0,000000
     188
HTTP OK: HTTP/1.1 200 OK - 19209 bytes in 0,161 second response time |time=0,160687s;;;0,000000 size=19209B;;;0
DNS OK: 0,127 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,127478s;;;0,000000
     188
HTTP OK: HTTP/1.1 200 OK - 19214 bytes in 0,225 second response time |time=0,225001s;;;0,000000 size=19214B;;;0
DNS OK: 0,062 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,062449s;;;0,000000
     188
HTTP OK: HTTP/1.1 200 OK - 19214 bytes in 0,252 second response time |time=0,251791s;;;0,000000 size=19214B;;;0
DNS OK: 0,063 seconds response time. www.google.es returns 201.218.92.144,201.218.92.148,201.218.92.152,201.218.92.154,201.218.92.155,201.218.92.159,201.218.92.163,201.218.92.165,201.218.92.166,201.218.92.170,201.218.92.174,201.218.92.176,201.218.92.177,201.218.92.181,201.218.92.185,201.218.92.187|time=0,062686s;;;0,000000
     188
HTTP OK: HTTP/1.1 200 OK - 19203 bytes in 0,180 second response time |time=0,179877s;;;0,000000 size=19203B;;;0
-----> I start utorrent here <-----
CRITICAL - Plugin timed out while executing system call

     216
HTTP OK: HTTP/1.1 200 OK - 19181 bytes in 0,186 second response time |time=0,185636s;;;0,000000 size=19181B;;;0
CRITICAL - Plugin timed out while executing system call
...


When I turn off torrent and number of connections back to 188, checks go to a "OK Status".

It seems it doesn't depend on a specific number of connections. And it seems that UDP is more resilient than TCP to failures.

I'm wondering if it has something to do with an internal QoS for outbound connections (I'm reading this thread: https://discussions.apple.com/thread/6645172)

I did the same check with a server under my control, and I sniffed the traffic with tcpdump. I discovered  that the TCP packets are not getting out from my MBA.



sábado, 17 de enero de 2015

Yosemite Beta Wifi Problems on Macbook Air

Hi!

I'm testing Yosemite Beta (10.10.2 - 14C94b) because I found some problems with the WiFi adapter on my MacBook Air.

I've tested everything I could:

  • Removing / Adding WiFi 
  • Restarting services
  • Upgrade to Yosemite Beta 
  • Tried WiFriedX
  • Removing /Library/Preferences/SystemConfiguration
I couldn't change the channels or WiFi band.

Nevertheless, it seems it doesn't work to fix my WiFi. Still Random issues.

I've observed that open connections don't get affected, but new ones. Ping to 8.8.8.8 seems to work all the time.


Thx