BigAdmin System Administration Portal
Feature Article
Print-friendly VersionPrint-friendly Version

Network Configuration on the Solaris Platform

by Eric Rinker

Purpose of This Document

You should come away from this document with a firm understanding of how to set up your network interfaces using the command-line interface. Also included in this article are some basic troubleshooting hints. This document does not cover hardware.

Requirements

To make the most of this article you need a solid grasp of the Solaris Operating System. You should also have at least a basic understanding of TCP/IP networking and subnet masking. To use this article, you will need to create and edit system files, and understand the boot process (in regard to boot scripts). Root access is mandatory.

Background

At its most basic form, a network consists of two computers that connect to each other to collaborate on a particular task. These collaborative tasks range from simple file transfers to the complex tasks of distributed computing or clustering.

There are two basic parts to a network: the physical medium and the network protocol. The physical medium employed in a network varies, depending on how you need to connect your computers, and how much you are willing to spend. Some of the common methods used for computer connectivity include:

  • Token Ring -- Developed by IBM, this network type has each computer arranged schematically as part of a circle.
  • 10Base2 (Coaxial) -- Each computer is strung together using thin coaxial cable with terminators attached to each end of the chain.
  • 10(0)BaseT -- This is your standard office/home networking technology that uses cables with wires that are twisted in pairs. A hub/switch allows for the connection of multiple computers. Originally seen in speeds of 10 Mb/sec (megabits per second), it now comes in a 100 Mb/sec variety.
  • Fiber (Gigabit) -- Instead of twisted pair cables, this technology uses fiber-optic cables to transmit data. It can attain speeds of 1000 Mb/sec (1 Gb/sec), but comes at high cost and requires care when running the cables.
  • Wireless 802.11a - The industrial strength wireless. It can run at speeds of 54 Mb/sec, but at very limited range.
  • Wireless 802.11b -- The current standard for home and office wireless. It runs at speeds of approximately 10Mb/sec.
  • Wireless 802.11g -- Combines the speed of 802.11 with the range of 802.11b. Backward compatible with 802.11a and 802.11b.

Even if two networks are using the same medium, they can be using two completely different protocols or methods of communication. Some protocols used in today's networks include:

  • TCP/IP -- The Internet standard. Each NIC is assigned an IP address and subnet mask. These are used to determine which machines are in the local network and which require traffic to be sent through a router.
  • IPX/SPX -- A broadcast protocol developed by Novell. Each NIC is assigned a unique IPX network address.
  • AppleTalk -- An Apple proprietary protocol. Each NIC is assigned a network number, a node number, and a socket number. Similar to TCP/IP in its configuration and routing abilities.

Verify Hardware Install

Our scenario assumes a second NIC is being installed into a previously configured networked system. Before installing the new hardware, save the current system configuration by running prtconf -vD. The output of this command can be extensive on larger systems, so it's best to direct the output of prtconf to a file.

After physically installing the new hardware, boot the system with the -r option from the OK prompt. This will have the system scan for new hardware and build the device driver directories accordingly. When that has been completed, run prtconf -vD again and compare its content to the previous execution's results. If a new device doesn't show up, consult the instruction manual for that device as it may require a new driver to be installed or some other special action specific to that hardware. Depending on the system and what other cards are installed, you should be able to find something like the following:

        SUNW,hme, instance #0 (driver name: hme)
Register Specifications:
Bus Type=0xe, Address=0x8c00000, Size=0x108
Bus Type=0xe, Address=0x8c02000, Size=0x2000
Bus Type=0xe, Address=0x8c04000, Size=0x2000
Bus Type=0xe, Address=0x8c06000, Size=0x2000
Bus Type=0xe, Address=0x8c07000, Size=0x20
SUNW,hme, instance #1 (driver name: hme)
Register Specifications:
Bus Type=0x0, Address=0x8c00000, Size=0x108
Bus Type=0x0, Address=0x8c02000, Size=0x2000
Bus Type=0x0, Address=0x8c04000, Size=0x2000
Bus Type=0x0, Address=0x8c06000, Size=0x2000
Bus Type=0x0, Address=0x8c07000, Size=0x20

The preceding example comes from an Ultra 1 workstation after the installation of a second 100-Mb NIC on a SBus Card. The name of a NIC is the driver abbreviation with the instance number (a consecutive number starting from 0 counting each device that uses that driver). Our devices from the preceding prtconf output would be known to the system as hme0 and hme1. If you cannot tell which driver runs your hardware, consult the NIC card's manual.

The results of an ifconfig -a show us the current state of the network devices:

lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
hme0: flags=1000843 mtu 1500 index 2
inet 192.168.1.100 netmask ffffff00 broadcast 192.168.1.255
ether

