We help IT Professionals succeed at work.

Change the IP on a unix server

mkunesh
mkunesh asked
on
I need to change the IP on a unix box and I don't know the command or syntax to do this.  I am an Apple shop sys admin with a very very old unix server for some rare operations.  On a Mac, networksetup command will do this.  What is the Unix varient?
Comment
Watch Question

Most Valuable Expert 2013
Top Expert 2013

Commented:
Which UNIX do you use?
uname -a
will tell you.
wmp

Author

Commented:
Output from uname -a:

HP-UX  B.11.11 U 9000/800 2363024365 unlimited-user license

Commented:
Which UNIX are you using (Solaris, HP-UX, AIX, XENIX, BSD, IRX, ...)?  They all tend to have their own idiosyncrasies. Look up the syntax for the ifconfig command for your version of UNIX.
Most Valuable Expert 2013
Top Expert 2013

Commented:
In HP-UX  the easiest way is most probably SAM -
sam -> networking and communications --> network interface cards --> ...
You should work on the system console to do this, else you will loose the connection to your server.
wmp

 
Most Valuable Expert 2013
Top Expert 2013

Commented:
ifconfig does only temporary changes ...

Commented:
Run the following command to see the existing config.

ifconfig

Then you can change the ip with the following command substituting the interface and address_family info from the previous command and adding the new ip address you want.

ifconfig interface [address_family] [address [dest_address]] [parameters]

It may be easier to just edit /etc/rc.config.d/netconf changing the ip info and rebooting the machine.
Commented:
edit your /etc/rc.conf file

the line to change is

ifconfig_re0="inet xxx.xxx.xxx.xxx netmask 255.255.255.0"

just the xxx to the ip you want to change it to .

Commented:
sorry ,  extra info re0 in the above example is your network card , the command ifconfig will give you the info for your currently installed card , then just adjust to match.
Kamran ArshadIT Associate

Commented:
The ifconfig command with "-p" flag usually changes the IP address permanently with the 'p' flag for persistent.

Author

Commented:
Thanks!