IP setting can be done temporary or persistent.
in the fist case, the interface must be plumbed in the following way:
# ifconfig nxge0 plumb # ifconfig <intferface> <ip address> broadcast <bcast address> netmask <netmask>
If you want your configuration to persist across reboots you’d need to do the following… Each machine on a TCP/IP network gets its configuration information from the
following TCP/IP configuration files and network databases:
- /etc/hostname.interface file
- /etc/nodename file
- /etc/defaultdomain file
- /etc/defaultrouter file (optional)
- /etc/hosts database
- /etc/netmasks database (optional)
1) Disable inetmenu in case you have it installed. This interferes with static configuration:
# svcadm disable network/inetmenu
2) Select a name for your host and enter it in the /etc/nodename file. This file must have exactly one entry, which is the hostname.
# echo webserver1 > /etc/nodename
3) Edit /etc/hosts and add your hostname to ip address mapping. If you are in
a domain, you may want to add another entry with the fully qualified domain name as well.
127.0.0.1 localhost 10.0.3.70 webserver1 webserver1.example.com loghost
4) Add a netmask in the /etc/netmasks in case it will be different from /24
# echo "10.0.3.0 255.255.252.0" >> /etc/netmasks
5) Determine which interface will be connected to the network. For example nxge0 network interface is connected to the network. Then create a file called /etc/hostname.nxge0 which contains the hostname as in step (1):
# echo webserver1 > /etc/hostname.nxge0
6) Create or edit the /etc/defaultrouter file and enter the IP Address of the default router. This will have been provided to your by your network admin or ISP.
# echo 10.0.3.1 > /etc/defaultrouter
7) Now you need to setup name resolution. Typically you’ll want to use DNS and the list of nameservers will have been provided to you by your network admin or ISP. So you will have to setup /etc/nsswitch.conf and /etc/resolv.conf like:
domain yourdomain.com search yourdomain.com nameserver 10.0.3.75 nameserver 10.0.3.77
Details can be different in every case, adapt it to your own settings
Now set nsswitch configuration by hand or copying example file
# /usr/bin/cp /etc/nsswitch.conf.dns /etc/nsswitch.conf
It’s time to reboot and the settings will automatically take effect. You can also perform the following tests to confirm everything is fine:
- ping your gateway
- ping a machine on your local network (if exists)
- ping your nameservers
- ping a well-known host, like www.google.com
You can also activate the configuration without rebooting. After doing the above 7 steps execute an ifconfig command as mentioned in the beginning to directly configure the IP address on the network interface, or restart physical network service to enable configuration.
# svcadm disable network/physical # svcadm enable network/physical
Also, to sometimes is good to enable dns/client just in case, then execute
# svcadm enable dns/client
and things should begin to work…
For Multiple Network Interfaces
If a machine contains more than one network interface, you must create
additional /etc/hostname.interface files for the additional network interfaces. You must create these files with a text editor; the Solaris installation program does not create them for you.
# echo webserver2 > /etc/hostname.eri1 # echo webserver2-backup > /etc/hostname.eri2
Add both entries in /etc/hosts, like:
10.0.3.50 web2 web2.example.com loghost 172.16.8.50 web2-backup webserver2-backup.example.com
Note*: loghost entry should only appear once. The entry makes reference to the hosts where to send logs, normally localhost or primary interface.
in /etc/netmasks add mask for every network.
10.0.3.0 255.255.252.0 172.16.8.0 255.255.255.0
In /etc/nodename will be added only the hostname of the primary interface, no more.