Go Back   The macosxhints Forums > OS X Help Requests > OS X Server



Reply
 
Thread Tools Rating: Thread Rating: 15 votes, 5.00 average. Display Modes
Old 02-27-2008, 04:46 AM   #1
troutstudio
Prospect
 
Join Date: Nov 2004
Posts: 7
Change IP address via the terminal

I restarted a new 10.4 dev server from the backup partition but it was set to DHCP and now ifconfig tells me that it's on a self assigned IP, as the port it's been moved to has no DHCP. Dumb, I know.

Please - can anyone post the exact terminal commands needed to set en0 to

(example addresses follow)

10.40.21.10
255.255.255.0
10.40.21.1

I've searched a lot so if you can help, you'd be helping more idiots like me . . .
troutstudio is offline   Reply With Quote
Old 02-27-2008, 05:50 PM   #2
robinwmills
Major Leaguer
 
Join Date: Sep 2007
Location: San Jose, CA, USA.
Posts: 290
I think ifconfig is the command. The man page says "Ifconfig is used to assign an address to a network interface and/or configure network interface parameters". I've never used it. Man pages looks formidable (and leads off with a typo to inspire confidence). Good Luck!
robinwmills is offline   Reply With Quote
Old 02-27-2008, 06:14 PM   #3
giskard22
Moderator
 
Join Date: May 2003
Posts: 4,272
On a Mac, ifconfig won't make any permanent settings changes. You want 'networksetup'.
giskard22 is offline   Reply With Quote
Old 02-21-2010, 08:30 PM   #4
Daddyspry
Guest
 
Posts: n/a
using command "networksetup"

I am running x serve 10.4.11,
I need to change the subnet, router, and ip
This server is at an elementary and runs several networked applications for students. That's all it's used for.
It sounds like "networksetup" is the command I should use to make these changes, but I would like confirmation on that.
  Reply With Quote
Old 02-28-2010, 12:30 PM   #5
Absolute
Prospect
 
Join Date: Feb 2010
Posts: 1
Using networksetup

First use the command to check this command to check the current setup
sudo networksetup -listnetworkserviceorder

You should see something like this:
An asterisk (*) denotes that a network service is disabled.
(1) Ethernet
(Hardware Port: Ethernet, Device: en0)
(2) AirPort
(Hardware Port: AirPort, Device: en1)

Assuming you do, then issue this command
sudo networksetup -getinfo Ethernet (or whatever your en0 is called)
Again, for your setup, you should see:
DHCP Configuration
Client ID: XXX
etc.etc.

To change to the settings you wanted
sudo networksetup -setmanual Ethernet 10.40.21.10 255.255.255.0 10.40.21.1

If your running an Xserve or a G5 with twin Ethernet ports, by default, you'll see:
(1) Ethernet 1
(Hardware Port: Ethernet 1, Device: en0)
(2) Ethernet 2
(Hardware Port: Ethernet 2, Device: en1)

Just make sure you change the first port listed (assuming that's the one connected to your router)


Hope this helps
Mike
Absolute is offline   Reply With Quote
Old 03-01-2010, 11:42 AM   #6
tlarkin
League Commissioner
 
Join Date: Mar 2003
Location: Bay Area, CA
Posts: 11,352
Actually, in OS X Server you want to use the changeip command, as it was designed specifically for this task as servers have more running under the hood than the typical OS. They need to update DNS or IP settings for many different services and this binary does it.

see this:

http://developer.apple.com/mac/libra...hangeip.8.html

All other methods are not as effective and should not be used in OS X server.
__________________
sudo make me a sammich
tlarkin is offline   Reply With Quote
Old 03-31-2010, 07:43 AM   #7
ehemmete
Prospect
 
Join Date: Feb 2009
Posts: 13
Quote:
Originally Posted by tlarkin
Actually, in OS X Server you want to use the changeip command, as it was designed specifically for this task as servers have more running under the hood than the typical OS. They need to update DNS or IP settings for many different services and this binary does it.

see this:

http://developer.apple.com/mac/libra...hangeip.8.html

All other methods are not as effective and should not be used in OS X server.

While true that you should run changeip on the server before actually changing the ip, changeip will NOT actually change the ip on an interface. You need to do that as a separate step, and networksetup is the way to do it.

The recommend procedure is:
1) update any dns records this will affect
2) run sudo changeip (actual syntax depends on os version, check man changeip)
3) run networksetup and systemsetup to change ip and computer name (if necessary)
4) restart
5) check it all looks good with sudo changeip -checkhostname
ehemmete is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 08:46 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.