6.1 Command Line Interface

Version 1.13, 2009-Mar-17

Two administrative commands make up the NWAM command line interface: nwamcfg(1M), which allows the administrator to create and modify network profiles, and nwamadm(1M), which allows the administrator to perform actions (e.g. activate, deactivate) on network profiles. These commands are analogous to zonecfg(1M) and zoneadm(1M).

6.1.1 nwamcfg(1M)

6.1.1.1 Overview

NWAM configuration consists of properties and values associated with several different types of profiles and configuration objects. Those include Network Configuration Profiles (NCPs), Locations, External Network Modifiers (ENMs), and Known WLANs.

An NCP specifies the configuration of the local network components, including physical links, IP tunnel links, and IP interfaces. An IP interface must be associated with an underlying link of either type. These components are collectively referred to as Network Configuration Units, or NCUs. For more detail about the NCP and NCUs, please refer to section 2 of this document.

A Location specifies system-wide network configuration, including areas such as name services, domain, IP Filter and IPsec configuration. More details about Locations can be found in section 3 of this document.

External Network Modifiers are, as the name suggests, applications external to NWAM that may modify and/or create network configuration. NWAM can be configured to activate and deactivate these external applications under conditions specified by the administrator. ENMs are discussed in more detail in section 4.3 of this document.

Known WLANs are used to maintain a list of known wireless networks. These are wireless networks that the user has added or connected to in the past. Known WLANs are discussed in more detail in section 4.4 of this document.

nwamcfg operates in a hierarchical manner that is most easily understood in an interactive shell style. The command is executed from the command line, which results in a prompt at the global scope. From there, top level profiles (NCPs, Locations, ENMs, or Known WLANs) may be selected for modification or created.

Selecting or creating a top-level profile results in a command prompt that is in the profile scope for Locations and ENMs, or the NCP scope if an NCP is selected. From the NCP scope, an NCU may be created or selected, which will result in a profile-scope prompt. In the profile scope, all properties associated with the current profile (NCU, Location, ENM, or Known WLAN) may be viewed and set.

At any given scope, the command prompt will indicate the currently selected profile. The profile may be committed, which writes changes that have been made back to the persistent repository; upon exit from a scope, if uncommitted changes exist, those changes will be committed. If the user wishes to prevent changes from being committed, a revert subcommand is provided, which will undo any uncommitted changes to the currently selected profile, reverting to the last committed state.

nwamcfg may also be used in non-interactive mode, with complete commands entered on a single command line.

6.1.1.2 Command Reference

nwamcfg can be invoked as follows:

The following subcommands are supported:

6.1.1.3 Objects and Non-Interactive Mode

Subcommands that affect a specific object or property must be performed in the scope in which that object or property exists. For example, in order to get the value of a property of an NCU, the 'get' subcommand must be issued in the scope of that particular NCU. This is straightforward when done in interactive mode, but is somewhat less obvious in non-interactive mode.

Objects and properties that exist outside the global scope may be modified from the command-line, in non-interactive mode, with an appropriate sequence of commands. Thus, to get property foo which is an attribute of NCU myncu in NCP ncp1, the following command would be used:

# nwamcfg "select ncp User; select ncu ip myncu; get foo"
Note that the quotes are required to prevent the shell from interpreting the semi-colons.

Refer to the following section for additional examples of this usage.

6.1.1.4 Examples
Example 1: Set an NCU property from the command line (in non-interactive mode)
# nwamcfg "select ncp User; select ncu link net1; set mtu=1492"
#
Example 2: List all top-level profiles from the command line
# nwamcfg list
NCPs:
        Automatic
        User
Locations:
        Automatic
        NoNet
        home
        office
ENMs:
        myenm
        enmtest
WLANs:
        sunwifi
        coffeeshop
        linksys
