一、拓扑图

思科拓扑--***的一对多应用


二、实验目的

1.使用***一对多。让pc2可以连通pc0和pc1


三、设备ip配置

Pc0:ip地址:10.2.2.1 掩码:255.255.255.0 网关:10.2.2.254
Pc1:ip地址:10.3.3.1 掩码:255.255.255.0 网关:10.3.3.254
Pc2:ip地址:10.1.1.1 掩码:255.255.255.0 网关:10.1.1.254
R1:fa0/0:ip地址:10.1.1.254 掩码:255.255.255.0
R1:fa0/1:ip地址:101.0.0.1 掩码:255.255.255.252
R2:gig0/0:ip地址:101.0.0.2 掩码:255.255.255.252
R2:gig0/1:ip地址:103.0.0.2 掩码:255.255.255.252
R2:gig0/2:ip地址:102.0.0.2 掩码:255.255.255.252
R3:fa0/0:ip地址:102.0.0.1 掩码:255.255.255.252
R3:fa0/1:ip地址:10.2.2.254 掩码:255.255.255.0
R4:fa0/0:ip地址:103.0.0.1 掩码:255.255.255.252
R4:fa0/1:ip地址:10.3.3.254 掩码:255.255.255.0


四、配置思路及代码展示

1.R1配置

Router>enable  //进入系统模式Router#configure terminal  //进入特权模式Router(config)#hostname R1 //设置路由器名称为R1R1(config)#int f0/0 //进入f0/0端口R1(config-if)#no shutdown  //开启端口R1(config-if)#ip add 10.1.1.254 255.255.255.0 //设置网关R1(config-if)#exit //退出R1(config)#int f0/1 //进入f0/1端口R1(config-if)#no shutdown //开启端口R1(config-if)#ip add 101.0.0.1 255.255.255.252 //设置网关R1(config-if)#exit //退出R1(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/1  //设置静态路由fastEthernet 0/1的直连网段为下一跳地址R1(config)#crypto isakmp policy 1  //设置加密协议isakmp策略为1R1(config-isakmp)#encryption 3des //设置加密算法为 3desR1(config-isakmp)#hash sha //设置哈希算法为shaR1(config-isakmp)#authentication pre-share //采用预共享密钥方式R1(config-isakmp)#group 2 //指定DH算法的密钥长度为组2R1(config-isakmp)#exit //退出R1(config)#crypto isakmp key mashuo address 102.0.0.1  //设置加密协议 isakmp 密钥为mashuo指定地址为102.0.0.1R1(config)#access-list 100 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255 //设置acl 100 允许10.1.1.0网段访问10.2.2.0网段R1(config)#crypto ipsec transform-set mashuo-set esp-des esp-sha-hmac //设置加密ipsec策略转换集名称为mashuo-set支持esp-sha-hmacR1(config)#crypto map mashuo-map 1 ipsec-isakmp   //设置映射集 mashuo-map 1 协议为  ipsec-isakmp R1(config-crypto-map)#set peer 102.0.0.1 //102.0.0.1端口建立邻居关系R1(config-crypto-map)#set transform-set mashuo-set //添加ipsec策略转换集 mashuo-setR1(config-crypto-map)#match address 100 //匹配acl 100R1(config-crypto-map)#exit //退出R1(config)#int f0/1 //进入接口f0/1R1(config-if)#crypto map mashuo-map //设置映射集 mashuo-mapR1(config-if)#exit //退出R1(config)#crypto isakmp key mashuo-002 address 103.0.0.1  //设置加密协议 isakmp 密钥为mashuo-002指定地址为103.0.0.1R1(config)#access-list 101 permit ip 10.1.1.0 0.0.0.255 10.3.3.0 0.0.0.255 //设置acl 101 允许10.1.1.0网段访问10.3.3.0网段R1(config)#crypto map mashuo-map 2 ipsec-isakmp  //设置映射集 mashuo-map 2 协议为  ipsec-isakmp R1(config-crypto-map)#set peer 103.0.0.1 //103.0.0.1端口建立邻居关系R1(config-crypto-map)#set transform-set mashuo-set  //添加ipsec策略转换集 mashuo-setR1(config-crypto-map)#match address 101  //匹配acl 100R1(config-crypto-map)#exit //退出

2.R2配置

Router>enable //进入系统模式Router#configure terminal Router(config)#hostname R2 //设置路由器名称为R2R2(config)#int g0/0 //进入g0/0端口R2(config-if)#no shutdown //开启端口R2(config-if)#ip add 101.0.0.2 255.255.255.252 //设置ip地址R2(config-if)#exit //退出R2(config)#int g0/1  //进入g0/1端口R2(config-if)#no shutdown //开启端口R2(config-if)#ip add 103.0.0.2 255.255.255.252  //设置ip地址R2(config-if)#exit //退出R2(config)#int g0/2 //进入g0/2端口R2(config-if)#no shutdown  //开启端口R2(config-if)#ip add 102.0.0.2 255.255.255.252 //设置ip地址R2(config-if)#exit //退出

3.R3配置

Router>enable  //进入系统模式Router#configure terminal  //进入特权模式Router(config)#hostname R3  //设置路由器名称为R3R3(config)#int f0/0  //进入f0/0端口R3(config-if)#no shutdown //开启端口R3(config-if)#ip add 102.0.0.1 255.255.255.252 //设置ip地址R3(config-if)#exit //退出R3(config)#int f0/1 //进入f0/1端口R3(config-if)#no shutdown  //开启端口R3(config-if)#ip add 10.2.2.254 255.255.255.0 //设置ip地址R3(config-if)#exit //退出R3(config)#crypto isakmp policy 1 //设置加密协议isakmp策略为1R3(config-isakmp)#encryption 3des  //设置加密算法为 3desR3(config-isakmp)#hash sha  //设置哈希算法为shaR3(config-isakmp)#authentication pre-share  //采用预共享密钥方式R3(config-isakmp)#group 2 //指定DH算法的密钥长度为组2R3(config-isakmp)#exit  //退出R3(config)#crypto ipsec transform-set mashuo-set esp-des esp-sha-hmac  //设置加密ipsec策略转换集名称为mashuo-set支持esp-sha-hmacR3(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/0 //设置静态路由fastEthernet 0/0的直连网段为下一跳地址R3(config)#crypto isakmp key mashuo address 101.0.0.1 //设置加密协议 isakmp 密钥为mashuo指定地址为101.0.0.1R3(config)#access-list 102 permit ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255   //设置acl 101 允许10.2.2.0网段访问10.1.1.0网段R3(config)#crypto map mashuo-map 2 ipsec-isakmp  //设置映射集 mashuo-map 2 协议为  ipsec-isakmpR3(config-crypto-map)#set peer 101.0.0.1 //101.0.0.1端口建立邻居关系R3(config-crypto-map)#set transform-set mashuo-set //添加ipsec策略转换集 mashuo-setR3(config-crypto-map)#match address 102 //匹配acl 102R3(config-crypto-map)#exit //退出R3(config)#int f0/0 //进入接口f0/0R3(config-if)#crypto map mashuo-map //设置映射集 mashuo-mapR3(config-if)#exit //退出

4.R4配置

Router>enable  //进入系统模式Router#configure terminal  //进入特权模式Router(config)#hostname R4 //设置路由器名称为R4R4(config)#int f0/0 //进入f0/0端口R4(config-if)#no shutdown  //开启端口R4(config-if)#ip add 103.0.0.1 255.255.255.252  //设置ip地址R4(config-if)#exit//退出R4(config)#int f0/1 //进入f0/1端口R4(config-if)#no shutdown  //开启端口R4(config-if)#ip add 10.3.3.254 255.255.255.0 //设置ip地址R4(config-if)#exit //退出R4(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/0 //设置静态路由fastEthernet 0/0的直连网段为下一跳地址R4(config)#crypto isakmp policy 1 //设置加密协议isakmp策略为1R4(config-isakmp)#encryption 3des  //设置加密算法为 3desR4(config-isakmp)#hash sha //设置哈希算法为shaR4(config-isakmp)#authentication pre-share  //采用预共享密钥方式R4(config-isakmp)#group 2  //指定DH算法的密钥长度为组2R4(config-isakmp)#exit //退出R4(config)#access-list 103 permit ip 10.3.3.0 0.0.0.255 10.1.1.0 0.0.0.255 //设置acl 103 允许10.3.3.0网段访问10.1.1.0网段R4(config)#crypto ipsec transform-set mashuo-set esp-des esp-sha-hmac //设置加密ipsec策略转换集名称为mashuo-set支持esp-sha-hmacR4(config)#crypto map mashuo-map 2 ipsec-isakmp //设置映射集 mashuo-map 2 协议为  ipsec-isakmpR4(config-crypto-map)#set peer 101.0.0.1 //101.0.0.1端口建立邻居关系R4(config-crypto-map)#set transform-set mashuo-set //添加ipsec策略转换集 mashuo-setR4(config-crypto-map)#match address 103 //匹配acl 103R4(config-crypto-map)#exit //退出R4(config)#int f0/0 //进入接口f0/0R4(config-if)#crypto map mashuo-map //设置映射集 mashuo-mapR4(config-if)#exit //退出

五、验证:

1.Pc机验证
思科拓扑--***的一对多应用
思科拓扑--***的一对多应用

版权声明:原创作品,如需转载,请注明出处。否则将追究法律责任

***的一对多