本文档介绍如何在站点到站点IPsec VPN中配置Cisco IOS路由器,在VPN网关后使用重叠的专用网络地址。
本文档没有任何特定的要求。
本文档中的信息基于运行软件版本12.4的Cisco IOS 3640路由器。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
有关文档约定的更多信息,请参考 Cisco 技术提示约定。
本部分提供有关如何配置本文档所述功能的信息。
注意:要获取此部分中所用命令的更多信息,可使用命令查找工具(仅限已注册客户)。
本文档使用以下网络设置:
注意:此配置中使用的IP编址方案在Internet上不能合法路由。这些地址是在实验室环境中使用的 RFC 1918 地址。
Private_LAN1和Private_LAN2的IP子网均为192.168.1.0/24。这会在 IPSec 隧道每一端背后模拟重叠的地址空间。
在本示例中,Site_A路由器执行双向转换,以便两个专用LAN可以通过IPsec隧道通信。转换意味着Private_LAN1通过IPsec隧道“看到”Private_LAN2为10.10.10.0/24,而Private_LAN2通过IPSec隧道“看到”Private_LAN1为10.5.5.0/24。
本文档使用以下配置:
注意:本文档假设路由器已配置了接口配置等基本设置。有关详细信息,请参阅使用SDM的基本路由器配置。
NAT 配置
要使用NAT在Site_A路由器上配置SDM,请完成以下步骤:
选择Configure > NAT > Edit NAT Configuration,然后单击Designate NAT Interfaces以定义受信任和不受信任的接口,如下所示。
Click OK.
单击Add以配置从内部到外部方向的NAT转换,如下所示。
Click OK.
再次单击Add以配置从外部到内部方向的NAT转换,如下所示。
Click OK.
注意:以下是等效的CLI配置:
等效 CLI 配置 | |
---|---|
interface Loopback0 ip nat inside interface Ethernet0/0 ip nat inside ip nat inside source static network 192.168.1.0 10.5.5.0 /24 ip nat outside source static network 192.168.1.0 10.10.10.0 /24 |
VPN 配置
要使用VPN在Site_A路由器上配置SDM,请完成以下步骤:
选择Configure > VPN > VPN Components >IKE > IKE Policies > Add以定义IKE策略,如下图所示。
Click OK.
注意:以下是等效的CLI配置:
等效 CLI 配置 | |
---|---|
crypto isakmp policy 10 encr des hash md5 authentication pre-share group1 |
选择Configure > VPN > VPN Components >IKE > Pre-shared Keys > Add以使用对等IP地址设置预共享密钥值。
Click OK.
注意:以下是等效的CLI配置:
等效 CLI 配置 | |
---|---|
crypto isakmp key 6 L2L12345 address 172.16.1.2 255.255.255.0 |
选择Configure > VPN > VPN Components > IPSec > Transform Sets > Add以创建转换集myset,如下图所示。
Click OK.
注意:以下是等效的CLI配置:
等效 CLI 配置 | |
---|---|
crypto ipsec transform-set myset esp-des esp-md5-hmac |
选择Configure > VPN > VPN Components > IPSec > IPSec Rules(ACLs)> Add以创建加密访问控制列表(ACL)101。
Click OK.
注意:以下是等效的CLI配置:
等效 CLI 配置 | |
---|---|
access-list 101 permit ip 10.5.5.0 0.0.0.255 192.168.1.0 0.0.0.255 |
选择Configure > VPN > VPN Components > IPSec > IPSec Policies > Add以创建加密映射mymap,如下图所示。
单击 Add。
单击General选项卡并保留默认设置。
单击Peer Information选项卡以添加对等IP地址172.16.1.2。
单击Transform Sets选项卡以选择所需的转换集myset。
单击IPSec Rule选项卡以选择现有加密ACL 101。
Click OK.
注意:以下是等效的CLI配置:
等效 CLI 配置 | |
---|---|
crypto map mymap 10 ipsec-isakmp set peer 172.16.1.2 set transform-set myset match address 101 |
选择Configure > VPN > Site-to-Site VPN > Edit Site-to-Site VPN > Add以将加密映射mymap应用到接口Ethernet0/0。
Click OK.
注意:以下是等效的CLI配置:
等效 CLI 配置 | |
---|---|
interface Ethernet0/0 crypto map mymap |
Site_A路由器 |
---|
Site_A#show running-config *Sep 25 21:15:58.954: %SYS-5-CONFIG_I: Configured from console by console Building configuration... Current configuration : 1545 bytes ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname Site_A ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! ! ! ip cef ! ! crypto isakmp policy 10 hash md5 authentication pre-share !--- Defines ISAKMP policy. crypto isakmp key 6 L2L12345 address 172.16.1.2 255.255.255.0 !--- Defines pre-shared secret used for IKE authentication ! ! crypto ipsec transform-set myset esp-des esp-md5-hmac !--- Defines IPSec encryption and authentication algorithms. ! crypto map mymap 10 ipsec-isakmp set peer 172.16.1.2 set transform-set myset match address 101 !--- Defines crypto map. ! ! ! ! interface Loopback0 ip address 192.168.1.1 255.255.255.0 ip nat inside ip virtual-reassembly ! interface Ethernet0/0 ip address 10.1.1.2 255.255.255.0 ip nat outside ip virtual-reassembly half-duplex crypto map mymap !--- Apply crypto map on the outside interface. ! ! !--- Output Suppressed ! ip http server no ip http secure-server ! ip route 0.0.0.0 0.0.0.0 10.1.1.1 ! ip nat inside source static network 192.168.1.0 10.5.5.0 /24 !--- Static translation defined to translate Private_LAN1 !--- from 192.168.1.0/24 to 10.5.5.0/24. !--- Note that this translation is used for both !--- VPN and Internet traffic from Private_LAN1. !--- A routable global IP address range, or an extra NAT !--- at the ISP router (in front of Site_A router), is !--- required if Private_LAN1 also needs internal access. ip nat outside source static network 192.168.1.0 10.10.10.0 /24 !--- Static translation defined to translate Private_LAN2 !--- from 192.168.1.0/24 to 10.10.10.0/24. ! access-list 101 permit ip 10.5.5.0 0.0.0.255 192.168.1.0 0.0.0.255 !--- Defines IPSec interesting traffic. !--- Note that the host behind Site_A router communicates !--- to Private_LAN2 using 10.10.10.0/24. !--- When the packets arrive at the Site_A router, they are first !--- translated to 192.168.1.0/24 and then encrypted by IPSec. ! ! control-plane ! ! line con 0 line aux 0 line vty 0 4 ! ! end Site_A# |
Site_B路由器 |
---|
Site_B#show running_config Building configuration... Current configuration : 939 bytes ! version 12.2 service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname Site_B ! ! ip subnet-zero ! ! crypto isakmp policy 10 hash md5 authentication pre-share crypto isakmp key L2L12345 address 10.1.1.2 255.255.255.0 ! ! crypto ipsec transform-set myset esp-des esp-md5-hmac ! crypto map mymap 10 ipsec-isakmp set peer 10.1.1.2 set transform-set myset match address 101 ! ! ! ! interface Ethernet0 ip address 192.168.1.1 255.255.255.0 ! interface Ethernet1 ip address 172.16.1.2 255.255.255.0 crypto map mymap ! !--- Output Suppressed ! ip classless ip route 0.0.0.0 0.0.0.0 172.16.1.1 ip http server ! access-list 101 permit ip 192.168.1.0 0.0.0.255 10.5.5.0 0.0.0.255 ! line con 0 line aux 0 line vty 0 4 ! end Site_B# |
本部分所提供的信息可用于确认您的配置是否正常工作。
命令输出解释程序(仅限注册用户)(OIT) 支持某些 show 命令。使用 OIT 可查看对 show 命令输出的分析。
show crypto isakmp sa -显示所有当前在对等端的互联网密钥交换(IKE)安全关联(SAs)。
Site_A#show crypto isakmp sa dst src state conn-id slot status 172.16.1.2 10.1.1.2 QM_IDLE 1 0 ACTIVE
show crypto isakmp sa detail — 显示对等体上的所有当前IKE SA的详细信息。
Site_A#show cryto isakmp sa detail Codes: C - IKE configuration mode, D - Dead Peer Detection K - Keepalives, N - NAT-traversal X - IKE Extended Authentication psk - Preshared key, rsig - RSA signature renc - RSA encryption C-id Local Remote I-VRF Status Encr Hash Auth DH Lifetime Cap. 1 10.1.1.2 172.16.1.2 ACTIVE des md5 psk 1 23:59:42 Connection-id:Engine-id = 1:1(software)
show crypto ipsec sa - 显示当前 SA 使用的设置。
Site_A#show crypto ipsec sa interface: Ethernet0/0 Crypto map tag: mymap, local addr 10.1.1.2 protected vrf: (none) local ident (addr/mask/prot/port): (10.5.5.0/255.255.255.0/0/0) remote ident (addr/mask/prot/port): (192.168.1.0/255.255.255.0/0/0) current_peer 172.16.1.2 port 500 PERMIT, flags={origin_is_acl,} #pkts encaps: 2, #pkts encrypt: 2, #pkts digest: 2 #pkts decaps: 2, #pkts decrypt: 2, #pkts verify: 2 #pkts compressed: 0, #pkts decompressed: 0 #pkts not compressed: 0, #pkts compr. failed: 0 #pkts not decompressed: 0, #pkts decompress failed: 0 #send errors 3, #recv errors 0 local crypto endpt.: 10.1.1.2, remote crypto endpt.: 172.16.1.2 path mtu 1500, ip mtu 1500, ip mtu idb Ethernet0/0 current outbound spi: 0x1A9CDC0A(446487562) inbound esp sas: spi: 0x99C7BA58(2580003416) transform: esp-des esp-md5-hmac , in use settings ={Tunnel, } conn id: 2002, flow_id: SW:2, crypto map: mymap sa timing: remaining key lifetime (k/sec): (4478520/3336) IV size: 8 bytes replay detection support: Y Status: ACTIVE inbound ah sas: inbound pcp sas: outbound esp sas: spi: 0x1A9CDC0A(446487562) transform: esp-des esp-md5-hmac , in use settings ={Tunnel, } conn id: 2001, flow_id: SW:1, crypto map: mymap sa timing: remaining key lifetime (k/sec): (4478520/3335) IV size: 8 bytes replay detection support: Y Status: ACTIVE outbound ah sas: outbound pcp sas: Site_A#
show ip nat translations — 显示转换插槽信息。
Site_A#show ip nat translations Pro Inside global Inside local Outside local Outside global --- --- --- 10.10.10.1 192.168.1.1 --- --- --- 10.10.10.0 192.168.1.0 --- 10.5.5.1 192.168.1.1 --- --- --- 10.5.5.0 192.168.1.0 --- ---
show ip nat statistics — 显示有关转换的静态信息。
Site_A#show ip nat statistics Total active translations: 4 (2 static, 2 dynamic; 0 extended) Outside interfaces: Ethernet0/0 Inside interfaces: Loopback0 Hits: 42 Misses: 2 CEF Translated packets: 13, CEF Punted packets: 0 Expired translations: 7 Dynamic mappings: Queued Packets: 0 Site_A#
要验证连接,请完成以下步骤:
在SDM中,选择Tools > Ping,以便建立源IP为192.168.1.1、目标IP为10.10.10.1的IPsec VPN隧道。
单击Test Tunnel以检查是否已建立IPsec VPN隧道,如下图所示。
单击开始。
本部分提供的信息可用于对配置进行故障排除。
Site_A#debug ip packet IP packet debugging is on Site_A#ping Protocol [ip]: Target IP address: 10.10.10.1 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 192.168.1.1 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: Packet sent with a source address of 192.168.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 40/45/52 ms Site_A# *Sep 30 18:08:10.601: IP: tableid=0, s=192.168.1.1 (local), d=10.10.10.1 (Ethern et0/0), routed via FIB *Sep 30 18:08:10.601: IP: s=192.168.1.1 (local), d=10.10.10.1 (Ethernet0/0), len 100, sending *Sep 30 18:08:10.641: IP: tableid=0, s=10.10.10.1 (Ethernet0/0), d=192.168.1.1 ( Loopback0), routed via RIB *Sep 30 18:08:10.641: IP: s=10.10.10.1 (Ethernet0/0), d=192.168.1.1, len 100, rc vd 4 *Sep 30 18:08:10.645: IP: tableid=0, s=192.168.1.1 (local), d=10.10.10.1 (Ethern et0/0), routed via FIB *Sep 30 18:08:10.645: IP: s=192.168.1.1 (local), d=10.10.10.1 (Ethernet0/0), len 100, sending *Sep 30 18:08:10.685: IP: tableid=0, s=10.10.10.1 (Ethernet0/0), d=192.168.1.1 ( Loopback0), routed via RIB *Sep 30 18:08:10.685: IP: s=10.10.10.1 (Ethernet0/0), d=192.168.1.1, len 100, rc vd 4 *Sep 30 18:08:10.685: IP: tableid=0, s=192.168.1.1 (local), d=10.10.10.1 (Ethern et0/0), routed via FIB *Sep 30 18:08:10.689: IP: s=192.168.1.1 (local), d=10.10.10.1 (Ethernet0/0), len 100, sending *Sep 30 18:08:10.729: IP: tableid=0, s=10.10.10.1 (Ethernet0/0), d=192.168.1.1 ( Loopback0), routed via RIB *Sep 30 18:08:10.729: IP: s=10.10.10.1 (Ethernet0/0), d=192.168.1.1, len 100, rc vd 4 *Sep 30 18:08:10.729: IP: tableid=0, s=192.168.1.1 (local), d=10.10.10.1 (Ethern et0/0), routed via FIB *Sep 30 18:08:10.729: IP: s=192.168.1.1 (local), d=10.10.10.1 (Ethernet0/0), len 100, sending *Sep 30 18:08:10.769: IP: tableid=0, s=10.10.10.1 (Ethernet0/0), d=192.168.1.1 ( Loopback0), routed via RIB *Sep 30 18:08:10.769: IP: s=10.10.10.1 (Ethernet0/0), d=192.168.1.1, len 100, rc vd 4 *Sep 30 18:08:10.773: IP: tableid=0, s=192.168.1.1 (local), d=10.10.10.1 (Ethern et0/0), routed via FIB *Sep 30 18:08:10.773: IP: s=192.168.1.1 (local), d=10.10.10.1 (Ethernet0/0), len 100, sending *Sep 30 18:08:10.813: IP: tableid=0, s=10.10.10.1 (Ethernet0/0), d=192.168.1.1 ( Loopback0), routed via RIB *Sep 30 18:08:10.813: IP: s=10.10.10.1 (Ethernet0/0), d=192.168.1.1, len 100, rc vd 4
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
24-Sep-2008 |
初始版本 |