Use the export subcommand to save a profile configuration. Exporting a profile can be useful if you are responsible for maintaining multiple servers that require identical network configurations. The export subcommand can be used either interactively or in command-line mode. When a profile is exported, the output is displayed as a series of subcommands that the netcfg command is capable of interpreting. These subcommands are similar to commands that you would type in the interactive or command-line mode.
The syntax for the export subcommand is as follows:
netcfg> export [ -d ] [ -f output-file ] [ object-type [ class ] object-name ]
The following example shows how to display a profile configuration on-screen by using the export subcommand interactively.
$ netcfg netcfg> export create ncp "myncp" create ncu ip "net0" set ip-version=ipv4 set ipv4-addrsrc=dhcp set ipv6-addrsrc=dhcp,autoconf end create ncu phys "net0" set activation-mode=manual set mtu=5000 end end create loc "test-loc" set activation-mode=conditional-all set conditions="system-domain is example.com" set nameservices=dns set nameservices-config-file="/etc/nsswitch.dns" set dns-nameservice-configsrc=dhcp end create enm "test-enm" set activation-mode=conditional-all set conditions="ip-address is-not-in-range 10.2.3.4" set fmri="svc:/application/test-enm:default" end create wlan "mywifi" set priority=100 set keyname="mywifi-key" set security-mode=wpa end
In the command-line mode, you would type the following command:
$ netcfg export
You can use the –d option with the export subcommand to add the destroy –a command as the first line of the netcfg export output, as shown in the following example, which has been truncated for the sake of brevity:
$ netcfg netcfg> export -d destroy -a create ncp "myncp" create ncu ip "net0" set ip-version=ipv4 set ipv4-addrsrc=dhcp . . .
In the command-line mode, you would type the following command:
$ netcfg export -dExample 6-14 Exporting a Profile Configuration to a File
In the following examples, the configuration information for the myncp NCP is written to a file by using the export subcommand with the –f option. In the following example, the –f option writes the output to a new file named myncp2. The –d option is used to add the destroy -a command as the first line of the netcfg export output.
You would export the profile configuration to a file interactively as follows:
$ netcfg netcfg> export -d -f myncp2
You would perform the same task in command-line mode as follows:
$ netcfg export -d -f myncp2
The following truncated example shows how you would display the profile configuration:
$ cat myncp2 destroy -a create ncp "myncp" create ncu ip "net0" . . .