wKioL1ZMSfmD26GxAACFJZ7Ngmg570.png

1)配置R1

R1(config)#int f0/0

R1(config-if)#ip add 10.1.1.1 255.255.255.0

R1(config-if)#no shut

R1(config-if)#exit

R1(config)#int s1/0

R1(config-if)#encapsulation frame-relay

R1(config-if)#no frame-relay inverse-arp

R1(config-if)#no arp frame-relay

R1(config-if)#ip add 12.1.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#frame-relay map ip 12.1.1.2 102 broadcast

R1(config)#ip route 0.0.0.0 0.0.0.0 12.1.1.2

R1(config)#

说明:配置R1的接口地址,并写默认路由指向Internet(路由器R2),地址12.1.1.2

 

R2(config)#int f0/0

R2(config-if)#ip add 23.1.1.2 255.255.255.0

R2(config-if)#no sh

R2(config-if)#exit

R2(config)#int f0/1

R2(config-if)#ip address 24.1.1.2 255.255.255.0

R2(config-if)#no sh

R2(config-if)#exit

R2(config)#int s1/0

R2(config-if)#encapsulation frame-relay

R2(config-if)#no frame-relay inverse-arp

R2(config-if)#no arp frame-relay

R2(config-if)#ip add 12.1.1.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#frame-relay map ip 12.1.1.1 201 broadcast

R2(config-if)#exit R2(config)#service dhcp

R2(config)#ip dhcp pool net23

R2(dhcp-config)#network 23.1.1.0 255.255.255.0

R2(dhcp-config)#default-router 23.1.1.2

R2(dhcp-config)#exit

R2(config)#ip dhcp pool net24

R2(dhcp-config)#network 24.1.1.0 255.255.255.0

R2(dhcp-config)#default-router 24.1.1.2

R2(dhcp-config)#exit

R2(config)#ip dhcp excluded-address 23.1.1.2

R2(config)#ip dhcp excluded-address 24.1.1.2

R2(config)#

说明:配置R2的接口地址,并且在R2上配置DHCP,向北京和广州的路由器提供动态IP地址,因为R2模拟InternetR2只需要有公网路由12.1.1.023.1.1.024.1.1.0即可,所以R2不需要写任何路由,也不允许写任何路由。

3)配置R3

R3(config)#int f0/0

R3(config-if)#ip address dhcp

R3(config-if)#no shutdown

R3(config-if)#exit

R3(config)#int f0/1

R3(config-if)#ip address 192.168.1.3 255.255.255.0

R3(config-if)#no shutdown

R3(config-if)#exit

说明:在R3上配置内网网段192.168.1.0/24,并且在连Internet的接口F0/0上开启DHCP动态获得地址,所以F0/0上的IP地址是多少,事先是不知道的。

4)配置R4

R4(config)#int f0/0

R4(config-if)#ip address 172.16.1.4 255.255.255.0

R4(config-if)#no shutdown

R4(config-if)#exit

R4(config)#int f0/1

R4(config-if)#ip address dhcp

R4(config-if)#no shutdown

R4(config-if)#exit

说明:在R4上配置内网网段172.16.1.0/24,并且在连Internet的接口F0/1上开启DHCP动态获得地址,所以F0/1上的IP地址是多少,事先是不知道的。

5)配置R5

R5(config)#int f0/1

R5(config-if)#ip add 10.1.1.5 255.255.255.0

R5(config-if)#no sh

R5(config-if)#exit

R5(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1

说明:配置R5的接口地址,并写默认路由指向上海公司出口路由器R1

 

2.测试基础网络环境

1)查看北京路由器R3IP地址情况:

 

说明:北京路由器R3除了内网网段192.168.1.0/24之外,外网接口F0/0的地址23.1.1.1DHCP动态获得的。

 

1)在R1上配置DM×××

说明:R1Hub 配置IKEISAKMP)策略:

R1(config)#crypto isakmp policy 1

R1(config-isakmp)#encryption 3des

