Possible: Different manual TCP/IP settings for different networks?

Discussion in 'macOS' started by samh, Jan 10, 2011.

  1. samh macrumors 6502

    Oct 29, 2009
    Here's what I'm after:

    I want to avoid getting my TCP/IP settings by DHCP at work and home, but the networks are different (one is a 192.168.1.xxx subnet and one is a 192.168.0.xxx subnet) and have different gateways and DNS servers. Is there any way for OS X to automatically apply these, without me manually selecting a profile from network settings?

    i.e. when I connect to WorkWiFi, OSX assigns an IP Address, DHCP, DNS server, etc. When I go home and connect to MyHomeWiFi, OSX assigns a different IP Address, DHCP, DNS, etc.?
  2. belvdr macrumors 603

    Aug 15, 2005
    Not sure why you would want this headache when you have DHCP, but I think Locations will do what you want.
  3. zorinlynx macrumors 601


    May 31, 2007
    Florida, USA
    My curiosity is piqued, exactly why do you want to avoid DHCP?
  4. calderone macrumors 68040


    Aug 28, 2009
    Notice, the OP wants to do it without selecting a profile. Suggesting the OP is already using Locations.

    To answer the question, there is nothing built in to automatically switch. But you could easily write something to handle the switching of the profile for you.

    1. Create a launchd job. Something like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    <plist version="1.0">
    2. The script needs to be written to detect certain variables which it can then use to determine the location and then perform actions based on that location.

    For example, listing available WiFi networks and selecting a network location based on what it determines (this can be done with scselect).

    This is an explanation at a pretty high level, it assumes you know how to write scripts as well as how to work with launchd. Hopefully this sets you in the right direction.
  5. samh thread starter macrumors 6502

    Oct 29, 2009
    That gives me something to explore. I'm still relatively new to the mac world (14 months) after a lifetime in Windows, but I have IT and programming experience and I'm sure I can work something out.

    I will likely just use DHCP reservations to accomplish this but wanted to see if there was something easy on the client end. I think Windows 7 can do something like this, but I may not be entirely correct on that.

    One reason for my question is that our DHCP server at work assigns a particular set of DNS servers (belonging to our ISP). When I'm at work, my MBP plays better on the network if I assign our Domain Controller as the DNS server. However, during certain weeks of the year we have 100 or more clients on the network and network congestion suffers if everybody is hitting the internal server for DNS. I don't want DHCP assigning the internal DNS server to all clients, but I want it assigned to me. However, when I go home, that IP address is not a valid DNS server. I do not want to be shuffling between profiles--especially if, say, my wife pulls the MBP out and I haven't switched it over.

    Windows server will allow me to make the reservation on the server end and that's good enough until I can figure out the launchd script.

Share This Page