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
# gedit /etc/defaultdomain
# gedit /etc/inet/netmasks
# gedit /etc/hosts solaris.test
# gedit /etc/resolv.conf
domain test
# gedit /etc/defaultrouter

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 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet netmask ffffff00 broadcast
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             UG        1     3         U       1     2       e1000g0           U       1     0       e1000g0              UH       4    121       lo0

# ping is alive

Related Articles