If, like me, you use Parallels Desktop a lot on for-pay access points, or otherwise locked-down networks, where adding an additional MAC address to the same wireless card might cause problems, then this hint is for you.
A sign that you're having an issue is that you get the T-mobile authentication page, or none of the networks inside your Parallels virtual machines seem to work. You'll also note that the systems seem to be on the same subnet, e.g. 10.254.x.x.
The solution that I've found works is to go into Parallels' network configuration section, and tell it to bind to en0. Then go into the Sharing pane in OS X's System Preferences and tell it to share from AirPort to Ethernet. This has the effect of setting up NAT to your en0 interface, and Parallels hooks into that to get internet access. Since everything is masqueraded through your airport (en1) interface, it magically works.
Here's my setup: on my ethernet LAN, I have my mini, my Xbox, and a Windows PC; on my wifi LAN, I have my mini, my internet router, and two other Macs. So I was looking for something that I would install on my mini so that my router would be accessible to my Xbox and Windows PC, and that would allow me to connect to those two from any Mac. Basically, I needed to bridge my ethernet and wifi LAN using Mac OS X.
Possible solutions:
Use an Airport Express. Easy (simply configure the ethernet port with a static IP and disable all other features to have it bridge ethernet/wifi traffic), but not that cheap...
Use IPNetRouterX. It looked easy to use, but I didn't really like the idea of forking over US$100 for a proprietary piece of software.
Find some way to configure Mac OS X built-in ipfw/natd to do it.
I searched the web here and there, and nobody seemed to have done something similar.
Many devices connected to the network have an SNMP agent running that can give out some information about said device. This information can be accessed from the command line, but the commands are not really user-friendly.
So I have written a small CGI script that displays basic SNMP information in a web page. To use the script, simply install it into /Library -> WebServer -> CGI-Executables/ and access it using the local web server. The linked web page explains how to install the script.
[robg adds: To run the script, just make sure that Web Sharing is active, then enter http://127.0.0.1/cgi-bin/hostinfo in your browser's URL bar. I tested it, and it seems to work (though none of the machines on my network return any interesting info). I've also mirrored the file on macosxhints.com, in case the source vanishes someday.]
So you want to know how many days until your password expires in Active Directory (AD)? Here's the meat of the code you can run on any AD-bound OS X box, so long as your shortname is the same as the AD name:
I've created a 28KB zip file (ADexpire.zip; Hints mirror) that contains adexpirre.sh, adexpire.php, and adexpire.scpt (and application version) for client/server setup (with code comments). This works for the situation many are in at my work: their machines aren't bound to AD and they don't often log into the file services on an AD server to find out their password expiration! This allows one server to field queries and return a value via http to an AppleScript that runs as a login item.
Hopefully this will help someone else and even better; maybe someone way smarter than me does it in five lines in Perl! ;) Looking forward to the comments and revisions.
If, like me, you connect to many different networks (I'm a network consultant), then you probably find OS X's ability to create different locations a most useful tool. But how to back them up to reinstall or tranfer to a new machine? After a long search, eureka! They're all in one single file:
I have a machine at work and one at home (common problem, yes?) and I want to access the one at work from home via VNC. Well, to properly use that I need to login to the VPN and then login to the remote machine -- but I need to know the IP address, and since we use dynamic addressing, you know the rest.
I saw a whole bunch of scripts here for how to have your PowerBook phone home, but they didn't cut it -- too complex and ultimately not what I needed. So I made this simple script:
#!/bin/sh
#Script name: writeip
#
# Get my Ethernet Adapter IP Address
# And write it to a file
#
ipconfig getifaddr en0 > ~/Desktop/IP.txt
#
# Copy that file to my iDisk
#
cp ~/Desktop/IP.txt /Volumes/<idiskname>/Documents/IP.txt
If I make sure that my iDisk is set to automatically mount on login (using login items you can select a volume to automatically mount), then this script will get my IP address, write it to a file, then copy that file to my iDisk. Simple enough for what I needed. I then set up cron (using Cronnix) to run the script hourly to make sure my IP is current.
[robg adds: Note that this method will return the machine's internal IP address, which won't be its public IP address if you're using a router, for example. Since the author is first connecting to a VPN, this works, as he can then access the machine via its internal IP. If you need the remote machine's public IP (if you're connecting from work to home, for instance, and you have a router at the house), then you'll need to use one of these hints.]
If you and the person you want to iChat to are both behind NATs, you could forward the ports at one or both ends (5060, 5190, 5297, 5298, 5678, 16384-16403). But what if both ends are unable to forward these ports (maybe it's not your network, or you can't) -- you wouldn't be able to iChat.
However, Hamachi supports Bonjour properly, and has an OS X version. If both of you fire up Hamachi, you can use iChat's Bonjour features to chat between you and the other person, over the internet, with audio and video chat. The disadvantage is that the CPU load may be a fair bit higher due to Hamachi's tunneling overhead. It works great for me -- I've done it, doing audio chats on a 12" 1.33GHZ PowerBook G4 to someone on a 1.0GHZ 12" PowerBook, and not noticed any system slowdown.
Is this a hint? It's not obvious to most others -- whenever I suggest it to someone else, I get a strange look from them as if it's a long way round, and usually get told it's not going to work. But it does, and does well.
I have saved a lot of time by using the dual homing cpabilities of OS X - that is, its ability to connect to two networks at the same time. My home network uses a DSL connection and all the printers are wireless, but I prefer a wired cable modem connection when I am at my desk. OS X happily connects me to the internet at the faster cable modem speed, but allows me to print over the AirPort connection to my home network printers.
In my previous occupation, I was able to work on both the office network and through a wireless internet link; the OS just found what I needed on whatever network was required. No muss, no fuss, and no juggling of connections. I am set up to connect automatically to available networks, although AirPort does ask before joining any untrusted access points.
[robg adds: Though not exactly a hint in and of itself, not everyone may know that OS X can use two network connections at once, so I thought it worth publishing this...]
To quickly open an ssh connection from nearly anywhere on your Mac, do the following:
Open TextEdit and type in your connection string in the form of: ssh://user@host.com
Select the whole line and drag and drop it on the Desktop. The result will be a *.inetloc file.
Move the file to any folder you like. I made one named ~/connections that holds all of my *.inetloc files. You can rename this file to whatever you like, and even change its icon.
Now you can drag and drop the *.inetloc file to the Dock, the Finder's Sidebar or Tool bar, or to anywhere else. (It can even be selected with Spotlight)
If you use LaunchBar, open the Launchbar Configuration screen (Command-Y) and add another rule for your connections folder. Now your SSH connections can be opened with LaunchBar. I believe you can do similar with LaunchBar and Quicksilver, enabling quick launching of your SSH shortcuts.
[robg adds: This doesn't seem to work for a few of my sites, which use the domain in the username -- i.e. my command would look like this: ssh://robg@mydomain.com@www.mydomain.com. The dual @ signs seem to confuse the ssh command, resulting in an incorrect command format: ssh mydomain.com@www.mydomain.com. For my domains that don't use this format, however, this trick works quite well.]
At our office, we have a mixed work environment of Windows and OS X machine. On Windows, you can mount network drives to common directories. For instance P: will take you to //network/pc05/projectsFolder. You can create an alias on OS X to a directory inside a mounted drive, such as this one...
//network/pc05/projectsFolder/project1
...but I haven't been able to create an alias to the shared folder itself (//network/pc05/projectsFolder).
I have tried to go to the /Volumes directory after mounting the folder and creating an alias from the mounted directory, but this doesn't always work, I don't know why, but sometimes I lose write priveliges if using that alias.
I just found out that if you create an alias to a directory, as in the project1 folder above, you can then use the Get Info (Command-I) command on the alias (with the network drive mounted). Click the Select new original button, and it will let you select the actual directory for the alias (//network/pc05/projectsFolder).
Then you just have to change the name of the alias to projectsFolder, and you have the equivalent of a mounted drive alias. I even created a folder, myNetwork, where I keep the all the aliases. Just put it on the Finder's sidebar, and you can quickly mount your network directories.