Keith Parkansky
http://www.execpc.com/~keithp
Last revised: May 1, 2002
Networking information in Solaris is stored in text files. Configuration is done by filling in the appriopriate data to these files and invoking specific commands in a terminal window.
- Pop up the menu above the «Text Note» icon and click on Text Editor. Use the editor to open the file:
/boot/solaris/devicedb/master
and use the Find feature (under Edit on the menu bar) to locate the model number of your NIC – example: 3C905 (3Com) or 9432 (SMC). Note that the Find feature is case sensitive in the CDE text editor.
- If your NIC is in the HCL it will be in the master file. The line for the SMC 9432 I’m using in my system looks like this:
pci10b8,a011 pci10b8,a011 net pci spwr.bef
I have the «spwr.bef» bolded because this is the driver name and you’ll need to know the driver name for other files. Remember it.
I’ll save you some work if you have a 3Com 3C905 NIC. The line will be:
pci10b7,9200 pci10b7,9200 net pci elxl.bef
- Use the editor to open the file:
/etc/driver_aliases
(Opening this file will automatically close the master file.) If your NIC is supported it will be listed here also. The line for my SMC NIC was:
spwr "pci10b8,a011"
which you can see is the same information found in the master file just rearranged a bit.
- If you know what is the actual device driver name for your NIC you can verify if the device was properly detected and the driver loaded by looking in /dev directory and searching for files which names begin with the driver name, eg. /dev/spwr0 or /dev/elxl0 for devices used in our example. The number after the driver name in the file name is the consecutive number of the NIC in your system (numbered 0, 1, 2, etc.) using the same driver.
- Use the editor to open the file:
/etc/hosts
and enter a new line in it with the IP address you want to give the system on your network and its’ hostname. I called my machine «solarisi» so I entered:
192.168.10.20 solarisi solarisi.bigsunfan.com loghost
Make sure you press Enter after typing this in to create a new (blank) line beneath it!
With your changes, the resulting the file should look like this:
127.0.0.1 localhost 192.168.10.20 solarisi solarisi.bigsunfan.com loghost
Note that the bigsunfan.com domain need not to be a registered domain. I simply use it as an example.
Don’t forget to save the file. Click on File on menu and select Save.
A note about Sendmail and the hosts file. Sendmail is a mail server, or more professionally, a Mail Transport Agent, MTA in short. It is installed by deafult and started automatically when you boot your system. Sendmail is picky when it comes to FQDNs (Full Qualified Domain Names). When you booted your system you may have seen the infamous Sendmail error:
sendmail[nnn]: My unqualified host name (solarisi) unknown; sleeping for retry
If you are not going to run a mail server, simply turn Sendmail off by renaming its startup file:
mv /etc/rc2.d/S88sendmail /etc/rc2.d/noS88sendmail
Otherwise, you need to specify FQDN of your host in /etc/hosts file. For more details see Configuring Sendmail tutorial.
- Check if the file
/etc/hostname.driver_nameNIC_number
exists. Use the ACTUAL WORD «hostname» in the name of the file, NOT the hostname you gave your system. The driver_name is the name I said you should remember above, and the NIC_number is the number of the NIC in your system. Since I only have one NIC in my system, my file was named:
/etc/hostname.spwr0
The file should contain your host name, the same as in /etc/hosts file. If there is no such file, or it contains improper value you need to correct it.
You could also enter the IP address instead of the host name which is needed if you want to assign multiple IP addresses to a single interface, such as with hosting multiple Web sites on a single server (Apache’s virtual hosting), create multiple files using the above naming convention but append a :1 and :2 etc. to the file name for each additional file. Each file should have a single, different IP address. For example:
/etc/hostname.spwr0 contains 192.168.10.20 /etc/hostname.spwr0:1 contains 192.168.10.21 /etc/hostname.spwr0:2 contains 192.168.10.22 - Now you set up an appropriate subnet mask. Open the file
/etc/netmasks
and the top of the file has comments that explain the contents. You basically just enter your «network number» (NOT your system’s IP address) followed by the subnet mask for your network. Given that the address I gave my system above (192.168.10.20) is a Class C IP address, my netmasks file looked like this:
192.168.10.0 255.255.255.0
The following table may help you determine what your network number and subnet mask should be based on the first number of your system’s IP address:
IP Number Class Network Address Range Subnet Mask Private Address Range A 1.0.0.0 to 126.0.0.0 255.0.0.0 10.x.x.x B 128.0.0.0 to 191.255.0.0 255.255.0.0 172.16.x.x to 172.31.x.x C 192.0.0.0 to 223.255.255.0 255.255.255.0 192.168.0.x to 192.168.255.x If you’re setting up a small network in your home or office and you’re not sure what IP address to use, use any address given in the «Private Address Range» above for a Class C network. This will allow you to have up to 254 nodes (aka «hosts» in TCP/IP lingo) on your network.
Once you’ve got the appropriate network and mask addresses entered, save the file.
- The /etc/hosts file mentioned above is used to resolve machine names to IP addresses on your local network. If you are connecting your system to a network that is connected to the Internet and you plan to use it to surf the Web, or have another need to resolve Internet domain names, you’ll need to specify your ISP’s DNS servers. This is done using another file called
/etc/resolv.conf
Note: When you save the following newly created files the /etc directory should already be selected as the target for the saved file. That’s why no path is specified for file saves. However, verify that //etc/ is in the «path or folder name» field when saving these files.
Create the new file using the text editor by clicking on File and then on New and enter the following lines:
domain enter-your-ISP's-domain nameserver enter-IP-address-of-primary-DNS-server nameserver enter-IP-address-of-secondary-DNS-server
Be sure to hit Enter at the end of the last line and then save the file with the name resolv.conf
The above file is used if your system is not part of a domain. If it is, ex: you are going to use your system as an Internet server, you have to list your domain name on the domain line and list your ISP’s domain (for DNS) using the search keyword. For example:
domain your-domain.com nameserver 172.31.214.78 nameserver 10.138.14.2 search your-ISPs-domain.com
- If your system is on a network that has a default gateway, you’ll need to create
/etc/defaultrouter
file for tha. If your system is going to be an Internet server the default gateway is likely the address of the router interface that connects you to your ISP.
Create a new file using the text editor (click on File and then on New) and simply enter one IP address. This IP address however will be for your default gateway. Be sure to hit Enter at the end of the address and then save the file as /etc/defaultrouter
- Unfortunately, simply creating the resolv.conf file earlier doesn’t mean your system will automatically start to use it. Again, this file is only necessary if you will use your system to access the Internet or other large network where DNS servers are used to resolve system names. This includes simply using your system as a workstation to surf the Web. It doesn’t have to be a server.
Yet another file called nsswitch.conf is used to «tell» your system which name resolution methods to use (host files, DNS, etc) and in which order to use them. Fortunately, the Solaris installation includes several different pre-written versions of the nsswitch file. The default file only uses the host file to resolve machine names.
In order for your system to use DNS servers, you’ll have to issue the following command at the # prompt in a «This Host» window:
cp /etc/nsswitch.dns /etc/nsswitch.conf
Note: At this stage all files related to network configuration are filled in, but the notworking on your system is not yet working properly. You can either reboot your system by typing in init 6 to make Solaris to reread configuration files and setup networking accordingly, or alternatively perform the following steps.
- Plumb the network interface with the following command
ifconfig spwr0 plumb
- Make the interafce up by typing in
ifconfig spwr0 192.168.10.20 netmask 255.255.255.0 up
The IP part 192.168.10.20 of the above command is the IP assigned to the interface, in other words the IP of your host, and the netmask part 255.255.255.0 is the netmask specified in /etc/netmasks file.
You should now be able to communicate with systems on your local network. You can verify this with ping command.
- Add the default route to routing table as follows
route add default 192.168.10.1
where 192.168.10.1 is the IP of the gateway on your network. This should be the IP specified in /etc/defaultrouter file discussed above.
You should now be able to communicate with all systems on the Internet. Verify this with ping command, or simply fire up a web browser.
Related man pages:
- hosts,
- resolv.conf,
- nsswitch.conf,
- netmasks,
- defaultrouter,
- ifconfig
- route
- ping.