当前位置: 首页 > news >正文

IPsec-VPN中文解释

网络括谱图

IPSec-VPN 配置思路

1 配置IP地址

FWA:IP地址的配置

[FW1000-A]interface  GigabitEthernet  1/0/0 

[FW1000-A-GigabitEthernet1/0/0]ip address  10.1.1.1 24  //配置IP地址

[FW1000-A]interface  GigabitEthernet  1/0/2

[FW1000-A-GigabitEthernet1/0/2]ip address  2.2.2.1 24

FWB:IP地址配置

[FW1000-B]interface  GigabitEthernet  1/0/3

[FW1000-B-GigabitEthernet1/0/3]ip address  10.1.2.1 24

[FW1000-B]interface  GigabitEthernet  1/0/4

[FW1000-B-GigabitEthernet1/0/4]ip add

[FW1000-B-GigabitEthernet1/0/4]ip address  2.2.3.1 24

INTERNET-SW1:将接口开成三层接口

[INTERENT-SW]interface  GigabitEthernet  1/0/1

[INTERENT-SW-GigabitEthernet1/0/1]port link-mode  route  //交换机的模式是三层

[INTERENT-SW-GigabitEthernet1/0/1]ip address  2.2.2.2 24

[INTERENT-SW-GigabitEthernet1/0/1]quit

[INTERENT-SW-GigabitEthernet1/0/3]port link-mode  route

[INTERENT-SW-GigabitEthernet1/0/3]ip address  2.2.3.2 24

2 防火墙的接口加入指定的防火墙区域

(Local

Turst

Untrust

DMZ 

Management)

FWA:配置思路

[FW1000-A]security-zone  name  Trust  //进入对应的区域

[FW1000-A-security-zone-Trust]import  interface  GigabitEthernet  1/0/0

//将接口加入到指定的区域

[FW1000-B-security-zone-Trust]quit

[FW1000-A]security-zone name  Untrust 

[FW1000-A-security-zone-Untrust]import  interface  GigabitEthernet  1/0/2

[FW1000-A-security-zone-Untrust]

FWB配置思路

[FW1000-B]security-zone  name  Trust 

[FW1000-B-security-zone-Trust]import  interface  GigabitEthernet  1/0/3

[FW1000-B-security-zone-Trust]quit

[FW1000-B]security-zone  name  Untrust

[FW1000-B-security-zone-Untrust]import  interface  GigabitEthernet  1/0/4

3 防火墙的接口默认是封 ping的需要解ping

FWA配置思路

[FW1000-A-GigabitEthernet1/0/0]manage  ping  outbound //出口流量解ping

[FW1000-A-GigabitEthernet1/0/0]manage  ping  inbound  //入口流量解ping

[FW1000-A-GigabitEthernet1/0/0]quit

[FW1000-A-GigabitEthernet1/0/2]manage  ping  outbound

[FW1000-A-GigabitEthernet1/0/2]manage  ping  inbound

FWB配置思路

[FW1000-B]interface  GigabitEthernet  1/0/4

[FW1000-B-GigabitEthernet1/0/4]manage  ping  outbound

[FW1000-B-GigabitEthernet1/0/4]manage  ping  inbound

[FW1000-B-GigabitEthernet1/0/4]quit

[FW1000-B]interface  GigabitEthernet  1/0/3

[FW1000-B-GigabitEthernet1/0/3]manage  ping outbound

[FW1000-B-GigabitEthernet1/0/3]manage  ping in

[FW1000-B-GigabitEthernet1/0/3]manage  ping inbound 0/3]

4 防火墙配置静态路由

FWA配置:

[FW1000-A]ip route-static 10.1.2.0 24 2.2.2.2

//配置静态路由 ip route-static 目标地址 掩码 下一条

[FW1000-A]ip route-static 2.2.3.1 24 2.2.2.2

FWB配置:

[FW1000-B]ip route-static 10.1.1.0 24 2.2.3.2

[FW1000-B]ip route-static 2.2.2.1 24 2.2.3.2

5 配置IPsec隧道策略

配置安全策略放行Untrust与Local安全域之间的流量,用于设备之间可以建立IPsec隧道。

FWA

security-policy ip //进入防火墙的策略

rule name ipseclocalout  //给规则命名字

source-zone local //源区域是 local

备注:local区域是指防火墙上的所有对应的接口

destination-zone untrust //目标区域是 不信任区域 指定的是公网区域

备注: untrust 指定的是外网区域,通常指定的是不可信认的区域

source-ip-host 2.2.2.1 //源接口的IP地址

destination-ip-host 2.2.3.1 //目标接口的IP地址

action pass //使用 "action pass" 可以覆盖这一默认行为,允许特定的流量通过。

Quit //退出

rule name ipseclocalin

source-zone untrust

destination-zone local

source-ip-host 2.2.3.1

destination-ip-host 2.2.2.1

action pass

quit

6 配置安全策略从信任的区域到不信任的区域 trust-untrust

rule name trust-untrust

source-zone trust

destination-zone untrust

source-ip-subnet 10.1.1.0 24

destination-ip-subnet 10.1.2.0 24

action pass

quit

解释:

    规则名称:"trust-untrust",这是该规则的标识名称,方便管理和识别。

    源安全域:"trust",表示数据包的发送方所在的网络区域被划分为 "trust" 安全域,通常代表内部网络或受信任的网络。

    目的安全域:"untrust",表示数据包的接收方所在的网络区域被划分为 "untrust" 安全域,通常代表外部网络或不受信任的网络。

    源IP地址范围:"10.1.1.0 24",指定了允许发送数据包的源IP地址范围,即10.1.1.0到10.1.1.255(子网掩码为255.255.255.0)。

    目的IP地址范围:"10.1.2.0 24",指定了允许接收数据包的目的IP地址范围,即10.1.2.0到10.1.2.255。

    动作:"action pass",定义了当数据包符合上述条件时,防火墙将执行的动作,这里是 "pass",即允许数据包通过。

    退出命令:"quit",用于退出当前的安全策略配置模式。

rule name untrust-trust

source-zone untrust

destination-zone trust

source-ip-subnet 10.1.2.0 24

destination-ip-subnet 10.1.1.0 24

action pass

quit

quit

7 配置ACL 规则

配置ACL规则(高级ACL)

acl advanced 3101

rule permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255

quit

解释:

    rule permit:表示这是一个允许(permit)规则。

    ip:指定该规则适用于IP数据包。

    source 10.1.1.0 0.0.0.255:指定源IP地址范围为10.1.1.0到10.1.1.255(子网掩码为255.255.255.0,即24位掩码)。

    destination 10.1.2.0 0.0.0.255:指定目的IP地址范围为10.1.2.0到10.1.2.255(同样是一个24位掩码的子网)。

8 配置IPsec安全提议,协商封装报文使用的各种安全协议

ipsec transform-set tran1

encapsulation-mode tunnel

protocol esp

esp encryption-algorithm aes-cbc-128

esp authentication-algorithm sha1

quit

解释:

  1. 创建IPSec转换集: ipsec transform-set tran1 命令创建了一个名为 tran1 的IPSec转换集,这是一组安全参数,用于定义IPSec隧道的加密和认证方法。
  2. 设置封装模式: encapsulation-mode tunnel 指定了封装模式为隧道模式,这意味着原始数据包将被完全封装在新的IPSec数据包中,包括源IP和目的IP地址。
  3. 选择协议: protocol esp 选择了ESP协议,它是IPSec的两个主要协议之一,用于在IP层提供数据的加密和认证。
  4. 加密算法: esp encryption-algorithm aes-cbc-128 设置了加密算法为AES-CBC-128,即采用128位密钥的高级加密标准(AES)的密码块链(CBC)模式,这是一种常用的、安全性较高的加密方法。
  5. 认证算法: esp authentication-algorithm sha1 设置了认证算法为SHA-1,即安全哈希算法1,用于验证数据的完整性和来源,防止数据在传输过程中被篡改。
  6. 退出命令模式: quit 命令用于退出当前的配置模式,返回到上一级命令行界面。

9 配置IPsec安全策略,建立IPsec隧道,保护需要防护的数据流

ipsec policy map1 10 manual

security acl 3101

transform-set tran1

remote-address 2.2.3.1

sa spi outbound esp 12345

sa spi inbound esp 54321

sa string-key outbound esp simple abcdefg

sa string-key inbound esp simple gfedcbasa

quit

  1. 创建IPSec安全策略: ipsec policy map1 10 manual 创建了一个名为 map1 的IPSec安全策略,序列号为10,并且是手动模式(manual),这意味着IPSec安全关联(SA)需要手动建立。
  2. 引用访问控制列表(ACL): security acl 3101 指定了该IPSec安全策略将使用编号为3101的ACL来确定哪些流量需要通过IPSec进行保护。
  3. 指定IPSec转换集: transform-set tran1 指定了该IPSec安全策略将使用名为 tran1 的转换集,该转换集定义了加密和认证算法等安全参数。
  4. 配置对端IP地址: remote-address 2.2.3.1 指定了IPSec隧道的对端IP地址为2.2.3.1。
  5. 配置安全关联(SA)的SPI值:
    • sa spi outbound esp 12345 为出站(outbound)的ESP协议配置了一个SPI(Security Parameters Index)值为12345。
    • sa spi inbound esp 54321 为入站(inbound)的ESP协议配置了一个SPI值为54321。
  6. 配置SA的密钥:
    • sa string-key outbound esp simple abcdefg 为出站SA配置了一个简单的字符串密钥“abcdefg”。
    • sa string-key inbound esp simple gfedcbasa 为入站SA配置了一个简单的字符串密钥“gfedcbasa”。

10 在接口上应用IPsec安全策略,对接口上的流量进行保护

interface gigabitethernet 1/0/2

ipsec apply policy map1

quit

  1. interface gigabitethernet 1/0/2
    这条命令用于进入名为GigabitEthernet 1/0/2的网络接口配置模式。这个接口可以是物理接口,也可以是逻辑接口,用于连接网络设备和其他设备,如路由器、交换机或终端设备。
  2. ipsec apply policy map1
    这条命令将名为map1的IPSec安全策略应用到GigabitEthernet 1/0/2接口上。这意味着所有通过该接口的、符合策略map1中定义的ACL(访问控制列表)规则的数据流都将被IPSec保护。这包括数据的加密、认证等安全操作,

11 配置IPsec隧道策略

配置安全策略放行Untrust与Local安全域之间的流量,用于设备之间可以建立IPsec隧道。

security-policy ip

rule name ipseclocalout

source-zone local

destination-zone

source-ip-host 2.2.3.1

destination-ip-host 2.2.2.1

action pass

quit

rule name ipseclocalin

source-zone untrust

destination-zone local

source-ip-host 2.2.2.1

destination-ip-host 2.2.3.1

action pass

quit

12 配置安全策略

配置安全策略 trust-untrust  untrust-trust

rule name trust-untrust

source-zone trust

destination-zone untrust

source-ip-subnet 10.1.2.0 24

destination-ip-subnet 10.1.1.0 24

action pass

quit

rule name untrust-trust

source-zone untrust

destination-zone trust

source-ip-subnet 10.1.1.0 24

destination-ip-subnet 10.1.2.0 24

action pass

quit

quit

13 配置ACL规则

acl advanced 3101

rule permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255

quit

14 配置IPsec安全提议,协商封装报文使用的各种安全协议

ipsec transform-set tran1

encapsulation-mode tunnel

protocol esp

esp encryption-algorithm aes-cbc-128

esp authentication-algorithm sha1

quit

15 配置IPsec安全策略,建立IPsec隧道,保护需要防护的数据流

ipsec policy usel 10 manual

security acl 3101

transform-set tran1

remote-address 2.2.2.1

sa spi outbound esp 54321

sa spi inbound esp 12345

sa string-key outbound esp simple gfedcba

sa string-key inbound esp simple abcdefg

quit

16 在接口上应用IPsec安全策略,对接口上的流量进行保护

interface gigabitethernet 1/0/

ipsec apply policy usel

quit

17 查看配置

<FW1000-A>display  ipsec tunnel   //查看隧道管理

Tunnel ID: 0

Status: Active

SA's SPI:

    outbound:  12345       (0x00003039)   [ESP]  

    inbound:   54321       (0x0000d431)   [ESP]  

Tunnel:

    local  address: 2.2.2.1

    remote address: 2.2.3.1

Flow:

    as defined in IPv4 ACL 3101

<FW1000-A>

<FW1000-A>display  ipsec statistics

  IPsec packet statistics:

    Received/sent packets: 0/0

    Received/sent bytes: 0/0

    Received/sent packet rate: 0/0 packets/sec

    Received/sent byte rate: 0/0 bytes/sec

    Dropped packets (received/sent): 0/0

    Dropped packets statistics

      No available SA: 0

      Wrong SA: 0

      Invalid length: 0

      Authentication failure: 0

      Encapsulation failure: 0

      Decapsulation failure: 0

      Replayed packets: 0

      ACL check failure: 0

      MTU check failure: 0

      Loopback limit exceeded: 0

      Crypto speed limit exceeded: 0