R1(config-isakmp)#hash sha

R1(config-isakmp)#authentication pre-share

R1(config-isakmp)#group 2

R1(config-isakmp)#exit

配置PSK认证密钥,必须使用通配符认证方法:

R1(config)#crypto isakmp key 0 cisco123 address 0.0.0.0

配置IPsec transform:

R1(config)#crypto ipsec transform-set ccie esp-3des esp-sha-hmac

R1(cfg-crypto-trans)#exit

配置IPsec profile

R1(config)#crypto ipsec profile cisco

R1(ipsec-profile)#set transform-set ccie

R1(ipsec-profile)#exit

创建Tunnel接口1,号码任意:

R1(config)#int tunnel 1

为高层协议改变带宽值,只影响路由协议的Metric值计算,而并非QOS,默认带宽为9: R1(config-if)#bandwidth 1000

配置GRE接口地址为100.1.1.1/24:

R1(config-if)#ip address 100.1.1.1 255.255.255.0

MTU改为1400,如果不改,下一跳路由器将会对数据包分片并重新封装:

R1(config-if)#ip mtu 1400

设置认证密码,同一个mGRE中所有点(包括所有Hub和所有spoke)的密码必须一致: R1(config-if)#ip nhrp authentication ccie123

 

spoke的地址加入组播映射中,否则与spoke之间使用组播的路由协议不能正常运行: R1(config-if)#ip nhrp map multicast dynamic

配置网络标识号,等于是启用NHRP,同一个mGRE中所有点(包括所有Hub和所有spoke)的号码必须一致:

R1(config-if)#ip nhrp network-id 1

关闭EIGRP水平分割,否则从一个spokeEIGRP学习到的路由不能发给另一个spoke: R1(config-if)#no ip split-horizon eigrp 1

定义mGRE的源地址为S1/0的地址,即源地址为12.1.1.1

R1(config-if)#tunnel source s1/0

定义GRE接口的类型为mGREHub上的类型必须为mGRE

R1(config-if)#tunnel mode gre multipoint

定义Tunnel接口ID,此步并不是必须的,如果定义,同一个mGRE中所有点(包括所有Hub和所有spoke)的号码必须一致:

R1(config-if)#tunnel key 10000

IPsec profile关联到mGRE接口,用于保护mGRE接口的流量:

R1(config-if)#tunnel protection ipsec profile cisco

R1(config-if)#exit

2)在R3上配置DM×××

说明:R3spoke 配置IKEISAKMP)策略:

R1(config)#crypto isakmp policy 1

R1(config-isakmp)#encryption 3des

R1(config-isakmp)#hash sha

R1(config-isakmp)#authentication pre-share

R1(config-isakmp)#group 2

R1(config-isakmp)#exit

配置PSK认证密钥,必须使用通配符认证方法:

R1(config)#crypto isakmp key 0 cisco123 address 0.0.0.0

配置IPsec transform:

R1(config)#crypto ipsec transform-set ccie esp-3des esp-sha-hmac

R1(cfg-crypto-trans)#exit

配置IPsec profile

R1(config)#crypto ipsec profile cisco

R1(ipsec-profile)#set transform-set ccie

R1(ipsec-profile)#exit

创建Tunnel接口3,号码任意:

R3(config)#int tunnel 3

为高层协议改变带宽值,只影响路由协议的Metric值计算,而并非QOS,默认带宽为9: R3(config-if)#bandwidth 1000 配置GRE接口地址为100.1.1.3/24:

R3(config-if)#ip address 100.1.1.3 255.255.255.0

MTU改为1400,如果不改,下一跳路由器将会对数据包分片并重新封装:

R3(config-if)#ip mtu 1400

设置认证密码,同一个mGRE中所有点(包括所有Hub和所有spoke)的密码必

须一致:

R3(config-if)#ip nhrp authentication ccie123

HubGRE接口地址100.1.1.1和公网IP地址12.1.1.1静态映射绑定:

