6-V P N:NAT对IPSEC的影响

一、实验拓扑:
用实验5的拓扑
6-V P N:NAT对IPSEC的影响
二、实验要求:
三、命令部署:
1、ACL抓取1.1.1.1到any的流量:
R1(config)#ip access-list extended pat
R1(config-ext-nacl)#permit ip 1.1.1.0 255.255.255.0 any
2、部署PAT技术:
R1(config)#ip nat inside source list pat interface f0/0 overload
R1(config)#int f0/0
R1(config-if)#ip nat outside
R1(config)#int lo0
R1(config-if)#ip nat inside
测试:
R1#ping 3.3.3.3 source 1.1.1.1 //正常应该不通的
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1 !!!!!
R1#show ip nat tran
R1#show ip nat translations //空的
查看ACL、NAT配置:
R1#show access-lists
Extended IP access list pat
10 permit ip 0.0.0.0 255.255.255.0 any
R1#show run | s nat
ip nat inside
ip nat outside
ip nat inside source list pat interface FastEthernet0/0 overload
3、修改ACL,之前写错了:
R1(config)#ip access-list extended pat
R1(config-ext-nacl)#permit ip 1.1.1.0 0.0.0.255 any //路由器用反掩码
测试:
R1#ping 3.3.3.3 source loopback 0 //达到了实验效果
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
UUUUU
Success rate is 0 percent (0/5)
查看转换:
R1#show ip nat translations //查看路由器的转换列表

抓包看流量:
R1#ping 3.3.3.3 source loopback 0

可以看到:都是黑色的标识,正常出包应该是1.1.1.1——>3.3.3.3,但是因为做了NAT转换所以是12.1.1.1——>3.3.3.3;回包应该是3.3.3.3——>1.1.1.1,实际做了NAT转换是:3.3.3.3——>12.1.1.1。
解决方法一:
在ACL中往前插入一个序号为5的deny ACL,这样它会先匹配序号为5的ACL:
R1#show access-lists
Extended IP access list pat
10 permit ip 1.1.1.0 0.0.0.255 any
R1(config)#ip access-list extended pat
R1(config-ext-nacl)#5 deny ip 1.1.1.0 0.0.0.255 3.3.3.0 0.0.0.255
测试1:
R1#ping 3.3.3.3 source 1.1.1.1 //匹配了ACL 5,不做NAT转换,所以就是ESP的流量了。
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1 !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/30/40 ms
抓包:

测试2:
R1#ping 23.1.1.3 source 1.1.1.1 //这个也可以通,但是地址是有NAT转换的,实际是12.1.1.1——>3.3.3.3;因为流量出去时候不匹配ACL 5,匹配ACL 10,所以会转换。
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1 !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 96/102/116 ms
抓包:

解决方法二:
不要让流量从inside进去,不要从outside出来;或者不要让流量从inside进去,可以从outside出来:比如在其它进口写inside,不要在1.1.1.1的环回口下写。
要实现 nat 就要满足 3 个条件:
感兴趣流(满足),inside 接口进(不满足),outside 接口出。
这时必须还要在加一台路由器,所以我加了 R4,因为我之前做的是用环 回口 1.1.1.1,自身发起的流量,这个自身的流量 route-map 是控制不了的。一 定要让这个流量从某一个物理接口进入,我这个策略才好使。
这块如何用route-map呢???

猜你喜欢

转载自blog.51cto.com/13856092/2138540
今日推荐