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!
krypted August 26th, 2016
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).
krypted July 20th, 2011
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.
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.
krypted September 21st, 2010
Tags: addpreferredwirelessnetworkatindex, airport, deploy network settings, hardwarereport, listpreferredwirelessnetworks, Mac OS X, networksetup, push out wireless networks, removepreferredwirelessnetwork, script, wpa, wpa2, wpa2 enterprise
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:
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:
This command provides a ton of feedback, seen as follows:
op mode: station
802.11 auth: open
link auth: wpa2-psk
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.
krypted March 12th, 2009
Find their meaning below:
krypted April 16th, 2007
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:
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.
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.
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.
krypted October 6th, 2006