krypted.com

Tiny Deathstars of Foulness

Dropping network connections can be incredibly frustrating. And finding the source can be a challenge. Over the years, I’ve found a number of troubleshooting methods, but the intermittent drop can be the worse to troubleshoot around. When this happens, I’ve occasionally resorted to scripting around failures, and dumping information into a log file to find the issue. For example, you may find that when a network connection fails, you have a very strong signal somewhere, or that you have a very weak signal on all networks.

I’ve found there are three pretty simple commands to test joining/unjoining, and using networks (beyond the standard pings or port scans on hosts). The first is the airport command, along with –disassociate. This just unjoins all networks:

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --disassociate

The second is a quick scan. Here, I’ve grep’d out the network I’m after (aka SSIDofNetwork – a very likely wireless network name), but when looking for environmental issues, you might choose to parse this into a csv and output all networks:

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s | grep SSIDofNetwork

Finally, you can join a network. You might have to escape out special characters in a password and it’s never wise to put a password into a script, etc. But, quick and dirty, this will join that SSIDofNetwork network:

sudo networksetup -setairportnetwork en0 "SSIDofNetwork" mysecretpassword

Anyway, loop it, invoke it however you invoke it, etc. Hope this helps someone, and if you have other tricks you’ve found helpful, feel free to throw them in the ‘ole comments!

How Users Feel About Intermittent Networking Issues

August 26th, 2016

Posted In: Mac OS X, Mac OS X Server, Mac Security, Network Infrastructure, Programming

Tags: , , , , , , ,

Hold down the Option key when you click on the AirPort icon in the menu bar:

You can then see the SSID, channel, security, RSSI, transmit rate, etc. The airport command is now located at /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport so this would be similar to:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I

July 23rd, 2012

Posted In: Mac OS X, Mac OS X Server, Mac Security, Mass Deployment

Tags: , , , , ,

If you run networksetup and do a -listallhardwareports in OS X Snow Leopard, you’ll see that the Hardware Port: for en0 (on an MBA at least, but you should get the point even if it’s a MacPro) is AirPort. If you run the same command in Lion, you’ll notice the the hardware port is now Wi-Fi.

This change cascades to any commands like -listpreferredwirelessnetworks where the hardware port might get called on. For most of my scripts for assigning AirPort networks, etc I was able to mostly just find-and-replace AirPort for Wi-Fi, provided I didn’t use AirPort anywhere else (e.g.$AirPort, etc).

July 20th, 2011

Posted In: Mac OS X, Mass Deployment

Tags: , , , ,

If you need to push a wireless network into your image in Mac OS X, you can do so with the networksetup command. Networksetup has a few options that are specifically geared to working with wireless networks. In order to obtain a list of all of the networks that your system has used, you will use the networksetup command along with the -listpreferredwirelessnetworks option. The man page lists that you will follow this command with the hardwareport. The hardwareport is the name of the wireless network adapter, which can be seen in the System Preference pane.

Finding the hardwareport

By default this is called AirPort, so the default command to see all wireless networks in your preferred list would be:

networksetup -listpreferredwirelessnetworks AirPort

In order to remove items from the list you will use the -removepreferredwirelessnetwork option. Here, you will run networksetup followed by the option and then the hardwareport followed by the name of the network to be removed. So to remove a network called Linksys:

networksetup -removepreferredwirelessnetwork AirPort Linksys

You can also remove all of them by using the -removeallpreferredwirelessnetworks option followed by the hardwareport:

networksetup -removeallpreferredwirelessnetworks AirPort

And then of course, the most useful is to add networks, which uses the -addpreferredwirelessnetworkatindex option. You would follow this with the hardwareport, then the network, then the index number you’d like it to be assigned to (or 0 if you don’t know) and then the security type of the wireless network (OPEN, WEP, WPA, WPA2, WPAE or WPA2E). For example, to add a network called drpepper that is a wide open network:

networksetup -addpreferredwirelessnetworkatindex AirPort drpepper 0 NONE

Or, if it was WPA with a password set to thedrisin:

networksetup -addpreferredwirelessnetworkatindex AirPort drpepper 0 WPA thedrisin

Note: For a new image I prefer to begin with 0 and then work my way up numerically when adding networks into the list.

September 21st, 2010

Posted In: Mac OS X, Mass Deployment

Tags: , , , , , , , , , , , ,

From time to time we will end up writing shell scripts that do a number of tasks with airport interfaces in Mac OS X, including automatically detecting networks and disabling the card based on TCP/IP settings/location, querying signal strength for positioning of WAPs and joining specific wireless networks.  As such, a couple of commands keep coming up, since the airport card in a Mac can be controlled in a number of ways from the command line.  First and foremost – it can be enabled and disabled using the networksetup command, located in /usr/sbin.  The option to use with the command is -setairportpower which is boolean as on or off.  So to turn the airport on you would use the following command:

networksetup -setairportpower on

Or to turn it off you would use the following command:

networksetup -setairportpower off

If you want to know, from the command line, whether or not the airport is enabled, you can use the following command:

networksetup -getairportpower

Aside from controlling the status of whether the airport card is enabled and querying for whether or not it is enabled, you can also use networksetup to set the wireless network that the airport card joins.  This is done using the -setairportnetwork option, followed by the name of the network and then the password to be used.  For example, if you have a network called nightcrawler with a password of Password1 then you can use the following command to join that network:

networksetup -setairportnetwork nightcrawler Password1

If you would like to simply obtain information about which wireless network that a system has been joined to you can use the -getairportnetwork option with networksetup.  

In addition to setting up the airport network, you can also do a variety of tasks with enabling the network service, disabling, naming and controlling settings (including TCP/IP settings) for the network service, which I explained how to do in this article over on Xsanity.  

There are also commands that can help with troubleshooting wireless networking issues included with Mac OS X.  One of the most helpful is the airport command itself, located in the /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources directory.  Since you know how to join a wireless network using networksetup, as described earlier in this article, you might next want to go ahead and figure out the wireless networks available to your computer.  You can use the airport command for this.  Simply run it with the -s option, which should show output similar to the following:

 

SSID BSSID             RSSI CHANNEL SECURITY (auth/unicast/group)

crappywireless 00:15:05:35:92:4d -36  9       NONE

 City of Minneapolis Public WiFi 00:0d:67:0a:a4:d3 -69  6       NONE

 

One thing to note about the above output is that RSSI (signal strength) is listed here, as well as the channel that the wireless network is using.  Channels should be as unique as possible, and looking at this information can be a great and quick way to determine if you have another network with the same channel nearby.  Unless you hack your neighbors wireless network then it’s likely easiest to just change your own.  However, if you do change yours and you’re using WDS then prepare to have a broken WDS…

Another of the most basic tasks this command can fulfill is the ability to simply report statistics about the 802.11 card.  This can be done by using the -I option, for example:

airport -I

This command provides a ton of feedback, seen as follows:

 

agrCtlRSSI: -39

agrExtRSSI: 0

agrCtlNoise: -99

agrExtNoise: 0

state: running

op mode: station 

lastTxRate: 130

maxRate: 130

lastAssocStatus: 0

802.11 auth: open

link auth: wpa2-psk

BSSID: 0:1b:63:2a:ef:e6

SSID: shadowcat

MCS: 15

channel: 2

The first two indicators represent the RSSI.  RSSI refers to the Received Signal Strength Indication, or the amount of juice the radio signal actually has.  Next is the amount of noise.  The more noise in the radio signal, the more static it would provide if it were audio, so it’s safe to assume this means the more dropped packets, or packet collisions during transmission.  Next, state is fairly self explanatory and then op mode, which describes whether you’re subscribed to a wireless network or have created your own.  This is followed by rate, or the speed with which the connection can allow (for example, if the value here is 54 then it’s 802.11g).  Following that is whether the 802.11 network requires auth and if so what form of auth is required.  Next the base station ID (BSSID), which is the number printed on the bottom of the airport itself (for most models).  Next, the SSID, or name of the wireless network that you’re joined to (keep in mind SSIDs can be suppressed).  Finally, there is the channel of the network you’re currently joined to.

You can also use the -c option to set the channel on a card, which I have rarely done.  While I typically use networksetup to join networks, you can also join a network using the airport command, followed by the -A option and the –bssid (base station ID) and –password for the password.  In order to aid in scripting Airport information for graphs and things of that nature, the -r option can be used to set the number of times that the command will run in a loop.  Finally, you can use the -z option to simply unjoin a network.

Finally, for those who will be deploying airport settings en masse, you’ll be interested to know that you can also edit the plist files directly, with information about wireless networks tracked in /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist.  The passwords to join said networks, which are stored in the file as password IDs are then housed in the system keychain.  Network configuration for those same interfaces are configureable by editing com.apple.network.identification.plist in /Library/Preferences/SystemConfiguration.

March 12th, 2009

Posted In: Mac OS X, Mass Deployment

Tags: , , ,

Let’s face it: all the airlines suck now.  When my grandfather was with the airlines things were different (I think).  But, the worst thing that an airline can do isn’t to carve out an inch of your space every year (some day we’ll be rack mounted in the plane – are you a 1U, 2U or 4U box?).  The worst thing they do is being late.  Which in turn makes us late for jobs, or more painful to the ‘ole heartstrings late to get home to the family.  Not that airline execs have heartstrings – look at how they treat their own unionized employees…  Anyway, some of my own tips (whether I choose to follow them or not) at keeping out of the delayed column on flights… 

