組網需求
如圖1所示,RouterA為企業分支網關,RouterB為企業總部網關,分支與總部通過公網建立通信。分支子網為10.1.1.0/24,總部子網為10.1.2.0/24。企業希望對分支子網與總部子網之間相互訪問的流量進行安全保護。分支與總部通過公網建立通信,可以在分支網關與總部網關之間建立一個IPSec隧道來實施安全保護。由於維護網關較少,可以考慮採用手工方式建立IPSec隧道。
組網圖
圖1 配置採用手工方式建立IPSec隧道
操作步驟
1. RouterA的配置
#
sysname RouterA
#
acl number 3101 //配置ACL 3101,匹配從分支子網到總部子網的流量
rule 5 permit ip source 10.1.1.0 0.0.0.255destination 10.1.2.0 0.0.0.255
#
ipsec proposaltran1 //配置IPSec安全提議
esp authentication-algorithm sha2-256
esp encryption-algorithm aes-128
#
ipsec policy map110 manual //配置手動方式安全策略
security acl 3101
proposal tran1
tunnel local 1.1.1.1
tunnel remote 2.1.1.1
sa spi inbound esp 54321
sa string-key inbound esp cipher%^%#JvZxR2g8c;a9~FPN~n'$7`DEV&=G(=Et02P/%\*!%^%# //配置入方向SA的認證密鑰為huawei
sa spi outbound esp 12345
sa string-key outbound esp cipher%^%#K{JG:rWVHPMnf;5\|,GW(Luq'qi8BT4nOj%5W5=)%^%# //配置出方向SA的認證密鑰為huawei
#
interfaceGigabitEthernet1/0/0
ip address 1.1.1.1 255.255.255.0
ipsec policy map1
#
interfaceGigabitEthernet2/0/0
ip address 10.1.1.1 255.255.255.0
#
ip route-static2.1.1.0 255.255.255.0 1.1.1.2 //配置一條目的地址是總部外網出口的靜態路由
ip route-static10.1.2.0 255.255.255.0 1.1.1.2 //配置一條目的地址是總部內網的靜態路由
#
return
2. RouterB的配置
#
sysname RouterB
#
acl number3101 //配置ACL3101,匹配從總部子網到分支子網的流量
rule 5 permit ip source 10.1.2.0 0.0.0.255destination 10.1.1.0 0.0.0.255
#
ipsec proposaltran1 //配置IPSec安全提議
esp authentication-algorithm sha2-256
esp encryption-algorithm aes-128
#
ipsec policy use110 manual //配置手動方式安全策略
security acl 3101
proposal tran1
tunnel local 2.1.1.1
tunnel remote 1.1.1.1
sa spi inbound esp 12345
sa string-key inbound esp cipher%^%#IRFGEiFPJ1$&a'Qy,L*XQL_+*Grq-=yMb}ULZdS6%^%# //配置入方向SA的認證密鑰為huawei
sa spi outbound esp 54321
sa string-key outbound esp cipher %^%#(3fr1!&6O=)!GN#~{)n,2fq>4#4+%;lMTs5(]:c)%^%# //配置出方向SA的認證密鑰為huawei
#
interfaceGigabitEthernet1/0/0
ip address 2.1.1.1 255.255.255.0
ipsec policy use1
#
interfaceGigabitEthernet2/0/0
ip address 10.1.2.1 255.255.255.0
#
ip route-static1.1.1.0 255.255.255.0 2.1.1.2 //配置一條目的地址是分支外網出口的靜態路由
ip route-static10.1.1.0 255.255.255.0 2.1.1.2 //配置一條目的地址是分支內網的靜態路由
#
return
3. 驗證配置結果
在RouterA上執行display ipsec sa命令,可以查看IPSec隧道上配置的信息。
配置注意事項
· 分支的ACL需要與總部ACl互為鏡像。
· 總部和分支之間的外網地址路由可達。
· 所有的IPSec策略都綁定在對應的外網出接口上。
· 總部和各個分支之間都採用相同的pre-shared-key。