本文共 5567 字,大约阅读时间需要 18 分钟。
1. 研发小组可以通过×××访问总公司研发服务器,但不能访问internet2. 分公司的其他客户端可以访问internet
Router>enable
Router#conf tRouter(config)#no ip domain lookupRouter(config)#line console 0Router(config-line)#exec-timeout 0Router(config-line)#^ZRouter#conf tRouter(config)#hostname R0R0(config)#inter f0/0R0(config-if)#no shutdownR0(config-if)#ip add 176.16.10.254 255.255.255.0R0(config-if)#inter f0/1R0(config-if)#no shutdownR0(config-if)#ip address 172.16.20.254 255.255.255.0R0(config)#inter f1/0R0(config-if)#no shutR0(config-if)#ip add 192.168.1.1 255.255.255.252R0(config-if)#^Z测试连通性:R0#ping 172.16.10.1Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.10.1, timeout is 2 seconds:.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/3 msR0#ping 172.16.20.1Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.20.1, timeout is 2 seconds:.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 msRouter>en
Router#conf tRouter(config)#hostname R1Router(config)#no ip domain lookupR1(config)#line console 0R1(config-line)#exec-timeout 0R1(config-line)#exitR1(config)#inter f0/1R1(config-if)#no shutdownR1(config-if)#ip add 192.168.1.2 255.255.255.252R1(config-if)#inter f0/0R1(config-if)#no shutdownR1(config-if)#ip add 100.0.0.1 255.255.255.252R1(config-if)#^Z测试连通性:R1#ping 192.168.1.1Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 msRouter>enable
Router#conf tRouter(config)#no ip domain lookupRouter(config)#hostname ISPISP(config)#line console 0ISP(config-line)#exec-timeout 0ISP(config-line)#^ZISP#conf tISP(config)#inter f0/1ISP(config-if)#no shutdownISP(config-if)#ip address 100.0.0.2 255.255.255.252ISP(config-if)#inter f0/0ISP(config-if)#no shutdownISP(config-if)#ip add 200.0.0.1 255.255.255.252ISP(config-if)#^Z测试连通性:ISP#ping 100.0.0.1Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.0.0.1, timeout is 2 seconds:.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 msRouter>enable
Router#conf tRouter(config)#hostname R2R2(config)#no ip domain lookupR2(config)#line console 0R2(config-line)#exec-timeout 0R2(config-line)#exitR2(config)#inter f0/1R2(config-if)#no shutdownR2(config-if)#ip add 200.0.0.2 255.255.255.252R2(config-if)#inter f0/0R2(config-if)#no shutdownR2(config-if)#ip add 10.10.33.254 255.255.255.0R2(config-if)#^Z测试连通性:R2#ping 200.0.0.1Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.0.0.1, timeout is 2 seconds:.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 msR2#ping 10.10.33.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.33.1, timeout is 2 seconds:.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 0/1/5 msR0#conf t
R0(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2R0(config)#^ZR1#conf t
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1R1(config)#ip route 0.0.0.0 0.0.0.0 100.0.0.2R2#conf t
R2(config)#ip route 0.0.0.0 0.0.0.0 200.0.0.1R1(config)#crypto isakmp policy 1
R1(config-isakmp)#encryption 3desR1(config-isakmp)#hash shaR1(config-isakmp)#authentication pre-shareR1(config-isakmp)#group 2R1(config-isakmp)#exitR1(config)#crypto isakmp key hahui address 200.0.0.2R2#conf t
R2(config)#crypto isakmp policy 1R2(config-isakmp)#encryption 3desR2(config-isakmp)#hash shaR2(config-isakmp)#authentication pre-shareR2(config-isakmp)#group 2R2(config)#crypto isakmp key hahui address 100.0.0.1R1(config)#access-list 100 permit ip 172.16.10.0 0.0.0.255 10.10.33.0 0.0.0.255
R1(config)#ip nat inside source list 1 interface f0/0 overloadR1(config)#inter f0/0R1(config-if)#ip nat outsideR1(config-if)#inter f0/1R1(config-if)#ip nat insideR1(config-if)#exitR2(config)#access-list 100 permit ip 10.10.33.0 0.0.0.255 172.16.10.0 0.0.0.255
R1(config)#crypto ipsec transform-set hh-set ah-sha-hmac esp-des
R2(config)#crypto ipsec transform-set hh-set ah-sha-hmac esp-des
R1(config)#crypto map hh-map 1 ipsec-isakmp
R1(config-crypto-map)#set peer 200.0.0.2R1(config-crypto-map)#set transform-set hh-setR1(config-crypto-map)#match address 100R2(config)#crypto map hh-map 1 ipsec-isakmp
R2(config-crypto-map)#set peer 100.0.0.1R2(config-crypto-map)#set transform-set hh-setR2(config-crypto-map)#match address 100R1(config)#inter f0/0
R1(config-if)#crypto map hh-mapR2(config)#inter f0/1
R2(config-if)#crypto map hh-map查看第一阶段状态:
首先要用 流量触发IPSecR1#show crypto isakmp sa
R2#show crypto isakmp sa测试:其他客户端就可以访问internet,就没有权限访问研发服务器了。
开启debug ip nat 查看地址是否转换在R2上开启debug ip packet,观察包的信息,看看地址是否转换1. 研发小组的流量走PAT,不走×××2. 研发小组流量可以走PAT,也可以走×××
具体配置步骤:
1. 研发小组的流量走PAT,不走×××(意思就是可以上网,不能访问研发服务器)
在R1上添加配置:
R1(config)#access-list 1 permit 172.16.10.0 0.0.0.255R1(config)#ip nat inside source list 1 interface f0/0 overload测试:查看地址转换R1添加配置:
要删除access-list 1 permit 172.16.10.0 0.0.0.255这条命令R1(config)#no access-list 1 permit 172.16.10.0 0.0.0.255R1(config)#access-list 110 deny ip 172.16.10.0 0.0.0.255 10.10.33.0 0.0.0.255R1(config)#access-list 110 permit ip any anyR1(config)#ip nat inside source list 110 interface f0/0 overload测试:转载于:https://blog.51cto.com/13555515/2069160