Software >> OS >> Unix >> Solaris >> 11 >> Networking >> How to change the static IP of net0 interface, dns and default router after changing your local subnet address

OLD Network
   net0 ip 192.168.8.11
   dns server 192.168.8.1
   default route 192.168.8.1

NEW Network
   net0 ip 192.168.1.12
   dns server 192.168.1.254
   default route 192.168.1.254


CHANGE INTERFACE IP ADDRESS
===========================
ipadm show-addr
ipadm delete-addr net0/v4
ipadm create-addr -T static -a local=192.168.1.11/24 net0/v4

ENSURE NAME RESOLUTION USING DNS
================================
svcs network/dns/client

svccfg -s svc:/network/dns/client         setprop config/nameserver =192.168.1.254
svcprop -p config/nameserver svc:/network/dns/client
svcadm refresh svc:/network/dns/client
svcadm restart svc:/network/dns/client

svccfg -s svc:/system/name-service/switch setprop config/host       = astring: "files dns"
svcprop -p config/host svc:/system/name-service/switch

svcadm refresh svc:/system/name-service/switch
svcadm restart svc:/system/name-service/switch

or

ensure /etc/resolv.conf constai
ns only  nameserver = 192.168.1.254  route delete default 192.168.8.1
route -p add default 192.168.1.254

ENSURE CORRECT DEFAULT ROUTE
============================

route delete default 192.168.8.1
route -p add default 192.168.1.254

 

This will insert into /etc/resolv.conf

nameserver 192.168.1.254