Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create the illusion that Bonjour works over a VPN Network
If you're a Mac user who often uses VPN connections, you'll notice one very disappointing thing about connecting to your corporate or personal network over such tunneled connections: typically, Bonjour-style addresses (such as computer-name.local) don't work. This is because multicast DNS (or mDNS) doesn't work over a tunnel. Though there are ways to get it functional, they are pretty complicated and require that you have a lot of esoteric networking knowledge.

However, if the services you typically access via Bonjour use static IP addresses, then there is one age-old networking technique you can use to simulate Bonjour-style naming conventions without actually using Bonjour. This, of course, is the /etc/hosts file.

The /etc/hosts file is a simple, static, text-based mapping of computer names to IP addresses. It does exactly what Bonjour does, except it doesn't keep itself up to date when things change. Of course, if you're using static IPs for the services you want access to, you can pretty safely assume that things aren't going to be changing frequently anyway. Long-time sysadmins will laugh at this, but I say let them laugh. This is remarkably useful and very easy to implement.
read more (285 words)   Post a comment  •  Comments (10)  
  • Currently 2.25 / 5
  You rated: 5 / 5 (8 votes cast)
 
[40,019 views] Email Article To a Friend View Printable Version
Use Teleport with VNC for total remote keyboard control Network
One thing I dislike about using most VNC viewers is the inability to use commands like Command-Tab for switching applications, or Command-Space (my Quicksilver shortcut). A previous comment (and this hint) described using Teleport. And others have pointed out a VNC viewer that is built into OS X. This hint simply points out the beauty of combining those two bits of info.

If you use Apple's VNC and Teleport, you can simply drag the mouse off-screen while still viewing your VNC display, and have full keyboard access to the remote machine. Command-tab program switching and launching is a lot easier, as is activation of the Dock if you have it set up to appear when the mouse is dragged off-screen.

Now, if only, copy/paste and drag/drop worked between the machines. Then I'd be totally set.

[robg adds: Using a utility like ClipboardSharing and/or DropCopy can help with drag/drop and copy/paste problems. ClipboardSharing includes an Autosync panel that will automatically sync a clipboard between multiple machines, and DropCopy creates a small drop zone on all machines to make it easy to drag an drop files across the network.]
  Post a comment  •  Comments (8)  
  • Currently 1.50 / 5
  You rated: 1 / 5 (8 votes cast)
 
[16,108 views] Email Article To a Friend View Printable Version
VPN connections in VMware virtual machines Network
VMware Fusion provides two options for the network connections in a virtual machine: direct (Bridged) and by sharing the host's connection (NAT).

I have found that if you want to connect to a VPN from within a virtual machine, you must use the Bridged option. If you want the virtual machine to use the Mac's VPN connection, you must use the NAT option.

I have also found that connecting to the VPN from within a Windows Vista virtual machine on my MacBook Pro running OS X 10.5.2 is not reliable -- the connection frequently drops out. However, if I connect using the host machine (NAT), the virtual machine uses that connection perfectly, and I have had no disconnection issues.
  Post a comment  •  Comments (4)  
  • Currently 2.88 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[37,765 views] Email Article To a Friend View Printable Version
Set MTU value for any interface via AppleScript Network
Sometimes you have to change the Maximum Transmission Unit (MTU) on a network interface in Mac OS X to fix or debug a connection problem. You can dive into the command line using ifconfig:
ifconfig en0 mtu 1458
Or you can change it in the advanced settings of the Ethernet interface, but for other interfaces, you have to use ifconfig. Well, not anymore. Using the following script, you can easily set one or more interfaces to a new MTU value (on both Tiger (10.4) and Leopard (10.5), and possibly on older versions of Mac OS X):
(*
    Set MTU © RickoKid 2008
    Version 0.1

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*)

set resultList to {}
set curMTU to ""
set OSVer to (do shell script "sw_vers -productVersion")
set tigerSupport to false
set legacySupport to false