<FW1000-A>display  ipsec policy  //查看ipsec的框架

-------------------------------------------

IPsec Policy: map1

Interface: GigabitEthernet1/0/2

-------------------------------------------

  -----------------------------

  Sequence number: 10

  Mode: Manual

  -----------------------------

  Security data flow: 3101

  Remote address: 2.2.3.1

  Transform set: tran1

  Inbound AH setting:

    AH SPI:

    AH string-key:

    AH authentication hex key:

  Inbound ESP setting:

    ESP SPI: 54321 (0x0000d431)

    ESP string-key: ******

    ESP encryption hex key:

    ESP authentication hex key:

              

  Outbound AH setting:

    AH SPI:

    AH string-key:

    AH authentication hex key:

  Outbound ESP setting:

    ESP SPI: 12345 (0x00003039)

    ESP string-key: ******

    ESP encryption hex key:

    ESP authentication hex key:

<FW1000-A>display  ipse transform-set   // 显示IPsec安全提议的信息

IPsec transform set: tran1

  State: complete

  Encapsulation mode: tunnel

  ESN: Disabled

  PFS:

  Transform: ESP

  ESP protocol:

    Integrity: SHA1

    Encryption: AES-CBC-128

<FW1000-B>display  ipsec sa  //显示SA 相关信息

-------------------------------

Interface: GigabitEthernet1/0/4

-------------------------------

  -----------------------------

  IPsec policy: usel

  Sequence number: 10

  Mode: Manual

  -----------------------------

    Tunnel id: 0

    Encapsulation mode: tunnel

    Path MTU: 1428

    Tunnel:

        local  address: 2.2.3.1

        remote address: 2.2.2.1

    Flow:

        as defined in ACL 3101

    [Inbound ESP SA]

      SPI: 12345 (0x00003039)

      Connection ID: 4294967297

      Transform set: ESP-ENCRYPT-AES-CBC-128 ESP-AUTH-SHA1

      No duration limit for this SA

    [Outbound ESP SA]

      SPI: 54321 (0x0000d431)

      Connection ID: 4294967296

      Transform set: ESP-ENCRYPT-AES-CBC-128 ESP-AUTH-SHA1

      No duration limit for this SA

<FW1000-B>

<FW1000-A>display  ipsec  sa

-------------------------------

Interface: GigabitEthernet1/0/2

-------------------------------

  -----------------------------

  IPsec policy: map1

  Sequence number: 10

  Mode: Manual

  -----------------------------

    Tunnel id: 0

    Encapsulation mode: tunnel

    Path MTU: 1428

    Tunnel:

        local  address: 2.2.2.1

        remote address: 2.2.3.1

    Flow:

        as defined in ACL 3101

    [Inbound ESP SA]

      SPI: 54321 (0x0000d431)

      Connection ID: 4294967297

      Transform set: ESP-ENCRYPT-AES-CBC-128 ESP-AUTH-SHA1

      No duration limit for this SA

    [Outbound ESP SA]

      SPI: 12345 (0x00003039)

      Connection ID: 4294967296

      Transform set: ESP-ENCRYPT-AES-CBC-128 ESP-AUTH-SHA1

      No duration limit for this SA

<FW1000-A>


http://www.mrgr.cn/news/32996.html

相关文章:

  • Vue极简入门
  • 不要死磕技术,还是要产品化
  • 图像生成大模型 Imagen:重塑创意的未来
  • 排序----快速排序(快排)(递归版)
  • 构建高可用和高防御力的云服务架构第一部分:深入解析DDoS高防(1/5)
  • git submodule
  • 低代码可视化工具-uniapp页面跳转传参-代码生成器
  • 为什么喝酱酒会回甘?
  • T4—猴痘识别
  • Redis数据结构之哈希表
  • 【HTTP】请求“报头”,Referer 和 Cookie
  • 盘点3款.NetCore(C#)开源免费商城系统
  • C++(2)进阶语法
  • 十四、运算放大电路
  • 初中数学证明集锦之三角形内角和
  • 【小沐学GIS】blender导入OpenStreetMap城市建筑(blender-osm、blosm)
  • 结构体对齐、函数传参、库移植
  • Spring:统一结果私有属性造成的前端无法访问异常报错问题
  • 博客管理系统可行性分析报告
  • Elionix 电子束曝光系统