Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Change IP from Terminal?

Change IP from Terminal?
Thread Tools
Senior User
Join Date: Mar 2001
Location: Crystal, MN
Status: Offline
Reply With Quote
Apr 27, 2003, 03:46 PM
 
Can anyone help me out. I need to change the IP address of my MacOSX box - however the only access I have is via SSH right now.

How can I change it from the terminal?

dw9
     
Forum Regular
Join Date: Oct 2002
Location: Atlanta
Status: Offline
Reply With Quote
Apr 27, 2003, 04:22 PM
 
You should use ifconfig. I think what you should do is:

Code:
ifconfig en0 <new IP-address>
but check the man-page to be sure.
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Apr 28, 2003, 04:13 PM
 
Originally posted by leffo:
You should use ifconfig. I think what you should do is:

Code:
ifconfig en0 <new IP-address>
To be safe, you should probably alias the new IP address first:

sudo ifconfig en0 <ip ip> alias

so that the Mac takes it on as a second IP address. You can then connect to that new IP address to make sure it's working, and delete the original address.

If you don't do that, and you make a mistake, you'll lose your ssh connection and won't be able to reconnect.

Note also that this command will only change the current IP address. When you reboot the machine will revert to the IP address assigned in System Preferences.
Gods don't kill people - people with Gods kill people.
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 29, 2003, 12:11 PM
 
Originally posted by Camelot:
To be safe, you should probably alias the new IP address first:

sudo ifconfig en0 <ip ip> alias

so that the Mac takes it on as a second IP address. You can then connect to that new IP address to make sure it's working, and delete the original address.

If you don't do that, and you make a mistake, you'll lose your ssh connection and won't be able to reconnect.

Note also that this command will only change the current IP address. When you reboot the machine will revert to the IP address assigned in System Preferences.
Oooh, nice to know. If I ever need to do this I'll make sure to check the man page for ifconfig. Thanks, Camelot.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
   
Thread Tools
Forum Links
Forum 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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:50 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2