在 Oracle® Solaris 11.2 中确保网络安全

退出打印视图

更新时间: 2014 年 9 月
 
 

在 IKEv2 中使用预先共享的密钥时如何添加新的对等方

如果将 IPsec 策略项添加到相同对等方之间的工作配置,则需要刷新 IPsec 策略服务。无需重新配置或重新启动 IKE。

如果将新的对等方添加到 IPsec 策略,则除了进行 IPsec 更改之外,还必须修改 IKEv2 配置。

开始之前

您已更新了对等方系统的 ipsecinit.conf 文件并刷新了 IPsec 策略。

您必须成为分配有 "Network IPsec Management"(网络 IPsec 管理)权限配置文件的管理员。您必须在配置文件 shell 中键入信息。有关更多信息,请参见在 Oracle Solaris 11.2 中确保用户和进程的安全 中的使用所指定的管理权限

如果执行远程管理,请参见Example 7–1在 Oracle Solaris 11.2 中管理安全 Shell 访问 中的如何使用安全 Shell 远程管理 ZFS,了解进行安全远程登录的说明。

  1. 为 IKEv2 创建一个规则以管理使用 IPsec 的新系统的密钥。
    1. 例如,在 enigma 系统上,将以下规则添加到文件 /etc/inet/ike/ikev2.config
      # pfedit ikev2.config
      ## ikev2.config file on enigma, 192.168.116.16
      ...
      ## The rule to communicate with ada
      ##  Label must be unique
      {label "enigma-ada"
       auth_method preshared
       local_addr  192.168.116.16
       remote_addr 192.168.15.7
      }

      有关 pfedit 命令的选项的信息,请参见 pfedit(1M) 手册页。

    2. ada 系统上,添加以下规则:
      ## ikev2.config file on ada, 192.168.15.7
      ...
      ## The rule to communicate with enigma
      {label "ada-enigma"
       auth_method preshared
       local_addr  192.168.15.7
       remote_addr 192.168.116.16
      }
  2. (u53ef选) 在每个系统上,验证该文件的语法。
    # /usr/lib/inet/in.ikev2d -c -f /etc/inet/ike/ikev2.config
  3. 为对等方系统创建 IKEv2 预先共享的密钥。
    1. enigma 系统上,将以下信息添加到 /etc/inet/ike/ikev2.preshared 文件:
      # pfedit -s /etc/inet/ike/ikev2.preshared
      ## ikev2.preshared on enigma for the ada interface
      ...
      ## The rule to communicate with ada 
      ##  Label must match the label of the rule
      { label "enigma-ada"
        # enigma and ada's shared key
        key "Twas brillig and the slivey toves did *s0mEtHiNg* be CareFULL hEEEr"
      }

      有关 pfedit 命令的选项的信息,请参见 pfedit(1M) 手册页。

    2. ada 系统上,将以下信息添加到 ikev2.preshared 文件:
      # ikev2.preshared on ada for the enigma interface
      # 
      { label "ada-enigma"
        # ada and enigma's shared key
        key "Twas brillig and the slivey toves did *s0mEtHiNg* be CareFULL hEEEr"
      }
  4. 在每个系统上,将变更读入到内核。
    • 如果已启用服务,请刷新此服务。
      # svcadm refresh ikev2
    • 如果未启用服务,请启用它。
      # svcadm enable ikev2

接下来的步骤

如果建立 IPsec 策略未完成,请返回到 IPsec 过程以启用或刷新 IPsec 策略。有关保护 VPN 的 IPsec 策略的示例,请参见使用 IPsec 保护 VPN。有关 IPsec 策略的其他示例,请参见如何使用 IPsec 保护两台服务器之间的网络通信