Go to main content

Strategies for Network Administration in Oracle® Solaris 11.3

Exit Print View

Updated: December 2017
 
 

Basic Network Configuration Scenario

To perform basic network configuration of an Oracle Solaris system, you must first customize the datalinks on the system. Then, you configure the IP interfaces and IP addresses, as well as add a persistent default route for the system. Additionally, you configure any system-wide network services such as naming and directory services. The following examples assume that you are using the fixed mode for network configuration. See Example 1, Verifying the Active Network Mode.

Depending on your particular networking needs, you might not need to perform each of the following tasks to configure your network. Or, you might need to perform additional tasks that are not described in this scenario. For a quick reference to commonly used network administration commands, see Oracle Solaris 11.3 Network Administration Cheatsheet.

Configure Datalinks, IP Interfaces, and IP Addresses

    The following configuration tasks are described:

  • Verify the current network configuration mode.

  • Determine how network interface names on the system map to physical interfaces.

  • Configure a static IP interface and address.

  • Add a persistent default route.

Example 1  Verifying the Active Network Mode

After installing Oracle Solaris, verify which configuration mode you are using as follows:

# netadm list
TYPE        PROFILE        STATE
ncp         Automatic      disabled
ncp         DefaultFixed   online
loc         Automatic      offline
loc         NoNet          offline
loc         DefaultFixed   online

The previous output indicates that the system is using the fixed mode, which means you use the dladm, ipadm, and route commands to manage network configuration.

If the system-generated Automatic profile is online, enable the DefaultFixed profile as follows:

# netadm enable -p ncp DefaultFixed
Example 2  Determining How Network Interface Names Map to Physical Interfaces

Prior to configuring an IP interface and static IP address for a system, determine how the network interface names on the system map to the physical interfaces. On a system with multiple physical networks, use the dladm command to obtain this information:

# dladm show-phys
LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
net0              Ethernet             up         1000   full      e1000g0
net1              Ethernet             unknown    0      unknown   pcn0
Example 3  Configuring a Static IP Address

You first create the IP interface and then you configure an IP address for the interface. You can associate multiple IP addresses with a single IP interface. In the following example, ronj is used for example purposes only.

# ipadm create-ip net0
# ipadm show-if
IFNAME     CLASS      STATE      ACTIVE      OVER
lo0        loopback   ok         yes         ---
net0       ip         down       no          ---
# ipadm create-addr -T static -a 203.0.113.20/24 net0/ronj
# ipadm show-if
IFNAME      CLASS     STATE      ACTIVE      OVER
lo0         loopback  ok         yes         ---
net0        ip        ok         yes         ---
# ipadm show-addr
ADDROBJ     TYPE      STATIC     ADDR
lo0/v4      static    ok         127.0.0.1/8
net0/ronj   static    ok         203.0.113.20/24
lo0/v6      static    ok         ::1/128

If your site implements IPv6 addressing, use the addrconf argument with the –T option to specify an automatically generated IPv6 address:

# ipadm create-ip net0
# ipadm create-addr -T addrconf net0/addr

If you need to obtain the IP address from a DHCP server, type the following commands:

# ipadm create-ip net0
# ipadm create-addr -T dhcp net0/addr
Example 4  Adding a Persistent Default Route

After configuring an IP interface and address, add a persistent default route as follows:

# route -p add default 203.0.113.1
add net default: gateway 203.0.113.1
add persistent net default: gateway 203.0.113.1

For detailed instructions, see Creating Persistent (Static) Routes in Configuring and Managing Network Components in Oracle Solaris 11.3.

Configure Naming Services Through SMF

Because the SMF repository is the primary repository for all naming services configuration in Oracle Solaris 11, the previous method of modifying a configuration file to configure naming services no longer works. If you make changes to any of these services, for example, svc:/system/name-service/switch, svc:/network/dns/client, or svc:/system/name-service/cache, you must enable and refresh the service for the changes to take effect.


Note -  If no network configuration exists, naming services default to files only behavior, rather than nis files. Note also that the svc:/system/name-service/cache SMF service should be enabled at all times.

    The following configuration tasks are described:

  • Configure DNS.

  • Set multiple DNS options.

  • Set multiple NIS servers.

Example 5  Configuring DNS Through SMF

The following example shows how to configure the Domain Name Service (DNS) by using SMF commands. The DNS configuration on a system provides the ability to look up IP addresses by host name and host names by IP address. As shown in this example, you can set DNS properties from the command line, or you can set the same properties interactively. See Configuring a DNS Client in Configuring and Managing Network Components in Oracle Solaris 11.3 for an example. After you set the various properties, you must enable and refresh the SMF service for the changes to take effect.

# svccfg -s dns/client setprop config/nameserver=net_address: 192.0.2.1
# svccfg -s dns/client setprop config/domain = astring: "examplehost.org"
# svccfg -s name-service/switch setprop config/host = astring: "files dns"
# svcadm refresh name-service/switch
# svcadm refresh dns/client
Example 6  Configuring Multiple DNS Options Through SMF

One network configuration task that you might need to perform is to set DNS options for a system. The following example shows how to set multiple /etc/resolv.conf options simultaneously.

# svccg
svc:> select /network/dns/client
svc:/network/dns/client> setprop config/options = "ndots:2 retrans:3 retry:1"
svc:/network/dns/client> listprop config/options
config/options astring     ndots:2 retrans:3 retry:1

# svcadm refresh dns/client
# grep options /etc/resolv.conf
options ndots:2 retrans:3 retry:1
Example 7  Configuring Multiple NIS Servers Through SMF

The following example shows how to set multiple NIS servers simultaneously.

# svccfg -s nis/domain setprop config/ypservers = host: (1.2.3.4 5.6.7.8)(Note that there is a space between 1.2.3.4 and 5.6.7.8)

Set a System's Host Name


Note -  The primary interface's TCP/IP host name is a distinct entity from the system host name that you set with the hostname command. Although not required by Oracle Solaris, the same name is normally used for both. Some network applications depend on this convention.

Permanently set a system's host name as follows:

# hostname name-of-host

Initially, the hostname value is stored in config/nodename, but this value is overridden if the system is configured by using DHCP, in which case, DHCP provides the hostname value. If the hostname command is used, then hostname is the value specified in the config/nodename file. If you set a system's identity by using the hostname command, this setting cannot be overridden by DHCP until you execute the hostname command with the –D option. The corresponding SMF properties and the associated SMF service are also automatically updated when you use the hostname command. See the hostname(1) man page.