|Skip Navigation Links|
|Exit Print View|
|Oracle Solaris Administration: Network Interfaces and Network Virtualization Oracle Solaris 11 Information Library|
The netcfg command, which is described in the netcfg(1M) man page, is used to configure properties and values of network profiles.
You can use the netcfg command to perform the following tasks:
Create or destroy a user-defined profile.
Note - You cannot create or destroy a system-defined profile.
List all of the profiles that exist on a system and their property values.
List all of the property values and resources for a specified profile.
Display each property that is associated with a profile.
Set or modify one or all of the properties of a specified profile.
Export the current configuration for a user-defined profile to standard output or a file.
Note - You cannot export a system-defined profile.
Delete any changes that were made to a profile and revert to the previous configuration for that profile.
Verify that a profile has a valid configuration.
You can use the netcfg user interface in interactive mode, command-line mode, or command-file mode. Because the netcfg command is hierarchical, it is more easily understood when used in the interactive mode.
The concept of a scope is used for the netcfg command. When you use the command interactively, the scope you are in at any given time depends on the profile type and the task that you are performing. When you type the netcfg command in a terminal window, a prompt is displayed at the global scope.
From here, you can use the select or create subcommands to view, modify, or create the following top-level profiles:
Before creating or selecting a profile, the netcfg interactive prompt is displayed in the following form:
After you have created or selected a profile, the netcfg interactive prompt is displayed as follows:
Note - In command-line mode, you must type the complete command on a single line. Changes that you make to a selected profile by using the netcfg command in command-line mode are committed to the persistent repository as soon as you finish typing the command.
Selecting or creating a top-level profile while working in the netcfg interactive mode results in a command prompt that is displayed in the profile scope for Location profiles and ENMs. For example:
netcfg> select loc foo netcfg:loc:foo>
If an NCP is selected, the command prompt is displayed is in the NCP scope. From the NCP scope, an NCU can be selected or created. Selecting or creating an NCU results in a profile scope prompt for the selected NCU. In this scope, all of the properties that are associated with the currently selected profile can be viewed and set, as shown in the following example where the User NCP was first selected, then an NCU was created in the NCP scope. This action resulted in the profile scope for the newly created NCU. In this scope, the properties of the NCU can be viewed or set:
netcfg> select ncp User netcfg:ncp:User> create ncu phys net2 Created ncu 'net2'. Walking properties ... activation-mode (manual) [manual|prioritized]>
At any given scope, the command prompt indicates the currently selected profile. Any changes that you make to the profile in this scope can be committed, meaning the changes are saved to the persistent repository. Changes are implicitly committed upon exiting the scope. If you do not want to commit the changes that you made to the selected profile, you can revert to the last committed state for that profile. Doing this action reverts any changes that you made to the profile at that level. The revert and cancel subcommands work similarly.
In command-line mode, any subcommands that affect a selected profile or property must be performed in the particular scope that the selected profile or property exists. For example, to obtain the value of a property of an NCU, you would use the get subcommand in the scope of that particular NCU. When you are in the netcfg interactive mode, it is fairly easy to understand the syntax to use for this command. However, in command-line mode, the syntax might be less obvious.
For example, to obtain the value of a property “foo,” which is an attribute of an NCU called myncu in the User NCP, you would use the following syntax:
$ netcfg "select ncp User; select ncu ip myncu; get foo"
In this example, note the following information:
Each scope is separated by a semicolon.
The select subcommand is issued at each scope, once at the global scope and once at the profile scope.
The get subcommand is used within the scope in which the property “foo” exists.
Straight quotation marks are required to prevent the shell from interpreting semicolons.
In command-file mode, configuration information is taken from a file. The export subcommand is used to produce this file. The configuration can then be printed to standard output or the -f option can be used to specify an output file. The export subcommand can be used interactively also. For more information, see netcfg Supported Subcommands.
The following netcfg subcommands are supported in interactive mode and command-line mode. Note that certain subcommands have different semantics within each scope. If a subcommand cannot be used in a certain mode, it has been noted in the subcommand's description.
Ends the current profile specification without committing the current changes to persistent storage, then proceeds to the previous scope, which is one level higher.
Clears the value for the specified property.
Commits the current profile to persistent storage. A configuration must be correct to be committed. Therefore, this operation automatically performs a verify on the profile or object, as well. The commit operation is attempted automatically upon exiting the current scope by using either the end or exit subcommand.
create [ -t template ] object-type [ class ] object-name
Creates an in-memory profile with the specified type and name. The -t template option specifies that the new profile be identical to template, where template is the name of an existing profile of the same type. If the -t option is not used, the new profile is created with the default values.
Removes all user-defined profiles from memory and persistent storage.
destroy object-type [ class ] object-name
Removes the specified user-defined profile from memory and persistent storage.
Caution - This operation is immediate and does not need to be committed. A destroyed profile cannot be reverted.
Ends the current profile specification and proceeds to the previous scope, which is one level higher. The current profile is verified and committed before ending the edit operation. If either the verify or commit operation fails, an error message is displayed. You are then given the opportunity to end the operation without committing the current changes. Or, you can remain in the current scope and continue editing the profile.
Exits the netcfg interactive session. The current profile is verified and committed before the current session ends. If either the verify or commit operation fails, an error message is displayed. You are then given the opportunity to end the session without committing the current changes. Or, you can remain in the current scope and continue editing the profile.
export [ -d ] [- f output-file ] [ object-type [ class ] object-name ]
Prints the current configuration at the current or specified scope to standard output or to a file that is specified with the -f option. The -d option generates the destroy -a subcommand as the first line of output. This subcommand produces output in a form that is suitable for use in a command file.
Note - System-defined profiles, including the Automatic NCP and the Automatic, NoNet, and Legacy locations, cannot be exported.
get [ -V ] prop-name
Gets the current, in-memory value of the specified property. By default, both the property name and value are printed. If the -V option is specified, only the property value is printed.
help [ subcommand ]
Displays general help or help about a specific subject.
list [-a] [object-type [ class ] object-name ]
Lists all profiles, property-value pairs and resources that will be used at the current or specified scope. If the -a option is specified, all properties are listed, including those that will be ignored, based on current settings.
Deletes any current changes that were made to a profile, then reverts to the values from persistent storage.
select object-type [ class ] object-name
Selects the object that is specified.
Sets the current, in-memory value of the specified property.
If performed in command-line mode, the change is also committed immediately to persistent storage.
The delimiter for multi-valued properties is a comma (,). If an individual value for a given property contains a comma, it must be preceded it with a backslash (\). Commas within properties that only have a single value are not interpreted as delimiters and do not need to be preceded by a backslash.
Verifies that the current, in-memory profile or object has a valid configuration.
“Walks” each property that is associated with the current profile. For each property, the name and current value are displayed. A prompt is provided to enable you to change the current value. If a property is not used, based on the previously specified values, the property is not displayed. For example, if the ipv4-addrsrc property is set to static, the ipv4-addr property is not used, and is not walked or listed, unless you specify the -a option.
When used, the -a option iterates all available properties for the specified profile or object.
The delimiter for multi-valued properties is a comma (,). If an individual value for a given property contains a comma, it must be preceded by a backslash (\). Commas within properties that only have a single value are not interpreted as delimiters and do not need to be preceded by a backslash.
Note - This subcommand is meaningful when used in interactive mode only.
For task-related information, see Chapter 4, NWAM Profile Configuration (Tasks).