04 October 2010

How to change ip address in solaris

# touch /etc/resolv.conf

Open /etc/resolv.conf using vi text editor:
# vi /etc/resolv.conf
Add the following lines to it:

search domainname
nameserver 202.54.1.30
nameserver 202.54.1.18

Where,

    * nameserver IP : It is IP of first DNS server
    * search nixcraft.in : Default domain name to search. For example, if you type command nslookup www, it will search it as www.nixcraft.in

2) Enable the name resolving using DNS as follows:
# cp /etc/nsswitch.dns /etc/nsswitch.conf
3) Test new name server by running the nslookup command as follows:
# nslookup nixcraft.in
OR
# /usr/sfw/sbin/nslookup nixcraft.in
Output:

Server:  (domain name)
Address:  address

Non-authoritative answer:
Name:    (domain name)
Address:  address



I recently needed to change the IP address of 2 new Solaris 10 Sparc boxes. I made the normal changes
/etc/hosts
/etc/hostname.bge0
/etc/resolv.conf
/etc/netmasks
/etc/nodename &
/etc/defaultrouter
(why can't we get these into one file?)

But when rebooted, the server still remembered its old IP address and settings even though
I couldn't grep that IP anywhere. I eventually had to do a sys-unconfig which I was hoping to avoid.
 Is there some other way to change an IP in solaris 10?

This is a great 'feature'. ;-)
/etc/inet/ipnodes
is the /etc/hosts for IPv6.

It's been there, pretty much
empty, for ages and ages, but
in S10 it is populated at install
time -- so edit that file too, and
all will be well. It's entries trump
those in /etc/hosts...

No comments: