Skip to content

Change the IP Address and Host Name

October 13, 2013

Changing the IP Address and Host Name

For Solaris version 10:

# cat /etc/release

Oracle Solaris 10 9/10 s10x_u9wos_14a X86

Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.

Assembled 11 August 2010

(A) To change hostname:

/etc/nodename

/etc/hosts

(Optional – if old hostname exists with respect to interface name, in file – /etc/hostname.* e.g /etc/hostname.e1000g0 )

(B) To change IP

/etc/hosts

/etc/hostname.<interfaces>

where <interfaces> are the names of the interface, e.g. bge0, bge1, eri0, e1000g0.

In this file (/etc/hostname.<interfaces>), you must specify network configuration information such as IP address, netmask etc.

The netmask entry is optional. If you do not specify it, the default netmask is assumed.

# ls -ltrh /etc/hostname.*

-rw-r–r–   1 root     root          38 Oct 12 20:26 /etc/hostname.e1000g0

-rw-r–r–   1 root     root          36 Oct 12 23:44 /etc/hostname.e1000g1

-rw-r–r–   1 root     root          37 Oct 13 16:18 /etc/hostname.e1000g2

Note:

Any change to /etc/hosts, will to reflect the change to files /etc/inet/hosts and /etc/inet/ipnodes, as all 3 files point to one main file (/etc/inet/hosts).

# ls -l /etc/hosts

lrwxrwxrwx   1 root     root          12 Oct 28  2011 /etc/hosts -> ./inet/hosts

# ls -l /etc/inet/hosts

-rwxr-xr-x   1 root     sys          148 Oct 13 16:19 /etc/inet/hosts

# ls -l /etc/inet/ipnodes

lrwxrwxrwx   1 root     root           7 Oct 28  2011 /etc/inet/ipnodes -> ./hosts

(C) If you are moving to a new subnet, check/edit:

/etc/inet/netmasks

/etc/defaultrouter

/etc/resolv.conf

********************* Then reboot the system. *********************

 

Example:              Change Hostname and IP Address in Solaris 10

 

Hostname                                                               : From – ora12crac1                      To – mgracsolsrv64bit1

IPaddress for Interface (e1000g0)                   : From – 192.168.56.10                  To – 192.168.56.20

Netmask changes if required                            : From – 255.255.0.0                      To – 255.255.255.0

Default router address changes                        :                                                         To – 192.168.56.200

(A) Check Current details:

# id -p

uid=0(root) gid=0(root) projid=1(user.root)

# hostname

ora12crac1

# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

inet 127.0.0.1 netmask ff000000

e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2

inet 192.168.56.10 netmask ffffff00 broadcast 192.168.255.255

ether 8:0:27:9c:cb:8c

————————————————————————————————————————

# modinfo |grep -i net

59 fffffffff7b0e000   25e0   –   1  neti (netinfo module)

162 fffffffff7fcc000  337d0 270   1  e1000g (Intel PRO/1000 Ethernet 5.2.28)

# dmesg |grep -i net

Oct  6 14:15:26 ora12crac1 e1000g: [ID 766679 kern.info] Intel(R) PRO/1000 Network Connection, Driver Ver. 5.2.28

————————————————————————————————————————

(B) Next, change the system’s host name and the IP address of interface e1000g0 in the appropriate files:

 

OLD:

 

# cat /etc/nodename

ora12crac1

 

NEW:

 

# vi /etc/nodename

mgracsolsrv64bit1

OLD:

# ls -l /etc/inet/hosts

-r–r–r–   1 root     sys          107 Oct  6 14:41 /etc/inet/hosts

# cat /etc/hosts

#

# Internet host table

#

::1     localhost

127.0.0.1       localhost

192.168.56.10 ora12crac1      loghost

 

 

Note:

Any change to /etc/hosts, will to reflect the change to files /etc/inet/hosts and /etc/inet/ipnodes, as all 3 files point to one main file (/etc/inet/hosts).

New:

# chmod 755 /etc/inet/hosts

# ls -l /etc/inet/hosts

-rwxr-xr-x   1 root     sys          134 Jul  9 18:05 /etc/inet/hosts

# vi /etc/hosts

#

# Internet host table

#

::1     localhost

127.0.0.1       localhost

192.168.56.20              mgracsolsrv64bit1      loghost

# cat /etc/inet/ipnodes

#

# Internet host table

#

::1     localhost

127.0.0.1       localhost

192.168.56.20   mgracsolsrv64bit1      loghost

Reverting the permissions Back :

# chmod 444 /etc/inet/hosts

# ls -l /etc/inet/hosts

-r–r–r–   1 root     sys          107 Oct  6 14:41 /etc/inet/hosts

Now change the hostname for the interface /etc/hostname.e1000g0

OLD:

# cat /etc/hostname.e1000g0

192.168.56.10   netmask  255.255.0.0

NEW:

vi /etc/hostname.e1000g0

192.168.56.20   netmask  255.255.255.0

 

Finally, change the netmask and the IP address of the default router.

 

# ls -l /etc/netmasks

lrwxrwxrwx   1 root     root          15 Jul  7 18:50 /etc/netmasks -> ./inet/netmasks

# ls -l /etc/inet/netmasks

-r–r–r–   1 root     sys          413 Jul  9 18:09 /etc/inet/netmasks


OLD:

# cat /etc/netmasks

#

# The netmasks file associates Internet Protocol (IP) address

# masks with IP network numbers.

#

#       network-number  netmask

#

# The term network-number refers to a number obtained from the Internet Network

# Information Center.

#

# Both the network-number and the netmasks are specified in

# “decimal dot” notation, e.g:

#

#               128.32.0.0 255.255.255.0

#

192.168.0.0  255.255.0.0

chmod 755 /etc/inet/netmasks

New:

# cat /etc/netmasks

#

# The netmasks file associates Internet Protocol (IP) address

# masks with IP network numbers.

#

#       network-number  netmask

#

# The term network-number refers to a number obtained from the Internet Network

# Information Center.

#

# Both the network-number and the netmasks are specified in

# “decimal dot” notation, e.g:

#

#               128.32.0.0 255.255.255.0

#

192.168.56.0  255.255.255.0

chmod 444 /etc/inet/netmasks

Change /etc/defaultrouter only if it requires DNS lookup

 

OLD:

 

# cat /etc/defaultrouter

192.168.56.10

NEW:

vi /etc/defaultrouter

192.168.56.200


Now Check hostname and IP address :

# hostname

ora12crac1

# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

inet 127.0.0.1 netmask ff000000

e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2

inet 192.168.56.10 netmask ffffff00 broadcast 192.168.255.255

ether 8:0:27:9c:cb:8c

As seen above Hostname and IP address is still unchanged after changing the required files, This would need the system Reboot, to get the values or change in effect.

To Change the IP Address For the Current Session , after reboot it reverts to old IP

# ifconfig e1000g0 192.168.56.20 netmask 255.255.255.0 broadcast + up

Note : ( putty will get disconnected ) after above command

# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

inet 127.0.0.1 netmask ff000000

e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2

inet 192.168.56.20 netmask ffffff00 broadcast 192.168.56.255

Reboot Server to reflect the above Modified changes

init 6

Verify the change:

# hostname

mgracsolsrv64bit1

# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

inet 127.0.0.1 netmask ff000000

e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2

inet 192.168.56.20 netmask ffffff00 broadcast 192.168.56.255

ether 8:0:27:9c:cb:8c

As seen above Hostname and IP address got changed after the system Reboot.

References:

http://docs.oracle.com/cd/E19253-01/816-4554/gbwxb/index.html

http://docs.oracle.com/cd/E23824_01/html/821-1458/fpcwh.html#scrolltoc

http://www.cyberciti.biz/tips/solaris-dns-client-configuration.html

Click Here for the PDF

Advertisements

From → Unix

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: