Switching from DHCP and static IP address automatically

At work I have to connect using a static IP address. At home and pretty much everywhere else I use DHCP. I have setup different locations in the network control panel and switch manually every time I connect at the office or somewhere else. My iPhone on the other hand switches settings automatically because the settings are tied to the network you are connecting to. Is it possible to have my Mac switch from DHCP to static IP automatically based on the network found?

15" Mac Book Pro Mid 2010, Mac OS X (10.6.3)

Posted on Jun 14, 2010 10:23 AM

Reply
5 replies

Jun 14, 2010 11:16 AM in response to SolracFB

You could try utilities such as Marco Polo <http://www.versiontracker.com/dyn/moreinfo/macosx/32979>, or Location X which will automatically switch between network locations based on where you are.

There is also a roll your own script available in MacOSXHints.com that uses SleepWatcher.

At this point in time, I do not know of any built-in Mac OS X network location switching capability.

Jun 14, 2010 11:35 AM in response to BobHarris

The 'network' pref panel has a setting Locations..."automatic" is that for something else? I have exactly the same situation as the OP but my work connection is wired and everywhere else is pretty much wifi. I have service order set for ethernet first and airport second and location as 'automatic' I have not had the need to switch locations or needed any utility for this. Perhaps I am off track compared to the OP? Will be happy to know the difference. Thanks.

Jun 14, 2010 12:11 PM in response to Meherally

Location: Automatic, is just a Network Location setup for DHCP, which means it just gets its IP address, network mask, router address, and DNS server addresses from the local DHCP server.

In your situation, if one location is always ethernet, and the other location is aways WiFi, then you could create a location where the Airport interface obtained it IP address via DHCP, and the ethernet interface used a fixed IP address, assuming that was your goal.

But if you are WiFi at both locations, or both locations are ethernet that would not work.

Personally, at home I use the same fixed IP address assigned to both my WiFi and Ethernet interfaces with ethernet being set higher in the food chain. If at home I'm transferring a large file, and decide I need a faster interface, I just walk my MacBook over to the ethernet switch, and plug in an ethernet cable. The MacBook automagically switches over to the faster gigabit ethernet interface without loosing anything on the in-progress file copy. I can unplug the ethernet cable and it will automatically switch back to WiFi. This is because I'm using the same IP address on both ethernet and WiFi interfaces so the copy operation which is at a higher layer in the TCP/IP stack does not notice the change in low level interface. If I had different IP addresses, then my file transfer would break when I switched interfaces.

Jun 14, 2010 2:14 PM in response to BobHarris

Both are WiFi. Which gave me the idea of creating a new Airport service. I now have two Airport services in the left side of the Network preference pane, one is configured with the static IP, the other is configured with DHCP. Right now it is working with the static IP, I have to try it when I get home, but I don't have high expectations, since the list of known networks seems to be shared between both Airport services, so I don't see any way the service would be tied to a specific network. I am using the Automatic location by the way.

This is frustrating because it is very simple and logical to setup on the iPhone, and it baffles me that it seems that it cannot be done on the Mac without using third party software.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Switching from DHCP and static IP address automatically

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.