NCP 定义系统的网络配置。只能创建反应性 NCP,不能创建固定 NCP。
要在交互模式下创建 NCP,首先启动交互式会话。然后,使用 create 子命令创建新 NCP,如以下示例中所示:
$ netcfg netcfg> create ncp myncp netcfg:ncp:myncp>示例 19 通过克隆 Automatic NCP 来创建 NCP
可以通过克隆除 DefaultFixed NCP 之外的任意现有 NCP 来创建 NCP。然后,修改该 NCP 的属性以指定新配置参数。在以下示例中,通过克隆系统定义的 Automatic NCP 创建了一个名为 newncp 的新 NCP。
$ netcfg netcfg> create -t Automatic ncp newncp netcfg:ncp:newncp> list ncp:newncp management-type reactive NCUs: phys net0 phys net1 ip net0 ip net1
management-type 属性为只读属性,始终设置为 reactive。在上例中,list 子命令用于显示新复制的 NCP (newncp) 的内容。
还可以使用 netcfg 命令行模式来直接克隆 Automatic NCP,如以下示例中所示。交互式方法和命令行方法都会将现有 NCU 从 Automatic NCP 复制到新创建的 NCP。
$ netcfg create -t Automatic ncp newncp $ netcfg list ncp newncp ncp:newncp management-type reactive NCUs: phys net0 phys net1 ip net0 ip net1