实验目的:
如图所示,某软件开发公司在中小城市建立了分支公司,分支公司开发项目小组所在网络地址为 172.16.10.0/24,该网络的主机可以通过 ××× 访问总公司开发数据服务器(10.10.33.0/24)。分支公司的其他客户端(172.16.20.0/24 网段)可以访问 Internet。
配置步骤及思路:
1.配置pc机
PC1:
IP :172.16.20.1
子网掩码:255.255.255.0
网 关: 172.16.20.254
PC2:
IP :172.16.10.1
子网掩码:255.255.255.0
网 关: 172.16.10.254
Server-PT
IP :10.10.33.1
子网掩码:255.255.255.0
网 关: 10.10.33.254
2.配置路由
R1:
interface g0/0 进入接口
ip address 172.16.20.254 配置网关
no shutdown 激活端口
interface g0/1 进入接口
ip address 172.16.20.254 配置网关
no shutdown 激活端口
interface g0/2 进入接口
ip address 192.168.10.1 配置一个网段
no shutdown 激活端口
R2:
interface f0/0 进入接口
ip address 192.168.10.2 配置一个网段
no shutdown 激活端口
interface f0/1 进入接口
ip address 192.168.20.1 配置一个网段
no shutdown 激活端口
R3:
interface f0/0 进入接口
ip address 192.168.20.2 配置一个网段
no shutdown 激活端口
interface f0/1 进入接口
ip address 192.168.30.1 配置一个网段
no shutdown 激活端口
R4:
interface f0/0 进入接口
ip address 192.168.30.2 配置一个网段
no shutdown 激活端口
interface f0/1 进入接口
ip address 10.10.33.254 配置服务器的网关
no shutdown 激活端口
3.配置路由条目:
R1
写一条默认路由交给下一跳
ip route 0.0.0.0 0.0.0.0 192.168.10.2
R2
写一条默认路由交给下一跳
ip route 0.0.0.0 0.0.0.0 192.168.20.2
因为要有回包所以要写两条静态路由交给下一跳
ip route 172.16.10.0 255.255.255.0 192.168.10.1
ip route 172.16.20.0 255.255.255.0 192.168.10.1
R3 要配置×××所以不用写路由条目
R4 写一条默认路由交给下一跳
ip route 0.0.0.0 0.0.0.0 192.168.30.1
4.配置PAT让pc1可以访问外网
access-list 1 permit 172.16.20.0 0.0.0.255 要转换的内网
ip nat inside source list 1 interface f0/0 overload 要转换的外网边界端口
interface f0/0 进入端口
ip nat inside 确认内网边界
interface f0/1 进入端口
ip nat outside 确认外网边界
验证,测试
注:ping 192.168.30.1 5.配置×××可以让pc2访问研发服务器
在路由2上配置(子公司)
配置 ISAKMP 策略
R1(config)#crypto isakmp policy 1
R1(config-isakmap)#encryption 3des
R1(config-isakmap)#hash sha
R1(config-isakmap)#authentication pre-share
R1(config-isakmap)#group 2
R1(config)#crypto isakmp key tedu address 192.168.30.2
配置 ACL
R1(config)#access-list 100 permit ip 172.16.10.0 0.0.0.255 10.10.33.0 0.0.0.255
配置 IPSec 策略(转换集)
R1(config)#crypto ipsec transform-set yf-set esp-des ah-sha-hmac
配置加密映射集
R1(config)#crypto map yf-map 1 ipsec-isakmp
R1(config-crypto-map)#set peer 192.168.30.2
R1(config-crypto-map)#set transform-set yf-set
R1(config-crypto-map)#match address 100
将映射集应用在接口
R1(config)#interface f0/1
R1(config-if)#crypto map yf-map
在路由R4上配置(总公司)
IPSec ××× 方面的配置
R2(config)#crypto isakmp policy 1
R2(config-isakmap)#encryption 3des
R2(config-isakmap)#hash sha
R2(config-isakmap)#authentication pre-share
R2(config-isakmap)#group 2
R2(config)#crypto isakmp key tedu address 192.168.20.1
R2(config)#access-list 100 permit ip 10.10.33.0 0.0.0.255 172.16.10.0 0.0.0.255
R2(config)#crypto ipsec transform-set yf-set esp-des ah-sha-hmac
//加密和认证算法要与分公司匹配
R2(config)#crypto map yf-map 1 ipsec-isakmp
R2(config-crypto-map)#set peer 192.168.20.1
R2(config-crypto-map)#set transform-set yf-set
R2(config-crypto-map)#match address 100
R2(config)#interface f0/0
R2(config-if)#crypto map yf-map
验证,测试