IPsec VPN配置方式

news2025/6/19 9:23:53

一、手工方式建立

手工方式建立IPsec的场景,全部参数需要手工配置,工作量大,适用于小型静态网络。

当企业总部与分支通过FW1和FW2之间建立的IPsec隧道进行安全通信。

手工配置步骤主要有四个:

①定义需要保护的数据流;

②配置IPsec安全提议,两端通过对方的提议决定是否成为盟友,封装模式、安全协议、加密算法、验证算法均在此处配置;

③配置手工方式的IPsec策略,指定总部和分支防火墙的公网地址、安全联盟标识符SPI,以及加密密钥和验证密钥;、

④应用IPsec策略。

[Fw1]acl number 3000
[Fw1-acl-adv-3000]rule 5 permit ip source 192.168.0.0 0.0.0.255 destination 172.
16.0.0 0.0.0.255
[Fw1-acl-adv-3000]quit

[Fw1]ipsec proposal pro1
[Fw1-ipsec-proposal-pro1]transform esp
[Fw1-ipsec-proposal-pro1]encapsulation-mode tunnel
[Fw1-ipsec-proposal-pro1]esp authentication-algorithm sha2-256
[Fw1-ipsec-proposal-pro1]esp encryption-algorithm aes-256
[Fw1-ipsec-proposal-pro1]quit

[Fw1]ipsec policy policy1 1 manual
[Fw1-ipsec-policy-manual-policy1-1]security acl 3000
[Fw1-ipsec-policy-manual-policy1-1]proposal pro1
[Fw1-ipsec-policy-manual-policy1-1]tunnel local 1.1.1.1
[Fw1-ipsec-policy-manual-policy1-1]tunnel remote 2.2.2.1
[Fw1-ipsec-policy-manual-policy1-1]sa spi inbound esp 54321
[Fw1-ipsec-policy-manual-policy1-1]sa spi outbound esp 12345
[Fw1-ipsec-policy-manual-policy1-1]sa string-key inbound esp huawei@123
[Fw1-ipsec-policy-manual-policy1-1]sa string-key outbound esp huawei@456

[Fw1]interface g1/0/1
[Fw1-GigabitEthernet1/0/1]ipsec policy policy1

[Fw1]ip route-static 172.16.0.0 24 1.1.1.2
[FW2]acl number 3000
[FW2-acl-adv-3000]rule 5 permit ip source 172.16.0.0 0.0.0.255 destination 192.1
68.0.0 0.0.0.255
[FW2-acl-adv-3000]quit

[FW2]ipsec proposal pro1
[FW2-ipsec-proposal-pro1]transform esp
[FW2-ipsec-proposal-pro1]encapsulation-mode tunnel
[FW2-ipsec-proposal-pro1]esp authentication-algorithm sha2-256
[FW2-ipsec-proposal-pro1]esp encryption-algorithm aes-256
[FW2-ipsec-proposal-pro1]quit

[FW2]ipsec policy policy1 1 manual
[FW2-ipsec-policy-manual-policy1-1]security acl 3000
[FW2-ipsec-policy-manual-policy1-1]proposal pro1
[FW2-ipsec-policy-manual-policy1-1]tunnel local 2.2.2.1
[FW2-ipsec-policy-manual-policy1-1]tunnel remote 1.1.1.1
[FW2-ipsec-policy-manual-policy1-1]sa spi inbound esp 12345
[FW2-ipsec-policy-manual-policy1-1]sa spi outbound esp 54321
[FW2-ipsec-policy-manual-policy1-1]sa string-key inbound esp huawei@456
[FW2-ipsec-policy-manual-policy1-1]sa string-key outbound esp huawei@123

[FW2]interface g1/0/1
[FW2-GigabitEthernet1/0/1]ipsec policy policy1

[FW2]ip route-static 192.168.0.0 24 2.2.2.2
[Fw1]firewall zone trust
[Fw1-zone-trust]add interface g1/0/0
[Fw1-zone-trust]firewall zone untrust
[Fw1-zone-untrust]add interface g1/0/1

[Fw1-policy-security]display this
2024-03-08 11:53:20.430 
#
security-policy
 rule name tr_to_untr
  source-zone trust
  destination-zone untrust
  source-address 192.168.0.0 mask 255.255.255.0
  destination-address 172.16.0.0 mask 255.255.255.0
  action permit
 rule name local_to_untr
  source-zone local
  destination-zone untrust
  source-address 1.1.1.1 mask 255.255.255.255
  destination-address 2.2.2.1 mask 255.255.255.255
  action permit
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 2.2.2.1 mask 255.255.255.255
  destination-address 1.1.1.1 mask 255.255.255.255
  action permit
 rule name untr_to_tr
  source-zone untrust
  destination-zone trust
  source-address 172.16.0.0 mask 255.255.255.0
  action permit
#
return


[FW2]firewall zone trust
[FW2-zone-trust]add interface g1/0/0
[FW2-zone-trust]firewall zone untrust
[FW2-zone-untrust]add interface g1/0/1

[FW2-policy-security]display this 
2024-03-08 11:56:43.140 
#
security-policy
 rule name tr_to_untr
  source-zone trust
  destination-zone untrust
  source-address 172.16.0.0 mask 255.255.255.0
  destination-address 192.168.0.0 mask 255.255.255.0
  action permit
 rule name local_to_untr
  source-zone local
  destination-zone untrust
  source-address 2.2.2.1 mask 255.255.255.255
  destination-address 1.1.1.1 mask 255.255.255.255
  action permit
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 1.1.1.1 mask 255.255.255.255
  destination-address 2.2.2.1 mask 255.255.255.255
  action permit
 rule name untr_to_tr
  source-zone untrust
  destination-zone trust
  source-address 192.168.0.0 mask 255.255.255.0
  destination-address 172.16.0.0 mask 255.255.255.0
  action permit
#
return

注意:配置Trust域与Untrust域之间的域间安全策略、配置Untrust域与Local域之间的域间安全策略。

当PC1 ping PC2时,通过抓包可以发现,去程包的SPI为0x00003039,即12345,回程为0x0000等31 ,即54321。

分析报文内容,ESP报文头部内消息被加密。

若采用AH,抓包分析,可见AH没有加密功能,只有验证功能。

二、IKE方式建立

1、ISAKMP方式的IPsec策略

相比手工配置的方式,采用ISAKMP方式的IPsec策略配置步骤只多了两步,配置IKE安全提议和IKE对等体,以IKEv1为例。

ISAKMP方式的IPsec策略配置示意图可参考下图:

[Fw1]ike proposal 10
[Fw1-ike-proposal-10]display this
2024-03-09 07:28:31.710 
#
ike proposal 10
 encryption-algorithm aes-256
 dh group14
 authentication-algorithm sha2-256
 authentication-method pre-share
 integrity-algorithm hmac-sha2-256
 prf hmac-sha2-256
#
return

[Fw1]ike peer b
[Fw1-ike-peer-b]ike-proposal 10
[Fw1-ike-peer-b]undo version 2
[Fw1-ike-peer-b]exchange-mode main
[Fw1-ike-peer-b]remote-address 2.2.2.1
[Fw1-ike-peer-b]pre-shared-key test1

[Fw1]acl number 3000
[Fw1-acl-adv-3000]display this
2024-03-09 07:30:58.010 
#
acl number 3000
 rule 5 permit ip source 192.168.0.0 0.0.0.255 destination 172.16.0.0 0.0.0.255
#
return

[Fw1]ipsec proposal a
[Fw1-ipsec-proposal-a]transform esp
[Fw1-ipsec-proposal-a]encapsulation-mode tunnel
[Fw1-ipsec-proposal-a]esp authentication-algorithm sha2-256
[Fw1-ipsec-proposal-a]esp encryption-algorithm aes-256

[Fw1]ipsec policy policy1 1 isakmp 
Info: The ISAKMP policy sequence number should be smaller than the template poli
cy sequence number in the policy group. Otherwise, the ISAKMP policy does not ta
ke effect.
[Fw1-ipsec-policy-isakmp-policy1-1]security acl 3000
[Fw1-ipsec-policy-isakmp-policy1-1]proposal a
[Fw1-ipsec-policy-isakmp-policy1-1]ike-peer b

[Fw1]interface g1/0/1
[Fw1-GigabitEthernet1/0/1]ipsec policy policy1

[Fw1]ip route-static 172.16.0.0 24 1.1.1.2

[FW2]ike proposal 10
[FW2-ike-proposal-10]quit

[FW2]ike peer a
[FW2-ike-peer-a]ike-proposal 10
[FW2-ike-peer-a]undo version 2
[FW2-ike-peer-a]exchange-mode main
[FW2-ike-peer-a]remote-address 1.1.1.1
[FW2-ike-peer-a]pre-shared-key test1

[FW2]acl number 3000
[FW2-acl-adv-3000]display this
2024-03-09 07:36:12.140 
#
acl number 3000
 rule 5 permit ip source 172.16.0.0 0.0.0.255 destination 192.168.0.0 0.0.0.255
#
return

[FW2]ipsec proposal b
[FW2-ipsec-proposal-b]transform esp
[FW2-ipsec-proposal-b]encapsulation-mode tunnel
[FW2-ipsec-proposal-b]esp authentication-algorithm sha2-256
[FW2-ipsec-proposal-b]esp encryption-algorithm aes-256

[FW2]ipsec policy policy1 1 isakmp
Info: The ISAKMP policy sequence number should be smaller than the template poli
cy sequence number in the policy group. Otherwise, the ISAKMP policy does not ta
ke effect.
[FW2-ipsec-policy-isakmp-policy1-1]security acl 3000
[FW2-ipsec-policy-isakmp-policy1-1]proposal b
[FW2-ipsec-policy-isakmp-policy1-1]ike-peer a

[FW2]interface g1/0/1
[FW2-GigabitEthernet1/0/1]ipsec policy policy1

[FW2]ip route-static 192.168.0.0 24 2.2.2.2

FW2的web配置方式与FW1类似,此处不再赘述。

安全策略的配置仍与手工配置一致即可。

[Fw1]firewall zone trust
[Fw1-zone-trust]add interface g1/0/0
[Fw1-zone-trust]firewall zone untrust
[Fw1-zone-untrust]add interface g1/0/1

[Fw1-policy-security]display this
2024-03-08 11:53:20.430 
#
security-policy
 rule name tr_to_untr
  source-zone trust
  destination-zone untrust
  source-address 192.168.0.0 mask 255.255.255.0
  destination-address 172.16.0.0 mask 255.255.255.0
  action permit
 rule name local_to_untr
  source-zone local
  destination-zone untrust
  source-address 1.1.1.1 mask 255.255.255.255
  destination-address 2.2.2.1 mask 255.255.255.255
  action permit
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 2.2.2.1 mask 255.255.255.255
  destination-address 1.1.1.1 mask 255.255.255.255
  action permit
 rule name untr_to_tr
  source-zone untrust
  destination-zone trust
  source-address 172.16.0.0 mask 255.255.255.0
  action permit
#
return


[FW2]firewall zone trust
[FW2-zone-trust]add interface g1/0/0
[FW2-zone-trust]firewall zone untrust
[FW2-zone-untrust]add interface g1/0/1

[FW2-policy-security]display this 
2024-03-08 11:56:43.140 
#
security-policy
 rule name tr_to_untr
  source-zone trust
  destination-zone untrust
  source-address 172.16.0.0 mask 255.255.255.0
  destination-address 192.168.0.0 mask 255.255.255.0
  action permit
 rule name local_to_untr
  source-zone local
  destination-zone untrust
  source-address 2.2.2.1 mask 255.255.255.255
  destination-address 1.1.1.1 mask 255.255.255.255
  action permit
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 1.1.1.1 mask 255.255.255.255
  destination-address 2.2.2.1 mask 255.255.255.255
  action permit
 rule name untr_to_tr
  source-zone untrust
  destination-zone trust
  source-address 192.168.0.0 mask 255.255.255.0
  destination-address 172.16.0.0 mask 255.255.255.0
  action permit
#
return

抓包分析可见,SPI是随机生成的,以及用了ESP,具有加密功能。

2、模板方式的IPsec策略

采用模板可以简化多条IPsec隧道建立的配置工作,但是采用模板方式时,采用模板的一端不能主动发起协商,只能作为协商响应的一方接受对端的协商请求,隧道两端不可以同时采用模板配置的方式。

模板方式的IPsec策略示意图如下所示:

此处以点到多点为例,更能体现模板方式的魅力之处,总部与分部1、2如图所示。

AR1基础配置:

[AR1]interface g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 1.1.1.2 24
[AR1-GigabitEthernet0/0/1]quit
[AR1]interface g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 2.2.2.2 24
[AR1-GigabitEthernet0/0/0]quit
[AR1]interface g0/0/2
[AR1-GigabitEthernet0/0/2]ip add 3.3.3.2 24

[AR1]ip route-static 192.168.0.0 24 1.1.1.1
[AR1]ip route-static 172.16.1.0 24 2.2.2.1
[AR1]ip route-static 172.16.2.0 24 3.3.3.1

FW1基础配置:

[FW1]interface g1/0/0
[FW1-GigabitEthernet1/0/0]ip add 192.168.0.254 24
[FW1-GigabitEthernet1/0/0]quit
[FW1]interface g1/0/1
[FW1-GigabitEthernet1/0/1]ip add 1.1.1.1 24
[FW1-GigabitEthernet1/0/1]quit

[FW1]firewall zone untrust
[FW1-zone-untrust]add interface g1/0/1
[FW1-zone-untrust]quit
[FW1]firewall zone trust
[FW1-zone-trust]add interface g1/0/0

[FW1]ip route-static 172.16.1.0 24 1.1.1.2
[FW1]ip route-static 172.16.2.0 24 1.1.1.2

FW2基础配置:

[FW2]interface g1/0/0
[FW2-GigabitEthernet1/0/0]ip add 172.16.1.254 24
[FW2-GigabitEthernet1/0/0]quit
[FW2]interface g1/0/1
[FW2-GigabitEthernet1/0/1]ip add 2.2.2.1 24
[FW2-GigabitEthernet1/0/1]quit

[FW2]firewall zone trust
[FW2-zone-trust]add interface g1/0/0
[FW2-zone-trust]quit
[FW2]firewall zone untrust
[FW2-zone-untrust]add interface g1/0/1
[FW2-zone-untrust]quit

[FW2]ip route-static 192.168.0.0 24 2.2.2.2

FW3基础配置:

[FW3]interface g1/0/0
[FW3-GigabitEthernet1/0/0]ip add 172.16.2.254 24
[FW3-GigabitEthernet1/0/0]quit
[FW3]interface g1/0/1
[FW3-GigabitEthernet1/0/1]ip add 3.3.3.1 24
[FW3-GigabitEthernet1/0/1]quit

[FW3]firewall zone trust
[FW3-zone-trust]add interface g1/0/0
[FW3-zone-trust]quit
[FW3]firewall zone untrust
[FW3-zone-untrust]add interface g1/0/1
[FW3-zone-untrust]quit

[FW3]ip route-static 192.168.0.0 24 3.3.3.2

总部采用模板方式进行配置,分部采用ISAKMP方式配置IPsec策略,若总部配置remote-address指定隧道对端IP地址端,那么总部会检查分部设备的ID(IP地址)是否包含在IP地址段中,包含则接纳请求,若没有配置remote-address,总部职能接收分部的主动访问,不验证分部,也不主动访问分支。

可见模板方式可以应付对端没有固定IP地址、没有公网IP地址的局面,当然这都是总部放弃主动访问分部为代价所获得的。

[FW1]ike proposal 10
[FW1-ike-proposal-10]quit

[FW1]ike peer a
[FW1-ike-peer-a]ike-proposal 10
[FW1-ike-peer-a]pre-shared-key test1
Info: The password you entered does not meet the minimum complexity requirement.
The password is suggested to contain at least three types of characters from the
 following four groups: Uppercase letters <A-Z>; Lowercase letters <a-z>; Numera
ls <0-9>; Symbols (all characters not defined as letters or numerals), such as !
,$,#, and %.
[FW1-ike-peer-a]quit

[FW1]acl number 3000
[FW1-acl-adv-3000]rule 5 permit ip source 192.168.0.0 0.0.0.255 destination 172.16.1.0 0.0.0.255
[FW1-acl-adv-3000]rule 10 permit ip source 192.168.0.0 0.0.0.255 destination 172.16.2.0 0.0.0.255
[FW1-acl-adv-3000]quit

[FW1]ipsec proposal a
[FW1-ipsec-proposal-a]display this
2024-03-09 08:27:29.610 
#
ipsec proposal a
 esp authentication-algorithm sha2-256
 esp encryption-algorithm aes-256
#
return

[FW1]ipsec policy-template teml 1
[FW1-ipsec-policy-templet-teml-1]display this
2024-03-09 08:42:17.640 
#
ipsec policy-template teml 1
 security acl 3000
 ike-peer a
 proposal a
#
return

[FW1]ipsec policy policy1 12 isakmp  template teml
Info: The ISAKMP policy sequence number should be smaller than the template poli
cy sequence number in the policy group. Otherwise, the ISAKMP policy does not ta
ke effect.

[FW1]interface g1/0/1
[FW1-GigabitEthernet1/0/1]ipsec policy policy1


[FW2]ike proposal 10
[FW2-ike-proposal-10]quit

[FW2]ike peer a
[FW2-ike-peer-a]ike-proposal 10
[FW2-ike-peer-a]remote-address 1.1.1.1
[FW2-ike-peer-a]pre-shared-key test1
Info: The password you entered does not meet the minimum complexity requirement.
The password is suggested to contain at least three types of characters from the
 following four groups: Uppercase letters <A-Z>; Lowercase letters <a-z>; Numera
ls <0-9>; Symbols (all characters not defined as letters or numerals), such as !
,$,#, and %.
[FW2-ike-peer-a]quit

[FW2]acl number 3000
[FW2-acl-adv-3000]rule 5 permit ip source 172.16.1.0 0.0.0.255 destination 192.168.0.0 0.0.0.255
[FW2-acl-adv-3000]quit

[FW2]ipsec proposal a
[FW2-ipsec-proposal-a]display this
2024-03-09 08:34:23.380 
#
ipsec proposal a
 esp authentication-algorithm sha2-256
 esp encryption-algorithm aes-256
#
return
[FW2-ipsec-proposal-a]quit

[FW2]ipsec policy policy1 1 isakmp
Info: The ISAKMP policy sequence number should be smaller than the template poli
cy sequence number in the policy group. Otherwise, the ISAKMP policy does not ta
ke effect.
[FW2-ipsec-policy-isakmp-policy1-1]security acl 3000
[FW2-ipsec-policy-isakmp-policy1-1]proposal a
[FW2-ipsec-policy-isakmp-policy1-1]ike-peer a
[FW2-ipsec-policy-isakmp-policy1-1]quit

[FW2]interface g1/0/1
[FW2-GigabitEthernet1/0/1]ipsec policy policy1

安全策略配置

[FW1-policy-security]display this
2024-03-09 08:47:30.710 
#
security-policy
 rule name tr_to_untr
  source-zone trust
  destination-zone untrust
  source-address 192.168.0.0 mask 255.255.255.0
  destination-address 172.16.1.0 mask 255.255.255.0
  destination-address 172.16.2.0 mask 255.255.255.0
  action permit
 rule name local_to_untr
  source-zone local
  destination-zone untrust
  source-address 1.1.1.1 mask 255.255.255.255
  destination-address 2.2.2.1 mask 255.255.255.255
  destination-address 3.3.3.1 mask 255.255.255.255
  action permit
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 2.2.2.1 mask 255.255.255.255
  source-address 3.3.3.1 mask 255.255.255.255
  destination-address 1.1.1.1 mask 255.255.255.255
  action permit
 rule name untr_to_tr
  source-zone untrust
  destination-zone trust
  source-address 172.16.1.0 mask 255.255.255.0
  source-address 172.16.2.0 mask 255.255.255.0
  action permit
#
return

[FW2-policy-security]display this
2024-03-09 08:51:27.580 
#
security-policy
 rule name tr_to_untr
  source-zone trust
  destination-zone untrust
  source-address 172.16.1.0 mask 255.255.255.0
  destination-address 192.168.0.0 mask 255.255.255.0
  action permit
 rule name local_to_untr
  source-zone local
  destination-zone untrust
  source-address 2.2.2.1 mask 255.255.255.255
  destination-address 1.1.1.1 mask 255.255.255.255
  action permit
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 1.1.1.1 mask 255.255.255.255
  destination-address 2.2.2.1 mask 255.255.255.255
  action permit
 rule name untr_to_tr
  source-zone untrust
  destination-zone trust
  source-address 192.168.0.0 mask 255.255.255.0
  destination-address 172.16.1.0 mask 255.255.255.0
  action permit
#
return

FW3配置!!!可以自己动手!!!

[FW3]ike proposal 10
[FW3-ike-proposal-10]quit

[FW3]ike peer a
[FW3-ike-peer-a]ike-proposal 10
[FW3-ike-peer-a]remote-address 1.1.1.1
[FW3-ike-peer-a]pre-shared-key test1
Info: The password you entered does not meet the minimum complexity requirement.
The password is suggested to contain at least three types of characters from the
 following four groups: Uppercase letters <A-Z>; Lowercase letters <a-z>; Numera
ls <0-9>; Symbols (all characters not defined as letters or numerals), such as !
,$,#, and %.
[FW3-ike-peer-a]quit

[FW3]acl number 3000
[FW3-acl-adv-3000]rule 5 permit ip source 172.16.2.0 0.0.0.255 destination 192.1
68.0.0 0.0.0.255
[FW3-acl-adv-3000]quit

[FW3]ipsec proposal a
[FW3-ipsec-proposal-a]quit

[FW3]ipsec policy policy1 1 isakmp
Info: The ISAKMP policy sequence number should be smaller than the template poli
cy sequence number in the policy group. Otherwise, the ISAKMP policy does not ta
ke effect.
[FW3-ipsec-policy-isakmp-policy1-1]security acl 3000
[FW3-ipsec-policy-isakmp-policy1-1]proposal a
[FW3-ipsec-policy-isakmp-policy1-1]ike-peer a
[FW3-ipsec-policy-isakmp-policy1-1]quit

[FW3]interface g1/0/1
[FW3-GigabitEthernet1/0/1]ipsec policy policy1
[FW3-policy-security]display this
2024-03-09 08:56:25.110 
#
security-policy
 rule name tr_to_untr
  source-zone trust
  destination-zone untrust
  source-address 172.16.2.0 mask 255.255.255.0
  destination-address 192.168.0.0 mask 255.255.255.0
  action permit
 rule name local_to_untr
  source-zone local
  destination-zone untrust
  source-address 3.3.3.1 mask 255.255.255.255
  destination-address 1.1.1.1 mask 255.255.255.255
  action permit
 rule name untr_to_local
  source-zone untrust
  destination-zone local
  source-address 1.1.1.1 mask 255.255.255.255
  destination-address 3.3.3.1 mask 255.255.255.255
  action permit
 rule name untr_to_tr
  source-zone untrust
  destination-zone trust
  source-address 192.168.0.0 mask 255.255.255.0
  destination-address 172.16.2.0 mask 255.255.255.0
  action permit
#
return

经过测试可知,分部网络均可以访问总部,但是总部不可以主动访问分部,这就是模板方式,采用模板的一端不能主动发起协商,只能作为协商响应的一方接受对端的协商请求,隧道两端不可以同时采用模板配置的方式。

当分部访问总部,此时的总部可知。

抓包分析,可知数据均加密。


参考资料:防火墙和VPN技术与实践——李学昭

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1503514.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

使用 Mendix 中的 OIDC 模块集成 Azure AD SSO

前言 在当今快速发展的数字化世界中&#xff0c;企业追求高效率和灵活性已成为常态。Mendix&#xff0c;作为一个先进的低代码开发平台&#xff0c;正是企业快速响应市场需求、加速数字化转型过程的利器。通过其直观的可视化开发环境&#xff0c;即使是非技术背景的用户也能设…

c#触发事件

Demo1 触发事件 <Window x:Class"WPFExample.MainWindow"xmlns"http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x"http://schemas.microsoft.com/winfx/2006/xaml"Title"WPF Example" Height"600" Wi…

谷歌 Gemma 安装教程

目录 一、概述 二、安装 Ollama 三、安装 Docker 四、安装 Open WebUI 五、测试 结束 一、概述 Gemma 是谷歌推出了全新的开源模型。Gemma 是免费的&#xff0c;模型权重也一并开源了&#xff0c;并且允许商用&#xff0c;支持安装在本地&#xff0c;即使了断网依然使用…

PyQt5开发基础知识【一】

零.前言&#xff1a; 作者写这篇博客的目的主要在于巩固PyQt5的基础知识&#xff0c;例如PyQt5的几个核心模块&#xff0c;分别有什么功能&#xff0c;PyQt5的所有控件的使用方法等。 一.PyQt5的常见模块 1.1QtCore&#xff1a; 该模块包含了非GUI的功能设计。 这个模块被…

二 centos 7.9 磁盘挂载

上一步 一 windso10 笔记本刷linux cent os7.9系统-CSDN博客 笔记本有两个盘,系统装在128G的系统盘上,现在把另外一个盘挂载出来使用 lsblk 发现磁盘已经分好了,直接挂载就好了,参考文章:Centos7.9 挂载硬盘_centos7.9挂载硬盘-CSDN博客 永久挂载 lsblk -f分区格式化 mkfs…

图形库实战丨C语言扫雷小游戏(超2w字,附图片素材)

目录 效果展示 游玩链接&#xff08;无需安装图形库及VS&#xff09; 开发环境及准备 1.VS2022版本 2.图形库 游戏初始化 1.头文件 2.创建窗口 3.主函数框架 开始界面函数 1.初始化 1-1.设置背景颜色及字体 1-2.处理背景音乐及图片素材 1-3.处理背景图位置 2.选…

数据结构从入门到精通——队列

队列 前言一、队列1.1队列的概念及结构1.2队列的实现1.3队列的实现1.4扩展 二、队列面试题三、队列的具体实现代码Queue.hQueue.ctest.c队列的初始化队列的销毁入队列出队列返回队头元素返回队尾元素检测队列是否为空检测元素个数 前言 队列是一种特殊的线性数据结构&#xff…

141 Linux 系统编程18 ,线程,线程实现原理,ps –Lf 进程 查看

一 线程概念 什么是线程 LWP&#xff1a;light weight process 轻量级的进程&#xff0c;本质仍是进程(在Linux环境下) 进程&#xff1a;独立地址空间&#xff0c;拥有PCB 线程&#xff1a;有独立的PCB&#xff0c;但没有独立的地址空间(共享) 区别&#xff1a;在于是否共…

1、Ajax、get、post、ajax,随机颜色

一、Ajax初始 1、什么是Ajax&#xff1f; 异步的JavaScript和xml 2、xml是什么&#xff1f; 一种标记语言&#xff0c;传输和存储数据----------现在用JSON传输数据 3、Ajax的作用 局部加载 可以使网页异步更新 4、Ajax的原理或者步骤(6步) 创建Ajax对象 if (window.X…

【BUG】删除git本地仓库/远程仓库历史版本中的大文件以减少仓库大小

目录 前言排查过程解决过程通过如下命令查找历史大文件删除大文件&#xff0c;重构历史版本提交添加.ignore文件 总结 前言 某天像往常一样提交代码到gitee仓库&#xff0c;出现代码提交卡住不到的情况 2. 我百思不得姐&#xff0c;坚信bug会自己修复自己的原则等待了5分钟&am…

Python 一步一步教你用pyglet仿制鸿蒙系统里的时钟

目录 鸿蒙时钟 1. 绘制圆盘 2. 创建表类 3. 绘制刻度 4. 刻度数值 5. 添加指针 6. 转动指针 7. 联动时间 8. 时钟走动 鸿蒙时钟 本篇将用python pyglet库复刻华为手机鸿蒙系统闹钟程序的时钟&#xff0c;先在上图中抓取出时分秒针及刻度、表盘的颜色RGB值&#xff1a…

分布式解决方案

目录 1. 分布式ID1-1. 传统方案1-2. 分布式ID特点1-3. 实现方案1-4. 开源组件 1. 分布式ID 1-1. 传统方案 时间戳UUID 1-2. 分布式ID特点 全局唯一高并发高可用 1-3. 实现方案 方案总结&#xff1a; 号段模式 有两台服务器&#xff0c;给第一台服务器分配0-100&#xff0…

考虑局部遮阴的光伏PSO-MPPT控制MATLAB仿真

微❤关注“电气仔推送”获得资料&#xff08;专享优惠&#xff09; 简介 光伏电池阵列的输出特性曲线不是线性变化的。当光伏电池遮荫时&#xff0c;产生的功 率会不断变化&#xff0c;致使光伏电池阵列的输出功率不断变化&#xff0c;其输出特性曲线呈现多峰值的现象。 多峰…

外包干了30天,技术明显退步。。

&#x1f345; 视频学习&#xff1a;文末有免费的配套视频可观看 &#x1f345; 点击文末小卡片&#xff0c;免费获取软件测试全套资料&#xff0c;资料在手&#xff0c;涨薪更快 这次来聊一个大家可能也比较关心的问题&#xff0c;那就是就业城市选择的问题。而谈到这个问题&a…

简单BFF架构设计

又到周五了有了一个小时的闲暇时间简单写点东西&#xff0c;介绍一个简单的BFF的架构。BFF:Backends For Frontends,其实现在是个比较常见的前端架构设计的方案&#xff0c;其最大的优势便在于前端可以高度自由的在Node层做一些server端才可以做的东西&#xff0c;比如SSR、登录…

Day24:安全开发-PHP应用文件管理模块显示上传黑白名单类型过滤访问控制

目录 文件管理模块-上传-过滤机制 文件管理模块-显示-过滤机制 思维导图 PHP知识点 功能&#xff1a;新闻列表&#xff0c;会员中心&#xff0c;资源下载&#xff0c;留言版&#xff0c;后台模块&#xff0c;模版引用&#xff0c;框架开发等 技术&#xff1a;输入输出&#…

示波器探头的使用

无源探头(Tektronix P2220) 阻抗&#xff1a;1Mhz 衰减&#xff1a;10:1/1:1(与探头上的档位X10/X1相关&#xff0c;如果探头没有档位默认为10:1) 探头型号&#xff1a;电压 高压差分探头&#xff08;Tektronix P5200A) 阻抗&#xff1a;1Mhz 衰减&#xff1a;50:1/500:1(…

深入理解python之self

首先明确的是self只有在类的方法中才会有&#xff0c;独立的函数或方法是不必带有self的。self在定义类的方法时是必须有的&#xff0c;虽然在调用时不必传入相应的参数。 self名称不是必须的&#xff0c;在python中self不是关键词&#xff0c;你可以定义成a或b或其它名字都可…

Qt 定时器事件

文章目录 1 定时器事件1.1 界面布局1.2 关联信号槽1.3 重写timerEvent1.4 实现槽函数 启动定时器 2 定时器类 项目完整的源代码 QT中使用定时器&#xff0c;有两种方式&#xff1a; 定时器类&#xff1a;QTimer定时器事件&#xff1a;QEvent::Timer&#xff0c;对应的子类是QTi…

Vue.js+SpringBoot开发大学计算机课程管理平台

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 实验课程档案模块2.2 实验资源模块2.3 学生实验模块 三、系统设计3.1 用例设计3.2 数据库设计3.2.1 实验课程档案表3.2.2 实验资源表3.2.3 学生实验表 四、系统展示五、核心代码5.1 一键生成实验5.2 提交实验5.3 批阅实…