R3(config-if)#ip nhrp map 100.1.1.1 12.1.1.1

开启能向Hub发送组播的功能,从而开启动态路由协议的功能:

R3(config-if)#ip nhrp map multicast 12.1.1.1

配置网络标识号,等于是启用NHRP,同一个mGRE中所有点(包括所有Hub和所有spoke)的号码必须一致:

R3(config-if)#ip nhrp network-id 1

Hub路由器指定为NHRP Server

R3(config-if)#ip nhrp nhs 100.1.1.1

定义mGRE的源地址为F0/0的地址:

R3(config-if)#tunnel source f0/0

定义GRE接口的类型为mGREspoke也可以选择直接指Hub的目标地址(即命令tunnel destination),如果需要使用spoke-to-spoke tunnel传递功能,必须配置为mGRE,指目标地址只能工作在hub-and-spoke tunnel

R3(config-if)#tunnel mode gre multipoint

定义Tunnel接口ID,此步并不是必须的,如果定义,同一个mGRE中所有点(包括所有Hub和所有spoke)的号码必须一致:

R3(config-if)#tunnel key 10000

IPsec profile关联到mGRE接口,用于保护mGRE接口的流量:

R3(config-if)#tunnel protection ipsec profile cisco

R3(config-if)#exit

4.测试DM×××

1)从HubR1spokeR3发送流量测试mGRE接口状况:

R1#ping 100.1.1.3

说明:HubR1mGRE接口到spokeR3mGRE接口通信正常。

2)查看HubR1NHRP映射情况:

R1#show ip nhrp brief

说明:Hub路由器R1上已经存在spoke路由器R3mGRE接口地址100.1.1.3对应的公网地址23.1.1.1的映射,并且显示为动态映射的,即spoke自动注册的。

3)查看spokeR3NHRP映射情况:

R3#show ip nhrp

R3#show ip nhrp brief

将广州路由器加入DM××× 1)使用类似于spoke路由器R3的配置方法来配置广州路由器R4DM×××

R4(config)#crypto isakmp policy 1

R4(config-isakmp)#encryption 3des

R4(config-isakmp)#hash sha

R4(config-isakmp)#authentication pre-share

R4(config-isakmp)#group 2

R4(config-isakmp)#exit

R4(config)#crypto isakmp key 0 cisco123 address 0.0.0.0

R4(config)#crypto ipsec transform-set ccie esp-3des esp-sha-hmac

R4(cfg-crypto-trans)#exit

R4(config)#crypto ipsec profile cisco

R4(ipsec-profile)#set transform-set ccie

R4(ipsec-profile)#exit

R4(config)#

R4(config)#int tunnel 4

R4(config-if)#bandwidth 1000

R4(config-if)#ip address 100.1.1.4 255.255.255.0

R4(config-if)#ip mtu 1400

R4(config-if)#ip nhrp authentication ccie123

R4(config-if)#ip nhrp map 100.1.1.1 12.1.1.1

R4(config-if)#ip nhrp map multicast 12.1.1.1

R4(config-if)#ip nhrp network-id 1

R4(config-if)#ip nhrp nhs 100.1.1.1

R4(config-if)#tunnel source f0/1

R4(config-if)#tunnel mode gre multipoint

R4(config-if)#tunnel key 10000

R4(config-if)#tunnel protection ipsec profile cisco

R4(config-if)#exit

说明:R4DM×××的各参数请参考R3上的配置解释。

 

配置spoke-to-spoke tunnel 通信方式

1)在Hub路由器R1mGRE接口上改变EIGRP下一跳规则:

R1(config)#int tunnel 1

R1(config-if)#no ip next-hop-self eigrp 1

R1(config-if)#

说明:让Hub路由器R1不再将从一个spoke收到的路由发给另一个spoke时将下一跳地址改为自己,而是保持原来的下一跳地址不变,即spoke到另外一个spoke的下一跳地址还是源spoke而不是Hub路由器。