if OSVer contains "10.4" or OSVer contains "10.3" or OSVer contains "10.2" or OSVer contains "10.1" or OSVer contains "10.1" then
  if OSVer contains "10.4" then
    set tigerSupport to true
  else
    display dialog "This script has only been tested on Mac OS X 10.4 and above.  You may encounter errors and/or crashes in earlier versions of Mac OS X" buttons {"OK"} default button "OK"
    set legacySupport to true
  end if
  
  set interfaceList to {}
  
  repeat with theInterface in words of (do shell script "ifconfig -lu")
    if theInterface contains "lo0" then
      set interfaceList to interfaceList & {"lo0 Loopback"}
    else if theInterface contains "en1" then
      set interfaceList to interfaceList & {"en1 (AirPort?)"}
    else if theInterface contains "en" then
      set interfaceList to interfaceList & {theInterface & " (Ethernet?)"}
    else if theInterface contains "fw" then
      set interfaceList to interfaceList & {theInterface & " (Firewire?)"}
    else
      set interfaceList to interfaceList & {theInterface}
    end if
  end repeat
else
  -- set interfaceList to paragraphs of (do shell script "networksetup -listallhardwareports | grep -e 'Hardware Port:' | sed 's/^.*: //'")
  tell application "System Events" to set interfaceList to name of every interface of network preferences
end if

set chosenInterface to choose from list interfaceList with prompt 
  "Please select the network interface(s) you would like to set the MTU for (or just click OK to select all interfaces):" with title 
  "Select Network Interface" with multiple selections allowed and empty selection allowed
if chosenInterface is not false then -- if something is chosen, but not if cancel is clicked.
  if chosenInterface is {} then set chosenInterface to interfaceList
  if (count of chosenInterface) is not 1 then
    set AppleScript's text item delimiters to return
    set newMTU to text returned of (display dialog "Please enter the new MTU value for these interfaces:" & return & return & chosenInterface with title "Set MTU" default answer curMTU)
  end if
  
  repeat with theInterface in chosenInterface
    if legacySupport or tigerSupport then
      set netid to word 1 of theInterface
    else
      set netid to (do shell script "networksetup -listallhardwareports | grep -A1 'Hardware Port: " & theInterface & "$'| tail -n1| sed 's/^.*: //'")
    end if
    if (count of chosenInterface) is 1 then
      set curMTU to last word of (do shell script "ifconfig " & netid & " |grep mtu")
      set newMTU to text returned of (display dialog "Please enter the new MTU value for " & theInterface & ":" with title "Set MTU" default answer curMTU)
    end if
    
    try
      do shell script "ifconfig " & netid & " mtu " & newMTU with administrator privileges and password
      --set theIP to the result
      set resultList to resultList & {"" & theInterface & ":" & tab & "MTU set to " & newMTU & "."}
    on error errorText
      set resultList to resultList & {"" & theInterface & ":" & tab & "Failed to set MTU."}
      --  display dialog ".  Make sure you are connected to the network via " & theInterface & "." with title "DHCP Lookup failure" buttons {"OK"} cancel button "OK" default button "OK"
    end try
    --  display dialog "" & theInterface & " DHCP server: " & theIP buttons {"OK"} default button "OK" with icon 1
  end repeat
  set AppleScript's text item delimiters to return
  if legacySupport then
    display dialog (resultList as text) with title "Set MTU" buttons {"OK"} default button "OK"
  else
    display alert "Set MTU" as informational message (resultList as text) buttons {"OK"} default button "OK"
  end if
end if
(You can find the original version of this script in this post on my site.) Due to the differences in systems older than Leopard however, the script can't lookup the friendly interface name (Built-in Ethernet, Airport, Firewire, and so on), but lists the interface's UNIX name (en0, en1, fw0, etc). It does make a wild guess at which interface it is though based on the usual assignments.

[robg adds: I haven't tested this one.]
  Post a comment  •  Comments (3)  
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[13,100 views] Email Article To a Friend View Printable Version
10.5: Limit size of Time Machine backups on Time Capsule Network
Many have expressed the desire to partition the internal hard disk in their Time Capsule -- presumably because they wish to limit the amount of space allocated to Time Machine backups. I myself wanted to do this. Thanks to these instructions on the ReadyNAS Community site, I believe I have found a solution that uses their method and builds off of it.

Note: although it is working for me, this is not guaranteed to work, it may contain errors, and it is not for those who are unfamiliar with working in Terminal. I also do not offer tech support -- you're on your own.
read more (462 words)   Post a comment  •  Comments (15)  
  • Currently 2.64 / 5
  You rated: 4 / 5 (11 votes cast)
 
[68,814 views] Email Article To a Friend View Printable Version
Find the source of DHCP-provided addresses via script Network
I often need to know whilst debugging a network connection where my computer has picked up an IP address from, so I can find the IP address of a router, or to make sure there's not a rogue DHCP server on the network and so on. There is no way to find this in the GUI in Mac OS X, although it is available via ipconfig on the command line:
ipconfig getoption en0 server_identifier
Needless to say, I can never remember the parameters for it, so I wrote an AppleScript to automate the process. With the script, you can also get the DHCP server for multiple interfaces at once as well. Here's the code:
(*
    DHCP Server Lookup © RickoKid 2008
    Version 0.1
  
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*)

set resultList to {}
set DNSlookup to ""
set OSVer to (do shell script "sw_vers -productVersion")
set tigerSupport to false
set legacySupport to false

if OSVer contains "10.4" or OSVer contains "10.3" or OSVer contains "10.2" or OSVer contains "10.1" or OSVer contains "10.1" then
  if OSVer contains "10.4" then
    set tigerSupport to true
  else
    display dialog "This script has only been tested on Mac OS X 10.4 and above.  You may encounter errors and/or crashes in earlier versions of Mac OS X" buttons {"OK"} default button "OK"
    set legacySupport to true
  end if
  
  set interfaceList to {}
  
  repeat with theInterface in words of (do shell script "ifconfig -lu")
    if theInterface contains "lo0" then
      set interfaceList to interfaceList & {"lo0 Loopback"}
    else if theInterface contains "en1" then
      set interfaceList to interfaceList & {"en1 (AirPort?)"}
    else if theInterface contains "en" then
      set interfaceList to interfaceList & {theInterface & " (Ethernet?)"}
    else if theInterface contains "fw" then
      set interfaceList to interfaceList & {theInterface & " (Firewire?)"}
    else
      set interfaceList to interfaceList & {theInterface}
    end if
  end repeat
else
  -- set interfaceList to paragraphs of (do shell script "networksetup -listallhardwareports | grep -e 'Hardware Port:' | sed 's/^.*: //'")
  tell application "System Events" to set interfaceList to name of every interface of network preferences
end if

set chosenInterface to choose from list interfaceList with prompt 
  "Please select the network interface(s) you would like the DHCP server address for (or just click OK to select all interfaces):" with title 
  "Select Network Interface" with multiple selections allowed and empty selection allowed
if chosenInterface is not false then --                      if something is chosen, but not if cancel is clicked.
  if chosenInterface is {} then set chosenInterface to interfaceList
  repeat with theInterface in chosenInterface
    if legacySupport or tigerSupport then
      set netid to word 1 of theInterface
    else
      set netid to (do shell script "networksetup -listallhardwareports | grep -A1 'Hardware Port: " & theInterface & "$'| tail -n1| sed 's/^.*: //'")
    end if
    
    try
      set theIP to (do shell script "ipconfig getoption " & netid & " server_identifier")
      --    set DNSlookup to " (" & (do shell script "nslookup " & theIP & " | grep name| sed 's/.*name = //'") & ")"
      set resultList to resultList & {"" & theInterface & ":" & tab & theIP & DNSlookup}
    on error errorText --                           Not connected or some other error
      set resultList to resultList & {"" & theInterface & ":" & tab & "-"}
    end try
  end repeat
  set AppleScript's text item delimiters to return
  if legacySupport then
    display dialog (resultList as text) with title "DHCP Server Lookup" buttons {"OK"} default button "OK"
  else
    display alert "DHCP Server Lookup" as informational message (resultList as text) buttons {"OK"} default button "OK"
  end if
end if
I've tested it on Tiger (10.4) and Leopard (10.5), but it may work on older versions of Mac OS X, too. Due to the differences in systems older than Leopard however, the script can't look up the friendly interface name (Built-in Ethernet, AirPort, Firewire and so on), but lists the interface UNIX name (en0, en1, fw0 etc). It does make a wild guess at which interface it is, though, based on the usual assignments.

You can copy and paste the above into Script Editor and save it as an application, or download a ready-to-use version from this post on my site.

[robg adds: This script worked as described when I tested it.]
  Post a comment  •  Comments (10)  
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[13,088 views] Email Article To a Friend View Printable Version
Enter hex password in AirPort connection dialog Network
If you hold down the option key while selecting a secure wireless network (WPA only) from the AirPort menu bar icon, the system brings up a different dialog box. Instead of asking for the ASCII password, it lets you enter a hexadecimal password (noting you need exactly 64 characters) instead.

[robg adds: This worked for me in 10.5, but I'm not sure if if works in 10.4 as well, as my 10.4 test system isn't AirPort equipped.]
  Post a comment  •  Comments (7)  
  • Currently 1.57 / 5
  You rated: 1 / 5 (7 votes cast)
 
[10,172 views] Email Article To a Friend View Printable Version
One way to quit ARD on a remote Mac via a local ARD Network
In some LAN configurations, there may be more than one Mac used to manage the others using Apple Remote Desktop. These may be physically separated by some distance. In such a situation, you may need to take control of one of the managing Macs from the other. But Remote Desktop won't let you control or view another Mac that is already running Remote Desktop.

If you can ssh to that Mac, you can manually quit the program from the command line. If that Mac's settings allow other VNC clients to connect to it, you can also do that. But if those options aren't available, here's a simple trick to quit the remote Remote Desktop. Create an AppleScript with the following code:
tell application "Remote Desktop"
  quit
end tell
Save it as an application, and test it locally. Then select the remote Mac from ARD's clients list and then Manage » Open Application. After ARD has grabbed the list of remote applications to pick from, click the + icon below the list and select your local AppleScript application.

The script is sent to the remote Mac and executed, quitting Remote Desktop there. You can now take control of that Mac as normal.
  Post a comment  •  Comments (4)  
  • Currently 1.29 / 5
  You rated: 3 / 5 (7 votes cast)
 
[8,928 views] Email Article To a Friend View Printable Version
Avoid spinning cursors on network volume disconnect Network
Before a network volume disconnects -- or prompts you to disconnect -- you're likely to have a period of anywhere from a few seconds to a few minutes where wheels of death start popping in your running applications. At first you think something bad is happening, and then you get the notice that a network volume can no longer be found. I still don't understand why this can't be fixed.

In the meantime, turning off your airport from the menu bar (assuming you're connected wirelessly) speeds up the process dramatically. As soon as you suspect you're having the problem, turn it off. You'll get the disconnect from volume box and then you can turn it right back on and continue.

Not a fix exactly, but it helps!

[robg adds: This used to be really bad in 10.4, but with 10.5, I haven't noticed many problems with disconnected shares causing issues in apps on machines that were connected to those shares.]
  Post a comment  •  Comments (4)  
  • Currently 1.71 / 5
  You rated: 5 / 5 (7 votes cast)
 
[6,389 views] Email Article To a Friend View Printable Version
A simple way to set up a basic workgroup file server Network
Over the years, we've run a number of hints detailing solutions to a seemingly simple issue: how to set up a Mac as a shared file server for a workgroup, such that multiple users can create, modify, and delete files and folders on that machine. (There are permissions issues related to users modifying files and folders created by other users.) The solutions I've linked to here all solve the problem in one way or another, and do so with some measure of security remaining in place.

Last weekend, though, while browsing the Macworld forums, I came across a post that contained an amazingly easy alternative solution -- one that inspired one of those "D'oh! Why didn't I think of that?" reactions. On the machine that you want to use as the shared file server (it could be a standalone Mac, or even another user's Mac, if the group is small and the workload not too heavy), create a new non-adminstrative account (name it Workgroup or whatever). Login to the new account, and create the folder structure you'd like the users to see, and copy any files to the server that the users will need to access.

As the last step, share the login name and password for that account with the users in the workgroup. Set up each member of the workgroup to connect to the shared Mac using the special shared account, and you won't have any permissions issues at all -- since everyone will be logged in as the same user, everyone will be able to create, delete, and modify files at will.

There are obviously some downsides to this method. There's no ability to see which files and folders were created or modified by which users. If someone leaves the group, you'll probably want to change the account's password, which will require redoing the connections for the other users. You can't implement fine levels of control over which workgroup users can modify which files and folders. I'm sure there are more downsides, but for a workgroup with simple sharing needs, this solution should work just fine. Or have I overlooked some major issue that would prevent this from being a viable simple file server solution?
  Post a comment  •  Comments (10)  
  • Currently 1.83 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[11,165 views] Email Article To a Friend View Printable Version