#
Example 3: Destroy a Location profile from the command line
# nwamcfg destroy loc home
Destroyed loc 'home'
#
Example 4: Interactively create an NCU profile.
# nwamcfg
nwamcfg> select ncp User
nwamcfg:ncp:User> create ncu ip net1
Created ncu 'net1'.  Walking properties ...
        ipversion (all) [ipv4|ipv6|all]> ipv4
        ipv4-addr-src (dhcp) [static|dhcp]> static
        ipv4-static-addr ()> 168.1.2.3
nwamcfg:ncp:User:ncu:net1> list
NCU:IP:net1
        type:             ip
        class:            ip
        parent-ncp:       "User"
        ipversion:        ipv4
        ipv4-addr-src:    static
        ipv4-static-addr: 168.1.2.3
nwamcfg:ncp:User:ncu:net1> commit
Committed changes
nwamcfg:ncp:User:ncu:net1> end
nwamcfg:ncp:User> exit
#
Example 5: Select an existing enm, display its contents, and change a property value
# nwamcfg
nwamcfg>select enm myenm
nwamcfg:enm:myenm>list
ENM:myenm
        activation-mode manual
        enabled         true
        start           "/usr/local/bin/myenm start"
        stop            "/usr/local/bin/myenm stop"
nwamcfg:enm:myenm>set stop=/bin/alt_stop
nwamcfg:enm:myenm>list
ENM:myenm
        activation-mode manual
        enabled         true
        start           "/usr/local/bin/myenm start"
        stop            "/bin/alt_stop"
nwamcfg:enm:myenm>exit
Committed changes
#

6.1.2 nwamadm(1M)

6.1.2.1 Overview

The nwamadm utility is used to administer NWAM profiles. As discussed in the preceding section, there are three different profile types: Network Configuration Profiles (NCPs), Locations, and External Network Modifiers (ENMs). nwamadm can also be used to administer individual link Network Configuration Units (NCUs), which are the link components that are part of an NCP, and to interact with the NWAM daemon in the absence of a Graphical User Interface.

At any given time, there is one active NCP and one active Location on a system. Enabling a different NCP or Location will implicitly disable the current active NCP or Location. The current Location may also be disabled, though the effect of this will be to "turn off" some aspects of the system's networking capabilities, such as name services. Explicitly disabling an NCP is not permitted, as that would effectively shut down the basic network connectivity of the system. An NCP is only disabled implicitly when a different NCP is enabled.

Conversely, there may be zero or more active ENMs at any given time. Thus enabling or disabling an ENM has no effect on other active ENMs.

Enabling and disabling of individual link NCUs is also allowed; the specified NCU must be part of the currently active NCP, and must have its activation mode set to MANUAL.

6.1.2.2 Command Reference

nwamadm can be invoked as follows:

The subcommands are defined as follows:

6.1.2.3 Examples
Example 1: Enable a user-specified location
# nwamadm enable -t loc office
Disabled loc 'home'.
Enabled loc 'office'.
#
Example 2: Disable an ENM
# nwamadm disable -t enm myvpn
Disabled enm 'myvpn'.
#
Example 3: List all NCPs
# nwamadm list -t ncp
TYPE       PROFILE         STATE
ncp        User            online
 ncu       bge0            online
 ncu       bge1            disabled
ncp        Automatic       offline
#

Revision History

Revision Date Changes
1.1 2008-Jun-04 modify to reflect phase 1 spec updates
1.2 2008-Jul-16 add nwamadm section
1.3 2008-Aug-05 grammar/usage updates for nwamcfg
1.4 2008-Aug-18 update (default) [options] syntax in walkprop example
1.5 2008-Aug-27 syntax cleanup
1.6 2008-Sep-08 examples cleanup
1.7 2008-Sep-30 make scope terminology consistent
1.8 2009-Jan-07 add Known WLAN list details
1.9 2009-Jan-27 miscellaneous clean-up
1.10 2009-Feb-13 Design review feedback; more implementation changes
1.11 2009-Feb-27 Fix text alignment nits
1.12 2009-Mar-11 update enable/disable constraints; add enable/disable of NCUs; add interact subcommand
1.13 2009-Mar-17 pre-psarc review feedback