Ever had to change the IP on a server that's without any local supervision, behind who knows how many firewalls, in another country, with only SSH accesss sticking out of it? Wouldn't it be nice if there was a function similar to the Displays preference pane, in which, if the settings turn out to be incorrect, it automatically reverts to the previous working setup? Well, here's one.
Before any critical conf change, I just re-define the current config into an at command:
<code> $ sudo at now + 15 minute $ changeip - newip oldip newhost oldhost $ networksetup -setmanual networkport oldip oldnetmask oldrouter $ Ctrl -D </code>
Then, make your changes. If all does work out, don't forget to disable the safety harness:
<code> $ sudo at -l $ sudo at -r jobnumber </code>
I used an IP change as an example here, but I'm sure you can think of other scenarios with potentially tragic consequences.
Might want to make sure at is loaded first…
sudo launchctl load -w
/System/Library/LaunchDaemons/com.apple.atrun.plist
and then check that at is working happily, but nice tip.
In similar situations where I’ve only had access to hard rebooting the
remote machine I’ve set up startup scripts that restore everything to the
previous settings.
Nothing like messing with network settings in these situations… 🙂
I too do something like this when changing network settings remotely.
Particularly with ipfw settings.
Make sure you set the timer long enough to
have a beer and think about what you did wrong. 🙂
—
Breaking my server to save yours.
Josh Wisenbaker
http://www.afp548.com