How to configure network in Solaris 10

These are the steps you need to take to configure network on your Solaris machine.

To configure a network using static IP.

Check whether your machine is currently configured on DHCP

# netstat -D

returns the interfaces using DHCP address
mv  dhcp.e1000g0 to some other name or remove the file so that the DHCP agent is NOT invoked

These are the files which are used in Solaris to configure the network.
IP Address - /etc/hostname.e1000g0
Domain name - /etc/defaultdomain
Netmask - /etc/inet/netmasks
Hosts database - /etc/hosts, /etc/inet/hosts
Client DNS resolver file - /etc/resolv.conf
Default Gateway - /etc/defaultrouter
Node name - /etc/nodename
Name service configuration file - /etc/nsswitch.conf

User can use any text editor to edit the configuration files. In my case I will use gedit which is a GUI based text editor.

# gedit /etc/hostname.e1000g0
192.168.0.100
# gedit /etc/defaultdomain
solaris.test
# gedit /etc/inet/netmasks
192.168.0.0 255.255.255.0
# gedit /etc/hosts
192.168.0.100 solaris.test
# gedit /etc/resolv.conf
domain test
nameserver 192.168.0.50
# gedit /etc/defaultrouter
192.168.0.1

Check the nsswitch file for hosts value as bydefault it is only set to resolve using files and not dns

# gedit /etc/nsswitch.conf
hosts: files dns

NOTE:You will have to reboot system after transitioning from network client(DHCP) mode to local files(Static) mode.

Once the system is rebooted you can check the IP address of the machine

#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.0.100 netmask ffffff00 broadcast 192.168.0.255
ether 0:c:29:70:da:5b
To check the default route or gateway

 # netstat -rn
 Routing Table: IPv4
 Destination           Gateway           Flags  Ref     Use      Interface
-------------------- -------------------- ----- ----- ---------- ---------
 default              192.168.0.1         UG        1     3    
 192.168.0.0          192.168.0.100         U       1     2       e1000g0
 224.0.0.0            192.168.0.100         U       1     0       e1000g0
 127.0.0.1            127.0.0.1            UH       4    121       lo0

# ping goole.com
google.com is alive

Related Articles