GRE (Generic Routing Encapsulation) 和 IPSec (Internet Protocol Security) 是两种常见的隧道技术,经常结合使用以提供安全的网络连接。GRE over IPSec 结合了两者的优势:GRE 提供灵活的隧道能力,而 IPSec 提供加密和认证。
[总部网络] --- [总部路由器] --- Internet --- [分支机构路由器] --- [分支机构网络]
总部路由器配置:
interface Tunnel0
ip address 192.168.100.1 255.255.255.252
tunnel source <总部公网IP>
tunnel destination <分支机构公网IP>
keepalive 10 3
分支机构路由器配置:
interface Tunnel0
ip address 192.168.100.2 255.255.255.252
tunnel source <分支机构公网IP>
tunnel destination <总部公网IP>
keepalive 10 3
IKE 阶段1配置 (ISAKMP策略):
crypto isakmp policy 10
encryption aes 256
hash sha256
authentication pre-share
group 14
lifetime 86400
预共享密钥配置:
crypto isakmp key <共享密钥> address <对端公网IP>
IPSec 阶段2配置 (转换集):
crypto ipsec transform-set GRE-TRANSFORM esp-aes 256 esp-sha256-hmac
mode transport
加密映射配置:
crypto map GRE-MAP 10 ipsec-isakmp
set peer <对端公网IP>
set transform-set GRE-TRANSFORM
match address GRE-ACL
ACL 定义需要加密的流量:
access-list GRE-ACL permit gre host <本地公网IP> host <对端公网IP>
应用加密映射到公网接口:
interface <公网接口>
crypto map GRE-MAP
总部路由器:
ip route 10.2.0.0 255.255.0.0 Tunnel0
分支机构路由器:
ip route 10.1.0.0 255.255.0.0 Tunnel0
隧道无法建立
隧道建立但无法通信
性能问题
动态路由协议 over GRE
router ospf 1
network 192.168.100.0 0.0.0.3 area 0
QoS 策略
policy-map QOS-POLICY
class class-default
priority percent 30
NAT 穿越 (NAT-T)
crypto isakmp nat-traversal 20
通过 GRE over IPSec 配置,组织可以在公共互联网上建立安全、可靠的多协议隧道连接,同时保持网络设计的灵活性和可扩展性。