Fly early.  I know, I know, it turns out you would probably rather fly later in the day, but when have you had delayed flights in the morning that weren’t mechanical? This is the single biggest thing you can do though to keep with on-time flights

Connections.  Well, just don’t it when you can avoid it (non-stop when possible), and when you can’t avoid it, one hour is the rule between.  A wasted hour indeed though, if you could have gotten the non-stop flight for $20 more…  But if you try and squeeze out an extra 20 minutes and only give yourself 40 minutes it’s just a matter of time before you find yourself on standby for a later flight ’cause you missed your lay-over.

Go online.  Check the flight status on the airline’s website or using the Flight Status Dashboard widget.  I kinda’ like this one: http://www.apple.com/downloads/dashboard/travel/flightontime.html

Avoid Bad airports.  When possible, I’d rather fly into Burbank than LAX.  Or Oakland over SFO.  Bad airports mean delays.  But in a lot of cities, you might have a choice.  Pick one in DC and you’re likely to get delayed (in the top 10 for delays), pick the other and you’re in the top ten for on-time.  Go figure.  Of course, in New York you’re just screwed, sorry…

Carry on when possible.  This helps save a little money too, but even though I know I should – I never do.  I just want to check my bag and not deal with it until I get to my destination.  Having said that I find myself kicking myself in the butt a little for checking my bag when I’m waiting for a half an hour at the carousel for it to spit out my poor, further tattered Victorinix (or I think it was at some point) bag with the little UGA football helmet on it to make it easily identifiable.

Know the airline.  Some will just always be late.  But it’s different per airport.  NorthWest is almost always on time in Minneapolis, but almost always late in Los Angeles.  Delta is typically on time in Atlanta but always late in Minneapolis.  Not sure what else to say here.  I haven’t flown much on Jet Blue but I hear that while they’re pretty bad these days, they give you free vouchers to say sorry.  

Know the weather.  Aw shucks, it probably doesn’t matter much.  But if you’ve got 1 inch of snow in Atlanta I can bet that flight is gonna’ get delayed whereas 10 inches of snow in Minneapolis and not only is school still gonna’ happen, but that flight is still taking off.  Not that it’s just about snow.  If it’s a little bit foggy at LAX you might get delayed whereas if the fog’s thicker than Pea Soup Anderson’s pea soup the pilots at SFO are still getting out out of there (albeit maybe not on time, but you’re still in the air at some point).

So, you’ve done everything you can do but now you find yourself waiting for an hour for a flight, just to sit on the tarmac for another hour and then get back off the plane, switch to another plane (where you have to sit between someone with serious BO and someone with wayyyy too much body hair) then get home about 8 hours late.  Well, at this point you absolutely have to either call or write.  If you’re in the mileage program for the airline then your worst case is a bucket of miles – but you might get a free ticket out of it or at least a voucher you can use towards a future ticket.  But very few (er, Sun Country) will basically tell you to give it up and leave you with nothin’ for your troubles (did I mention Sun Country).

June 26th, 2007

Posted In: On the Road

Tags: , , , , , ,

Find their meaning below:

http://support.apple.com/kb/HT2610

April 16th, 2007

Posted In: Mac OS X, Network Infrastructure

Tags: , , ,

I originally posted this at http://www.318.com/TechJournal

