实验拓扑:
实验环境:
本案例采用H3C HCL模拟器的MSR30-20路由器来模拟GRE OVER IPSCE的典型组网配置。内网和外网在网络拓扑图中已经有了明确的标识。RT1与RT2均为各自内网的出口设备,提供NAT地址转换的服务。为了内网1和内网2能跨越外网实现通信,因为在RT1和RT2之间采用GRE VPN建立隧道,同时为了保证数据传输的安全性,将ipsec嵌入到GRE VPN隧道中。
配置思路:
1、按照网络拓扑图正确配置IP地址
2、RT1配置NAT,并配置默认路由指向ISP
3、RT2配置NAT,并配置默认路由指向ISP
4、RT1与RT2建立GRE VPN隧道
5、在GRE VPN隧道的基础上在嵌套IPSEC
实验步骤:
ISP:
#
interface GigabitEthernet0/0
port link-mode route
ip address 100.1.1.2 255.255.255.0
#
interface GigabitEthernet0/1
port link-mode route
ip address 200.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2
port link-mode route
ip address 210.1.1.1 255.255.255.0
#
北京
#
ospf 1 # 配置OSPF,并进入OSPF视图。
import-route static
area 0.0.0.0 # 引入静态路由。
network 10.1.1.0 0.0.0.255 # 发布路由。
network 20.1.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
#
interface GigabitEthernet0/0
port link-mode route
ip address 100.1.1.1 255.255.255.0
nat outbound # 配置出方向动态地址转换。
ipsec apply policy BJ # 在接口上应用IPsec安全策略。
#
interface GigabitEthernet0/1
port link-mode route
ip address 192.168.1.1 255.255.255.0
#
interface Tunnel0 mode gre # 创建一个Tunnel接口,指定隧道模式,并进入该Tunnel接口视图。
ip address 10.1.1.1 255.255.255.0
source 100.1.1.1 # 配置tunnel口源地址。
destination 200.1.1.2 # 配置tunnel口目标地址。
#
interface Tunnel1 mode gre
ip address 20.1.1.1 255.255.255.0
source 100.1.1.1
destination 210.1.1.2
#
ip route-static 0.0.0.0 0 100.1.1.2 # 配置静态路由
#
acl advanced 3001 # 创建一个编号为3001的IPv4高级ACL,并进入其视图。
rule 0 permit ip source 100.1.1.0 0.0.0.255 destination 200.1.1.0 0.0.0.255 #为IPv4高级ACL 3001创建规则如下:允许100.1.1.0/24网段内的主机与200.1.1.0/24网段内主机建立连接。
#
acl advanced 3002
rule 5 permit ip source 100.1.1.0 0.0.0.255 destination 210.1.1.0 0.0.0.255
#
ipsec transform-set BJ # 创建名为BJ的IPsec安全提议,并进入IPsec安全提议视图。
esp encryption-algorithm aes-cbc-128 # 配置ESP协议采用的加密算法。
esp authentication-algorithm sha1 # 配置ESP协议采用的认证算法。
#
ipsec policy-template SH 1 # 创建一个IPsec安全策略模板,并进入IPsec安全策略模板视图。
transform-set BJ # 配置IPsec安全策略引用IPsec安全提议。
security acl 3001 # 指定IPsec安全策略IPsec安全策略模板引用的ACL。
remote-address 200.1.1.2 # 指定IPsec隧道的对端IP地址。
ike-profile SH # 指定IPsec安全策略/IPsec安全策略模板引用的IKE profile。
#
ipsec policy-template WH 1
transform-set BJ
security acl 3002
remote-address 210.1.1.2
ike-profile WH
#
ipsec policy BJ 1 isakmp template SH # 创建名字为BJ、顺序号为1的IPsec安全策略。
#
ipsec policy BJ 2 isakmp template WH
#
ike profile SH # 创建IKE profile,并进入其视图。
keychain SH # 在IKE profile中指定配置的IKE keychain。
local-identity address 100.1.1.1 # 指定使用IP地址标识本端身份。
match remote identity address 200.1.1.2 255.255.255.255 # 指定需要匹配对端身份类型为IP地址.
proposal 1 # 配置IKE profile引用的IKE提议。
#
ike profile WH
keychain WH
local-identity address 100.1.1.1
match remote identity address 210.1.1.2 255.255.255.255
proposal 1
#
ike proposal 1 # 创建IKE提议,并进入IKE提议视图。
#
ike keychain SH # 创建IKE keychain并进入IKE keychain视图。
pre-shared-key address 200.1.1.2 255.255.255.255 key simple 123456 # 配置预共享密钥。
#
ike keychain WH
pre-shared-key address 210.1.1.2 255.255.255.255 key simple 123456
#
上海
#
ospf 1
import-route static
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
interface GigabitEthernet0/0
port link-mode route
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet0/1
port link-mode route
ip address 200.1.1.2 255.255.255.0
nat outbound
ipsec apply policy SH
#
interface Tunnel0 mode gre
ip address 10.1.1.2 255.255.255.0
source 200.1.1.2
destination 100.1.1.1
#
ip route-static 0.0.0.0 0 200.1.1.1
#
acl advanced 3001
rule 0 permit ip source 200.1.1.0 0.0.0.255 destination 100.1.1.0 0.0.0.255
#
ipsec transform-set SH
esp encryption-algorithm aes-cbc-128
esp authentication-algorithm sha1
#
ipsec policy SH 1 isakmp
transform-set SH
security acl 3001
remote-address 100.1.1.1
ike-profile SH
#
ike profile SH
keychain SH
local-identity address 200.1.1.2
match remote identity address 100.1.1.1 255.255.255.255
proposal 1
#
ike proposal 1
#
ike keychain SH
pre-shared-key address 100.1.1.1 255.255.255.255 simple 123456
#
武汉
#
ospf 1
import-route static
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
#
interface GigabitEthernet0/0
port link-mode route
ip address 192.168.3.1 255.255.255.0
#
interface GigabitEthernet0/1
combo enable copper
#
interface GigabitEthernet0/2
port link-mode route
ip address 210.1.1.2 255.255.255.0
nat outbound
ipsec apply policy WH
#
interface Tunnel1 mode gre
ip address 20.1.1.2 255.255.255.0
source 210.1.1.2
destination 100.1.1.1
#
ip route-static 0.0.0.0 0 210.1.1.1
#
acl advanced 3001
rule 0 permit ip source 210.1.1.0 0.0.0.255 destination 100.1.1.0 0.0.0.255
#
ipsec transform-set WH
esp encryption-algorithm aes-cbc-128
esp authentication-algorithm sha1
#
ipsec policy WH 1 isakmp
transform-set WH
security acl 3001
remote-address 100.1.1.1
ike-profile WH
#
ike profile WH
keychain WH
local-identity address 210.1.1.2
match remote identity address 100.1.1.1 255.255.255.255
proposal 1
#
ike proposal 1
#
ike keychain WH
pre-shared-key address 100.1.1.1 255.255.255.255 key simple 123456
#
实验验证:
北京:
总部与分部之间互通
dis ike sa
dis ipsce sa
路由信息
查询IP地址和接口信息
上海:
dis ike sa
dis ipse sa
查询路由信息
查询IP地址与接口状态
武汉:
dis ike sa
dis ipse sa
查询路由信息
查询IP地址与接口状态
文章转自:林三岁网络安全实验室