Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ChangeIPAddress.command





On Wed, Jul 23, 2008 at 9:21 AM, Stewart Lawler <email@hidden> wrote:

On 24/07/2008, at 1:42 AM, Ansgar Wiechers wrote:

On 2008-07-23 Simon Slavin wrote:
OS X Server (not the client) has more  than 30 net-facing packages,
each of which expect to find the  computer's current IP address in a
different configuration file.

I suppose there's some very good reason for all those packages to not
read the IP address from /L/P/SystemConfiguration/preferences.plist and
I just fail to understand it ...


For a start I'm speculating that at least the FOSS-based stuff (openldap, apache, etc) would need too much modification to do that as historically they've relied on directives in their own syntax in their own config files in /etc and so on. If the hour wasn't quite the hour it is and my grasp of python a bit less casual than it is I'd just open up the changeip script and check it out.. I'll bet all is revealed within anyway.

FWIW, i just used changeip on a (10.5.4) box to change the hostname only, not the IP, and even that was a bit ... meh. Box is only running AFP & OD at this point (bound to AD so i unbound first of course) and it all seemed to run without complaint -- but then after restarting i still had to change the name in System Prefs->Sharing by myself. What's with that eh? (no you don't have to answer that :-)

..S.



----
: Stewart Lawler
: Computer Systems Engineer 
: Technical Resource Centre
: Faculty of Arts & Social Sciences 
: University of New South Wales 
: Phone (02) 9385 3817
: Fax (02) 9385 1340


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden

This email sent to email@hidden


First the Kbase in question is only for 10.2 server.

For 10.3+ you want to use changeip (man changeip in the commandline).

This does not actually change the IP address of the server. All it does is update the configuration files and more importantly the Kerberos principles (used by open directory, active directory, etc.) to reflect the new IP address. There was a point where the server would run changeIP every time you changed the IP address of the server in the network control panel, but luckily they stopped doing that, as an automated process to update service configurations could cause more problems than good on a server.

These are the services that changeip will update for you (from looking at the python script that is /usr/sbin/changeip):

Mail
Podcast
Directory Services (AD/OD/Kerberos)
Adaptive Firewall
Web

and it will also run /usr/sbin/scutil to change your fully qualified domain name system wide

Running:
sudo changeip -checkhostname
after changing a servers IP address will even tell you what you have to change (if you have anything to change)

As for the original question: can you change the IP address of the server remotely, yes you can. checkout networksetup in the commandline (man networksetup).

Once you've change the IP address of the box, you will have to get back in (ssh session will kick you out as the IP changes), and run the changeip command to get the services configured to use the new IP address (and really to use the new fully qualified domain name, if you move the old dns name to the new IP, 90% should work, as OS X uses hostnames for most services now, instead of hard coded IP addresses).

Of course, if this was a remote box that you had no chance of getting to physically, I would script a fail safe that would run networksetup a second time to change the machine back to it's original IP address if you don't log back in within 5 minutes, so somethingt like:

#!/bin/bash
/usr/sbin/networksetup -setmanual new ip stuff
sleep 5 m
/usr/sbin/networksetup -setmanual old ip stuff

That way if you can't connect to box to kill that bash script, you can wait 5 minutes and the box will be at it's old IP address again.

--
Chris Barker
Purveyor of Fine Suggestions
ACSA
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden

This email sent to email@hidden

References: 
 >ChangeIPAddress.command (From: Ian Masters <email@hidden>)
 >Re: ChangeIPAddress.command (From: Eli Bach <email@hidden>)
 >Re: ChangeIPAddress.command (From: Ian Masters <email@hidden>)
 >Re: ChangeIPAddress.command (From: Simon Slavin <email@hidden>)
 >Re: ChangeIPAddress.command (From: Ansgar Wiechers <email@hidden>)
 >Re: ChangeIPAddress.command (From: Stewart Lawler <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.