Wireless networks use high frequency radio signals to connect computers to each other and to shared-resources for the transmission of data such as files, images or connection to the internet. This type of network is known as a Wireless Local Area Network (WLAN).
Wireless networks offer most of the same ability as a traditional wired LAN. If your wired network has the ability to access the Internet today, then your wireless LAN will be able to as well.
A wireless LAN typically consists of two components; a wireless network card and an access point. The access point serves as an aggregate point for all wireless LAN communications within it’s range.
The access point connects to a traditional wired LAN to provide access to existing applications and services. Each computer with a wireless network card can roam about freely within the range of the access point and have connectivity to other wired and wireless resources through the access-point.
In larger environments multiple access points are deployed to provide greater coverage throughout a floor or entire building. This gives complete mobility for any number of devices. In this situation connectivity is maintained uninterrupted from one access point to another. This is referred to as roaming and is analogous to cellular phone service we use today.
Using technology based on the 802.11a, 802.11b, or 802.11g industry standards, we can design your network to support data rates from 11 Mbps to 54 Mbps with maximum throughput.
An access point when paired with a wireless network card provides wireless network communications. It’s closest equivalent in the wired LAN is a hub or switch.
Although access points typically transmit signal from 100 meters to 300 meters, when combined with advanced antenna designs we can implement your network to support ranges as far out as ½ mile (or greater). Conditions like the composition of walls, antenna placement and other variables play a role in this effective distance.
Ad hoc is a mode of operation which allows computers to communicate wirelessly amongst themselves without an access point.
It’s generally recommended to always have an access point when more than two computers need to communicate to each other wireless or when connectivity to a wired LAN is required.
This varies significantly from one manufactures’ access point to another but a practical estimate is 15 to 20 users per access point.
Three18 delivers solutions based on the 802.11b, 802.11a, or 802.11g standards. This technology is not only cost effective but also provides excellent performance. The definitions for these standards are as follows:
802.11b
IEEE 802.11b is a technical specification issued by the Institute of Electrical and Electronic Engineers (IEEE) that defines the operation of 2.4 GHz, 11 Mbps, Direct Sequence Spread Spectrum Wireless Local Area Networks (WLANs). The 802.11b standard ensures that all wireless Ethernet products built to this standard are compatible.
802.11g
IEEE 802.11g is a technical specification issued by the Institute of Electrical and Electronic Engineers (IEEE) that defines the operation of 2.4 GHz, 54 Mbps, Direct Sequence Spread Spectrum Wireless Local Area Networks (WLANs). The 802.11g standard ensures that all wireless Ethernet products built to this standard are compatible and backwards compatible with 802.11b.
802.11a
IEEE 802.11a is a technical specification issued by the Institute of Electrical and Electronic Engineers (IEEE) that defines the operation of 5 GHz, 53 Mbps, Direct Sequence Spread Spectrum Wireless Local Area Networks (WLANs). The 802.11g standard ensures that all wireless Ethernet products built to this standard are compatible and will co-exists with other wireless specifications.
Solutions deployed by Three18 integrate the highest levels of security for protecting student grades, test scores, attendance records, or sensitive administrative files. In addition to the standard wireless security options such as 128-bit data encryption and MAC address filtering, our solutions include National Institute of Standards and Technology (NIST) certified wireless security techniques that are currently being used by the Department of Defense wireless networks.
This varies from one manufacture to the other but in general you can expect that all major operation systems are supported (i.e. Microsoft Windows 98, ME, 2000 Professional & Server, Mac OS, Linux, etc.)
It is possible today to build an entire network based on wireless technology. But in most cases an environment will have an existing wired LAN that they will wish to extend via wireless to leverage some of it’s advantages. Over time there should be a shift to more exclusively wireless LANs.
802.11a /802.11g are IEEE standards for faster and more capable wireless LANs. The answer to this question depends on the applications that you want to run over the network and whether there is an existing 802.11b network in place. Applications that require higher data rates such as video streaming would operate more efficiently on 802.11a and 802.11g networks. If you have an existing 802.11b network in place there are interoperability issues that must be considered.
For 802.11g networks, there are no limitations with existing networks since both operate on the same 2.4 GHz radio frequency. This is the main advantage of using 802.11g.
Since 802.11a networks transmit signals over a 5 GHz frequency, 802.11b clients will not communicate with 802.11a access points and vice versa. The good news is that the technology providers have begun offering “dual band client cards” so that end-users can roam between the different network implementations.
Bluetooth is a 1 Mbps technology designed for low cost and low power to connect personal devices such as cell phones, PDA’s, notebooks and other personal devices. 802.11b is a full LAN connectivity solution, designed to provide full network services at Ethernet data rates. 802.11b and Bluetooth both operate in the 2.4 GHz frequency range using different types of spread spectrum technology.
The Wireless Ethernet Compatibility Alliance (WECCA) was established in 1999 to certify interoperability of Wi-Fi (IEEE 802.11) products and to promote Wi-Fi as the global wireless LAN standard across all market segments.
Wi-Fi is an certification for 802.11b devices. All current product offerings are certified by WECA for Wi-Fi compliance in order to insure seamless interoperability with other manufacturers products.

A wireless network provides fast and flexible access to centralized content for applications particular to their environments. With this technology, organizations can establish network connectivity anywhere within the designed coverage area including conference rooms, offices, outdoor structures, and difficult to reach locations. Organizations can achieve gains in productivity by utilizing mobilized computers for real time applications such as data entry, inventory control, attendance, and etc. A wireless network infrastructure can also offer cost advantages over traditional wired systems through the elimination of the need to run expensive conduits and cable.

October 6th, 2006

Posted In: Mac OS X, Mac Security, Network Infrastructure, Windows XP

Tags: , , , , ,