The built in NIC (instance #0) had previously been configured, and lo0 is an instance of the local loopback address. Since hme1 doesn't show up, it means it has yet to be initialized and configured.

Persistent IPv4 Configuration

In order to have the system configure our NIC at boot, the first step is to get an IP address and subnet mask. In our case, we are going to put this second NIC into a different IP range than the original NIC. Our first NIC is in the 192.168.1.x network, so we will put the new NIC into the 192.168.2.x network. Both of these networks have a subnet mask of 255.255.255.0. Note: Always make sure the assigned IP is not already taken up by another machine; to do so, use ping from a machine already configured in that network.

Next we add a line to the /etc/hosts file for our new card:

192.168.2.100		host2.mydomain.com		host2

Now, we create a file in /etc that is named hostname. For example, our first NIC's file is /etc/hostname.hme0. Our new device, hme1, will need the file /etc/hostname.hme1. In this file, we will put the name associated with the IP (as found in the /etc/hosts file). It should be the first name in the /etc/hosts file. In our scenario, /etc/hostname.hme1 should contain:

host2.mydomain.com

Then we edit the /etc/netmasks file for our new network:

192.168.2.0	255.255.255.0

Reboot the system, and your network card has been configured for the new network with the proper subnet mask. You can check it by running an ifconfig -a again:

lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
hme0: flags=1000843 mtu 1500 index 2
inet 192.168.1.100 netmask ffffff00 broadcast 192.168.1.255
ether
hme1: flags=1000843 mtu 1500 index 3
inet 192.168.2.100 netmask ffffff00 broadcast 192.168.2.255
ether

Non-Persistence IPv4 Configuration

To configure the NIC without having to reboot (having previously installed the hardware), you first need to initialize or plumb the network card:

	ifconfig hme1 plumb

Then you configure the device:

	ifconfig hme1 192.168.2.100 netmask 255.255.255.0

Now, you just bring the NIC online.

	ifconfig hme1 up

Your network card is now up and running. You will still need to make the preceding file modifications or your card will not be configured upon reboot.

IPv6 Configuration

Almost everything with IPv6 is designed to be automatic. All that is needed is to tell the system that IPv6 is to be used, and it will handle the rest. To configure it at boot (persistent), execute the following command:

	touch /etc/hostname6 

To enable IPv6 at the command line (which will be lost when the system reboots), run the following commands:

	ifconfig  inet6 plumb
ifconfig inet6 up

Troubleshooting

The following is a collection of tools used to troubleshoot networking problems:

/sbin/ifconfig: The system administrator's best friend when working with your NIC. Used to configure the network card, /sbin/ifconfig lets you know which cards are currently recognized by the system, and their states. Should always be your first stop when troubleshooting. An ifconfig -a will give you information about all NIC, including IP address (inet), subnet mask (netmask), and if run as root, the MAC address (ether).

/usr/sbin/arp: The address resolution protocol (ARP) uses a table to keep track of the Internet-to-Ethernet translation information (IP Address to MAC Address). arp allows you to view that table to see what kind of information your computer has cached, as well as to input or delete entries, in case of problems. When having DNS issues, an arp command with the -an option will list the entire table without resolving IP address to host names. arp is one way to get the MAC address of the NIC answering for a host. This is done by running arp against the host name or IP Address of the target: arp host.domain.com. However, this only works if the machine being polled is in the same network as the machine doing the polling.

 /bin/netstat: This very useful tool displays the contents of various network-related tables. While a once-over of the man pages is the best way to become familiar with this tool, here is a quick cheat sheet for basic use:

  • Port/Socket information can be had with a netstat -a. This is a good way to tell what remote systems are attaching to what ports, in case you have network daemons that are locking up or if you are wondering what computers are browsing your web server.
  • Most administrators check current system routing tables with netstat -rn. The n option should almost always be used when troubleshooting network issues, since DNS lookups for IP-to-Hostname lookups are not local services. The entry to double check is your "default" destination, since this is the system's default router or gateway.
  • Statistics on each NIC are shown with a netstat -I, which is often used in homemade monitoring scripts.

/usr/sbin/snoop: A packet-monitoring tool that shows what is currently going on in the local network. Good for finding malfunctioning NICs flooding the network or for ensuring that DHCP is working properly. Before you configure a NIC, you can run snoop to verify that you are seeing packets flowing through your NIC that is, the cable/NIC/switch port are working), and the IP addresses of those packets are consistent with what is expected for the NIC's new network. This tool should be used with caution: Some company policies forbid the use of network monitoring tools that capture packets if they are not intended for the machine running snoop. Also, it is not recommended that you run snoop in verbose display-to-screen mode when logged on to a machine remotely.

Where to Go Next

Networking can be simple and complicated at the same time. The first stop with any UNIX application is the man pages. Next, I would suggest you visit the Solaris Manuals online at the Sun Product Documentation site (docs.sun.com). Lastly, I would recommend you check out the Sun Managers mailing list.


Comments (latest comments first)

Discuss and comment on this resource in the BigAdmin Wiki

Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


BigAdmin