计算机基础综合练习 配置目前网络环境;项目阶段练习

1:配置目前网络环境

1.1 问题

一家新创建的IT公司,公司位于北京有80多台服务器

目前网络环境使用技术,通过端口映射技术将web服务器发布给Internet:

  • 三层交换:汇聚接入层交换机
  • 默认路由:实现到互联网数以万计网络访问的简化配置
  • 静态路由:实现公司内部网络互通
  • NAT端口映射:实现企业内部Web服务器的发布

1.2 方案

通过端口映射技术将web服务器发布给Internet,公司现有网络环境拓扑如图-1所示:

图-1

现有网络连接说明如表-1所示:

表-1 网络连接说明

 

1.3 步骤

实现此案例需要按照如下步骤进行。

步骤一:根据表-1为设备配置IP地址,并为三层交换机开启路由功能

1)MS1配置vlan1与f0/1接口的IP地址并开启路由功能

copytextpop-up

  1. Switch(config)#hostname MS1
  2. MS1(config)#ip routing
  3. MS1(config)#interface vlan 1
  4. MS1(config-if)#ip address 192.168.1.252 255.255.255.0
  5. MS1(config-if)#no shutdown
  6. MS1(config-if)#exit
  7. MS1(config-if)#interface fastEthernet 0/1
  8. MS1(config-if)#no switchport
  9. MS1(config-if)#ip address 192.168.2.1 255.255.255.0
  10. MS1(config-if)#no shutdown

Switch(config)#hostname MS1

MS1(config)#ip routing

MS1(config)#interface vlan 1

MS1(config-if)#ip address 192.168.1.252 255.255.255.0

MS1(config-if)#no shutdown

MS1(config-if)#exit

MS1(config-if)#interface fastEthernet 0/1

MS1(config-if)#no switchport

MS1(config-if)#ip address 192.168.2.1 255.255.255.0

MS1(config-if)#no shutdown

步骤二:为路由器配置IP地址,添加接口模块

1)为路由器添加接口模块并进入路由器接口配置IP地址

copytextpop-up

  1. Router(config)#hostname R1
  2. R1(config)#interface fastEthernet 0/0
  3. R1(config-if)#ip address 192.168.2.2 255.255.255.0
  4. R1(config-if)#no shutdown
  5. R1(config-if)#exit
  6. R1(config)#interface fastEthernet 1/0
  7. R1(config-if)#ip address 61.159.62.129 255.255.255.248
  8. R1(config-if)#no shutdown

Router(config)#hostname R1

R1(config)#interface fastEthernet 0/0

R1(config-if)#ip address 192.168.2.2 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#interface fastEthernet 1/0

R1(config-if)#ip address 61.159.62.129 255.255.255.248

R1(config-if)#no shutdown

步骤三:配置MS1和路由器的静态路由

copytextpop-up

  1. MS1(config-if)#ip route 0.0.0.0 0.0.0.0 192.168.2.2
  2. R1(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

MS1(config-if)#ip route 0.0.0.0 0.0.0.0 192.168.2.2

R1(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

步骤四:测试server1与R1接口IP的连通性

copytextpop-up

  1. PC>ping 192.168.2.2
  2. Pinging 192.168.2.2 with 32 bytes of data:
  3. Reply from 192.168.2.2: bytes=32 time=0ms TTL=254
  4. Reply from 192.168.2.2: bytes=32 time=0ms TTL=254
  5. Reply from 192.168.2.2: bytes=32 time=0ms TTL=254
  6. Reply from 192.168.2.2: bytes=32 time=1ms TTL=254
  7. Ping statistics for 192.168.2.2:
  8. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  9. Approximate round trip times in milli-seconds:
  10. Minimum = 0ms, Maximum = 1ms, Average = 0ms
  11. PC>ping 61.159.62.129
  12. Pinging 61.159.62.129 with 32 bytes of data:
  13. Reply from 61.159.62.129: bytes=32 time=1ms TTL=254
  14. Reply from 61.159.62.129: bytes=32 time=0ms TTL=254
  15. Reply from 61.159.62.129: bytes=32 time=2ms TTL=254
  16. Reply from 61.159.62.129: bytes=32 time=0ms TTL=254
  17. Ping statistics for 61.159.62.129:
  18. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  19. Approximate round trip times in milli-seconds:
  20. Minimum = 0ms, Maximum = 2ms, Average = 0ms

PC>ping 192.168.2.2

Pinging 192.168.2.2 with 32 bytes of data:

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254

Reply from 192.168.2.2: bytes=32 time=1ms TTL=254

Ping statistics for 192.168.2.2:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 1ms, Average = 0ms

PC>ping 61.159.62.129

Pinging 61.159.62.129 with 32 bytes of data:

Reply from 61.159.62.129: bytes=32 time=1ms TTL=254

Reply from 61.159.62.129: bytes=32 time=0ms TTL=254

Reply from 61.159.62.129: bytes=32 time=2ms TTL=254

Reply from 61.159.62.129: bytes=32 time=0ms TTL=254

Ping statistics for 61.159.62.129:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 2ms, Average = 0ms

步骤五:R1配置端口映射

copytextpop-up

  1. R1(config)#ip nat inside source static tcp 192.168.1.8 80 61.159.62.131 80
  2. R1(config)#interface fastEthernet 0/0
  3. R1(config-if)#ip nat inside
  4. R1(config)#interface f1/0
  5. R1(config-if)#ip nat outside

R1(config)#ip nat inside source static tcp 192.168.1.8 80 61.159.62.131 80

R1(config)#interface fastEthernet 0/0

R1(config-if)#ip nat inside

R1(config)#interface f1/0

R1(config-if)#ip nat outside

步骤六:在PC7上查看是映射结果,如图-2所示

图-2

2 案例2:项目阶段练习

2.1 问题

现有网络问题分析:

  • 接入层交换机只与同一个三层交换机相连,存在单点故障而影响网络通信。
  • 互联网连接单一服务商

现有网络需求:

  • 随着企业发展,为了保证网络的高可用性,需要使用很多的冗余技术。
  • 保证局域网络不会因为线路故障而导致的网络故障。
  • 保证客户端机器不会因为使用单一网关而出现的单点失败。
  • 保证到互联网的高可用接入使用冗余互联网连接。
  • 提高网络链路带宽。

2.2 方案

基于项目的需求,需要用到如下技术:

  • STP:解决二层环路带来的广播风暴并链路冗余问题
  • 以太网通道:提高网络链路带宽
  • RIP路由协议:实现网络路径的自动学习
  • HSRP:实现网关冗余

重新规划后的网络拓扑如图-3:

图-3

重新规划后网络连接说明如表-2与表-3所示:

表-2 网络连接说明

 

表-3 网络连接说明(续)

 

2.3 步骤

实现此案例需要按照如下步骤进行。

步骤一:静态路由升级动态路由。

1)R1删除静态路由并配置rip

copytextpop-up

  1. R1(config)#no ip route 192.168.1.0 255.255.255.0 192.168.2.1
  2. R1(config)#router rip
  3. R1(config-router)#version 2
  4. R1(config-router)#no auto-summary
  5. R1(config-router)#network 192.168.2.0
  6. R1(config-router)#default-information originate

R1(config)#no ip route 192.168.1.0 255.255.255.0 192.168.2.1

R1(config)#router rip

R1(config-router)#version 2

R1(config-router)#no auto-summary

R1(config-router)#network 192.168.2.0

R1(config-router)#default-information originate

2)MS1上删除静态路由并配置rip

copytextpop-up

  1. MS1(config)#no ip route 0.0.0.0 0.0.0.0 192.168.2.2
  2. MS1(config)#router rip
  3. MS1(config-router)#version 2
  4. MS1(config-router)#no auto-summary
  5. MS1(config-router)#network 192.168.1.0
  6. MS1(config-router)#network 192.168.2.0

MS1(config)#no ip route 0.0.0.0 0.0.0.0 192.168.2.2

MS1(config)#router rip

MS1(config-router)#version 2

MS1(config-router)#no auto-summary

MS1(config-router)#network 192.168.1.0

MS1(config-router)#network 192.168.2.0

3)在MS1上查看路由表

copytextpop-up

  1. MS1#show ip route
  2.  
  3. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
  4. D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  5. N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  6. E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
  7. i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
  8. *-candidate default, U - per-user static route, o - ODR
  9. P - periodic downloaded static route
  10. Gateway of last resort is 192.168.2.2 to network 0.0.0.0
  11. C 192.168.1.0/24 is directly connected, Vlan1
  12. C 192.168.2.0/24 is directly connected, FastEthernet0/1
  13. R* 0.0.0.0/0 [120/1] via 192.168.2.2, 00:00:01, FastEthernet0/1

MS1#show ip route

 

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is 192.168.2.2 to network 0.0.0.0

C 192.168.1.0/24 is directly connected, Vlan1

C 192.168.2.0/24 is directly connected, FastEthernet0/1

R* 0.0.0.0/0 [120/1] via 192.168.2.2, 00:00:01, FastEthernet0/1

步骤二:配置SW1、SW2、SW3、SW4与MS1的接口为Trunk模式并做以太网通道。

1)SW1、SW2、SW3、SW4上做与MS1之间的trunk与以太网通道

copytextpop-up

  1. Switch(config)#hostname SW1
  2. SW1(config)#interface range fastEthernet 0/5-6
  3. SW1(config-if-range)#switchport mode trunk
  4. SW1(config-if-range)#channel-group 1 mode on
  5.  
  6. Switch(config)#hostname SW2
  7. SW2(config)#interface range fastEthernet 0/7-8
  8. SW2(config-if-range)#switchport mode trunk
  9. SW2(config-if-range)#channel-group 2 mode on
  10.  
  11. Switch(config)#hostname SW3
  12. SW3(config)#interface range fastEthernet 0/9-10
  13. SW3(config-if-range)#switchport mode trunk
  14. SW3(config-if-range)#channel-group 3 mode on
  15.  
  16. Switch(config)#hostname SW4
  17. SW4(config)#interface range fastEthernet 0/11-12
  18. SW4(config-if-range)#switchport mode trunk
  19. SW4(config-if-range)#channel-group 4 mode on

Switch(config)#hostname SW1

SW1(config)#interface range fastEthernet 0/5-6

SW1(config-if-range)#switchport mode trunk

SW1(config-if-range)#channel-group 1 mode on

 

Switch(config)#hostname SW2

SW2(config)#interface range fastEthernet 0/7-8

SW2(config-if-range)#switchport mode trunk

SW2(config-if-range)#channel-group 2 mode on

 

Switch(config)#hostname SW3

SW3(config)#interface range fastEthernet 0/9-10

SW3(config-if-range)#switchport mode trunk

SW3(config-if-range)#channel-group 3 mode on

 

Switch(config)#hostname SW4

SW4(config)#interface range fastEthernet 0/11-12

SW4(config-if-range)#switchport mode trunk

SW4(config-if-range)#channel-group 4 mode on

2)MS1与SW1、SW2、SW3、SW4之间做以太网通道并启用trunk

MS1(config)#interface range fastEthernet 0/5-6

MS1(config-if-range)#switchport trunk encapsulation dot1q

MS1(config-if-range)#switchport mode trunk

MS1(config-if-range)#channel-group 1 mode on

MS1(config-if-range)#exit

MS1(config-if-range)#interface range fastEthernet 0/7-8

MS1(config-if-range)#switchport trunk encapsulation dot1q

MS1(config-if-range)#channel-group 2 mode on

MS1(config-if-range)#switchport mode trunk

MS1(config-if-range)#exit

MS1(config-if-range)#interface range fastEthernet 0/9-10

MS1(config-if-range)#switchport trunk encapsulation dot1q

MS1(config-if-range)#switchport mode trunk

MS1(config-if-range)#channel-group 3 mode on

MS1(config-if-range)#exit

MS1(config-if-range)#interface range fastEthernet 0/11-12

MS1(config-if-range)#switchport trunk encapsulation dot1q

MS1(config-if-range)#switchport mode trunk on

MS1(config-if-range)#channel-group 4 mode on

步骤三:添加MS2并配置与MS1、SW1、SW2、SW3、SW4之间的太网通道。

1)在MS1上配置与MS2的以太网通道

copytextpop-up

  1. MS1(config)#interface range fastEthernet 0/13-15
  2. MS1(config-if-range)#channel-group 5 mode on
  3. MS1(config-if-range)#switchport trunk encapsulation dot1q
  4. MS1(config-if-range)#switchport mode trunk

MS1(config)#interface range fastEthernet 0/13-15

MS1(config-if-range)#channel-group 5 mode on

MS1(config-if-range)#switchport trunk encapsulation dot1q

MS1(config-if-range)#switchport mode trunk

2)在MS2并配置与MS1、SW1、SW2、SW3、SW4之间的太网通道

copytextpop-up

  1. MS2(config)#interface range fastEthernet 0/10-12
  2. MS2(config-if-range)#channel-group 5 mode on
  3. MS2(config-if-range)#switchport trunk encapsulation dot1q
  4. MS2(config-if-range)#switchport mode trunk
  5. MS2(config-if-range)#exit
  6. MS2(config)#interface range fastEthernet 0/2-3
  7. MS2(config-if-range)#channel-group 1 mode on
  8. MS2(config-if-range)#switchport trunk encapsulation dot1q
  9. MS2(config-if-range)#switchport mode trunk
  10. MS2(config-if-range)#exit
  11. MS2(config)#interface range fastEthernet 0/4-5
  12. MS2(config-if-range)#channel-group 2 mode on
  13. MS2(config-if-range)#switchport mode trunk
  14. MS2(config-if-range)#exit
  15. MS2(config)#interface range fastEthernet 0/6-7
  16. MS2(config-if-range)#channel-group 3 mode on
  17. MS2(config-if-range)#switchport trunk encapsulation dot1q
  18. MS2(config-if-range)#switchport mode trunk
  19. MS2(config-if-range)#exit
  20. MS2(config)#interface range fastEthernet 0/8-9
  21. MS2(config-if-range)#channel-group 4 mode on
  22. MS2(config-if-range)#switchport trunk encapsulation dot1q
  23. MS2(config-if-range)#switchport mode trunk

MS2(config)#interface range fastEthernet 0/10-12

MS2(config-if-range)#channel-group 5 mode on

MS2(config-if-range)#switchport trunk encapsulation dot1q

MS2(config-if-range)#switchport mode trunk

MS2(config-if-range)#exit

MS2(config)#interface range fastEthernet 0/2-3

MS2(config-if-range)#channel-group 1 mode on

MS2(config-if-range)#switchport trunk encapsulation dot1q

MS2(config-if-range)#switchport mode trunk

MS2(config-if-range)#exit

MS2(config)#interface range fastEthernet 0/4-5

MS2(config-if-range)#channel-group 2 mode on

MS2(config-if-range)#switchport mode trunk

MS2(config-if-range)#exit

MS2(config)#interface range fastEthernet 0/6-7

MS2(config-if-range)#channel-group 3 mode on

MS2(config-if-range)#switchport trunk encapsulation dot1q

MS2(config-if-range)#switchport mode trunk

MS2(config-if-range)#exit

MS2(config)#interface range fastEthernet 0/8-9

MS2(config-if-range)#channel-group 4 mode on

MS2(config-if-range)#switchport trunk encapsulation dot1q

MS2(config-if-range)#switchport mode trunk

3)在MS1上查看以太网通道

copytextpop-up

  1. MS1>show etherchannel port-channel
  2. Channel-group listing:
  3. ----------------------
  4. Group: 1
  5. ----------
  6. Port-channels in the group:
  7. ---------------------------
  8. Port-channel: Po1
  9. ------------
  10. Age of the Port-channel = 00d:00h:05m:21s
  11. Logical slot/port = 2/1 Number of ports = 2
  12. GC = 0x00000000 HotStandBy port = null
  13. Port state = Port-channel
  14. Protocol = PAGP
  15. Port Security = Disabled
  16. Ports in the Port-channel:
  17. Index Load Port EC state No of bits
  18. ------+------+------+------------------+-----------
  19. 000Fa0/5On 0
  20. 000Fa0/6On 0
  21. Time since last port bundled: 00d:00h:05m:21s Fa0/6
  22. Group: 2
  23. ----------
  24. Port-channels in the group:
  25. ---------------------------
  26. Port-channel: Po2
  27. ------------
  28. Age of the Port-channel = 00d:00h:05m:21s
  29. Logical slot/port = 2/2 Number of ports = 2
  30. GC = 0x00000000 HotStandBy port = null
  31. Port state = Port-channel
  32. Protocol = PAGP
  33. Port Security = Disabled
  34. Ports in the Port-channel:
  35. Index Load Port EC state No of bits
  36. ------+------+------+------------------+-----------
  37. 000Fa0/7On 0
  38. 000Fa0/8On 0
  39. Time since last port bundled: 00d:00h:05m:21s Fa0/8
  40. Group: 3
  41. ----------
  42. Port-channels in the group:
  43. ---------------------------
  44. Port-channel: Po3
  45. ------------
  46. Age of the Port-channel = 00d:00h:05m:21s
  47. Logical slot/port = 2/3 Number of ports = 2
  48. GC = 0x00000000 HotStandBy port = null
  49. Port state = Port-channel
  50. Protocol = PAGP
  51. Port Security = Disabled
  52. Ports in the Port-channel:
  53. Index Load Port EC state No of bits
  54. ------+------+------+------------------+-----------
  55. 000Fa0/9On 0
  56. 000Fa0/10On 0
  57. Time since last port bundled: 00d:00h:05m:21s Fa0/10
  58. Group: 4
  59. ----------
  60. Port-channels in the group:
  61. ---------------------------
  62. Port-channel: Po4
  63. ------------
  64. Age of the Port-channel = 00d:00h:05m:21s
  65. Logical slot/port = 2/4 Number of ports = 2
  66. GC = 0x00000000 HotStandBy port = null
  67. Port state = Port-channel
  68. Protocol = PAGP
  69. Port Security = Disabled
  70. Ports in the Port-channel:
  71. Index Load Port EC state No of bits
  72. ------+------+------+------------------+-----------
  73. 000Fa0/11On 0
  74. 000Fa0/12On 0
  75. Time since last port bundled: 00d:00h:05m:21s Fa0/12
  76. Group: 5
  77. ----------
  78. Port-channels in the group:
  79. ---------------------------
  80. Port-channel: Po5
  81. ------------
  82. Age of the Port-channel = 00d:00h:08m:11s
  83. Logical slot/port = 2/5 Number of ports = 3
  84. GC = 0x00000000 HotStandBy port = null
  85. Port state = Port-channel
  86. Protocol = PAGP
  87. Port Security = Disabled
  88. Ports in the Port-channel:
  89. Index Load Port EC state No of bits
  90. ------+------+------+------------------+-----------
  91. 000Fa0/13On 0
  92. 000Fa0/14On 0
  93. 000Fa0/15On 0
  94. Time since last port bundled: 00d:00h:08m:11s Fa0/15

MS1>show etherchannel port-channel

Channel-group listing:

----------------------

Group: 1

----------

Port-channels in the group:

---------------------------

Port-channel: Po1

------------

Age of the Port-channel = 00d:00h:05m:21s

Logical slot/port = 2/1 Number of ports = 2

GC = 0x00000000 HotStandBy port = null

Port state = Port-channel

Protocol = PAGP

Port Security = Disabled

Ports in the Port-channel:

Index Load Port EC state No of bits

------+------+------+------------------+-----------

0 00 Fa0/5 On 0

0 00 Fa0/6 On 0

Time since last port bundled: 00d:00h:05m:21s Fa0/6

Group: 2

----------

Port-channels in the group:

---------------------------

Port-channel: Po2

------------

Age of the Port-channel = 00d:00h:05m:21s

Logical slot/port = 2/2 Number of ports = 2

GC = 0x00000000 HotStandBy port = null

Port state = Port-channel

Protocol = PAGP

Port Security = Disabled

Ports in the Port-channel:

Index Load Port EC state No of bits

------+------+------+------------------+-----------

0 00 Fa0/7 On 0

0 00 Fa0/8 On 0

Time since last port bundled: 00d:00h:05m:21s Fa0/8

Group: 3

----------

Port-channels in the group:

---------------------------

Port-channel: Po3

------------

Age of the Port-channel = 00d:00h:05m:21s

Logical slot/port = 2/3 Number of ports = 2

GC = 0x00000000 HotStandBy port = null

Port state = Port-channel

Protocol = PAGP

Port Security = Disabled

Ports in the Port-channel:

Index Load Port EC state No of bits

------+------+------+------------------+-----------

0 00 Fa0/9 On 0

0 00 Fa0/10 On 0

Time since last port bundled: 00d:00h:05m:21s Fa0/10

Group: 4

----------

Port-channels in the group:

---------------------------

Port-channel: Po4

------------

Age of the Port-channel = 00d:00h:05m:21s

Logical slot/port = 2/4 Number of ports = 2

GC = 0x00000000 HotStandBy port = null

Port state = Port-channel

Protocol = PAGP

Port Security = Disabled

Ports in the Port-channel:

Index Load Port EC state No of bits

------+------+------+------------------+-----------

0 00 Fa0/11 On 0

0 00 Fa0/12 On 0

Time since last port bundled: 00d:00h:05m:21s Fa0/12

Group: 5

----------

Port-channels in the group:

---------------------------

Port-channel: Po5

------------

Age of the Port-channel = 00d:00h:08m:11s

Logical slot/port = 2/5 Number of ports = 3

GC = 0x00000000 HotStandBy port = null

Port state = Port-channel

Protocol = PAGP

Port Security = Disabled

Ports in the Port-channel:

Index Load Port EC state No of bits

------+------+------+------------------+-----------

0 00 Fa0/13 On 0

0 00 Fa0/14 On 0

0 00 Fa0/15 On 0

Time since last port bundled: 00d:00h:08m:11s Fa0/15

步骤四:MS1与MS2配置STP

1)在MS1和MS2上配置stp

copytextpop-up

  1. MS1(config)#spanning-tree vlan 1 root primary
  2. MS2(config)#spanning-tree vlan 1 root secondary

MS1(config)#spanning-tree vlan 1 root primary

MS2(config)#spanning-tree vlan 1 root secondary

2)在MS1和MS2上查看stp

copytextpop-up

  1. MS1# show spanning-tree vlan 1
  2. VLAN0001
  3. Spanning tree enabled protocol ieee
  4. Root ID Priority 24577
  5. Address 0004.9A70.6B06
  6. This bridge is the root
  7. Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
  8. Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
  9. Address 0004.9A70.6B06
  10. Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
  11. Aging Time 20
  12. Interface Role Sts Cost Prio.Nbr Type
  13. ------------------------------------------------------------------------
  14. Po1 Desg FWD 9 128.27 Shr
  15. Po2 Desg FWD 9 128.28 Shr
  16. Po3 Desg FWD 9 128.29 Shr
  17. Po4 Desg FWD 9 128.30 Shr
  18. Po5 Desg FWD 8 128.31 Shr
  19.  
  20. MS2#show spanning-tree vlan 1
  21. VLAN0001
  22. Spanning tree enabled protocol ieee
  23. Root ID Priority 24577
  24. Address 0004.9A70.6B06
  25. Cost 8
  26. Port 31(Port-channel 5)
  27. Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
  28. Bridge ID Priority 28673 (priority 28672 sys-id-ext 1)
  29. Address 0006.2A05.A2BA
  30. Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
  31. Aging Time 20
  32. Interface Role Sts Cost Prio.Nbr Type
  33. ------------------------------------------------------------------------
  34. Po1 Desg FWD 9 128.27 Shr
  35. Po2 Desg FWD 9 128.28 Shr
  36. Po3 Desg FWD 9 128.29 Shr
  37. Po4 Desg FWD 9 128.30 Shr
  38. Po5 Root FWD 8 128.31 Shr

MS1# show spanning-tree vlan 1

VLAN0001

Spanning tree enabled protocol ieee

Root ID Priority 24577

Address 0004.9A70.6B06

This bridge is the root    

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)

Address 0004.9A70.6B06

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Aging Time 20

Interface Role Sts Cost Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Po1 Desg FWD 9 128.27 Shr

Po2 Desg FWD 9 128.28 Shr

Po3 Desg FWD 9 128.29 Shr

Po4 Desg FWD 9 128.30 Shr

Po5 Desg FWD 8 128.31 Shr

 

MS2#show spanning-tree vlan 1

VLAN0001

Spanning tree enabled protocol ieee

Root ID Priority 24577

Address 0004.9A70.6B06

Cost 8

Port 31(Port-channel 5)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 28673 (priority 28672 sys-id-ext 1)

Address 0006.2A05.A2BA

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Aging Time 20

Interface Role Sts Cost Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Po1 Desg FWD 9 128.27 Shr

Po2 Desg FWD 9 128.28 Shr

Po3 Desg FWD 9 128.29 Shr

Po4 Desg FWD 9 128.30 Shr

Po5 Root FWD 8 128.31 Shr

步骤五:HSRP配置

1)MS1配置HSRP

copytextpop-up

  1. MS1(config)#interface vlan 1
  2. MS1(config-if)#standby 1 ip 192.168.1.254
  3. MS1(config-if)#standby 1 priority 200
  4. MS1(config-if)#standby 1 preempt

MS1(config)#interface vlan 1

MS1(config-if)#standby 1 ip 192.168.1.254

MS1(config-if)#standby 1 priority 200

MS1(config-if)#standby 1 preempt

2)MS2配置HSRP开启路由功能

copytextpop-up

  1. MS2(config)#ip routing
  2. MS2(config)#interface vlan 1
  3. MS2(config)#ip address 192.168.1.253 255.255.255.0
  4. MS2(config)#no shutdown
  5. MS2(config-if)#standby 1 ip 192.168.1.254
  6. MS2(config-if)#standby 1 priority 195
  7. MS2(config-if)#standby 1 preempt

MS2(config)#ip routing

MS2(config)#interface vlan 1

MS2(config)#ip address 192.168.1.253 255.255.255.0

MS2(config)#no shutdown

MS2(config-if)#standby 1 ip 192.168.1.254

MS2(config-if)#standby 1 priority 195

MS2(config-if)#standby 1 preempt

3)配置MS1交换机的HSRP的端口跟踪,关闭跟踪接口,并在MS1和MS2上查看HSRP状态

copytextpop-up

  1. MS1(config)# MS1(config)#interface vlan 1
  2. MS1(config-if)#standby 1 track fastEthernet 0/1
  3. MS1(config-if)#exit
  4. MS1(config)#interface fastEthernet 0/1
  5. MS1(config-if)#shutdown
  6. MS1#show standby brief
  7. P indicates configured to preempt.
  8. |
  9. Interface Grp Pri P State Active Standby Virtual IP
  10. Vl1 1 190 P Standby 192.168.1.253 local 192.168.1.254
  11. MS2#show standby brief
  12. P indicates configured to preempt.
  13. Interface Grp Pri P State Active Standby Virtual IP
  14. Vl1 1 195 P Active local 192.168.1.252 192.168.1.254

MS1(config)# MS1(config)#interface vlan 1

MS1(config-if)#standby 1 track fastEthernet 0/1

MS1(config-if)#exit

MS1(config)#interface fastEthernet 0/1

MS1(config-if)#shutdown

MS1#show standby brief

P indicates configured to preempt.

|

Interface   Grp    Pri  P    State       Active          Standby    Virtual IP

Vl1          1      190  P    Standby    192.168.1.253   local     192.168.1.254

MS2#show standby brief

P indicates configured to preempt.

Interface    Grp    Pri   P     State     Active   Standby           Virtual IP

Vl1            1     195   P     Active    local    192.168.1.252     192.168.1.254

步骤六:MS2连接R1并配置rip

1)为R1与MS2相连接的接口配置IP地址 并配置rip

copytextpop-up

  1. R1(config)#interface fastEthernet 0/24
  2. R1(config-if)#ip address 192.168.3.2 255.255.255.0
  3. R1(config-if)#exit
  4. R1(config)#router rip
  5. R1(config-router)# version 2
  6. R1(config-router)#network 192.168.3.0
  7. MS2(config-if)#exit
  8. MS2(config)#router rip
  9. MS2(config-router)#version 2
  10. MS2(config-router)#no auto-summary
  11. MS2(config-router)#network 192.168.1.0

R1(config)#interface fastEthernet 0/24

R1(config-if)#ip address 192.168.3.2 255.255.255.0

R1(config-if)#exit

R1(config)#router rip

R1(config-router)# version 2

R1(config-router)#network 192.168.3.0

MS2(config-if)#exit

MS2(config)#router rip

MS2(config-router)#version 2

MS2(config-router)#no auto-summary

MS2(config-router)#network 192.168.1.0

步骤七:添加路由器R2, 为R2配置默认路由,R2与MS1、MS2、Internet相连并为配置IP与动态路由

1)配置R2的IP地址、rip、默认路由。

copytextpop-up

  1. Router(config)hostname R2
  2. R2(config)#interface fastEthernet 0/0
  3. R2(config-if)#ip address 192.168.4.2 255.255.255.0
  4. R2(config-if)#no shutdown
  5. R2(config-if)#exit
  6. R2(config)#interface fastEthernet 0/1
  7. R2(config-if)#ip address 192.168.5.2 255.255.255.0
  8. R2(config-if)#no shutdown
  9. R2(config-if)#exit
  10. R2(config)#interface fastEthernet 1/0
  11. R2(config-if)#ip address 61.159.62.130 255.255.255.248
  12. R2(config-if)#no shutdown
  13. R2(config-if)#exit
  14. R2(config)ip route 0.0.0.0 0.0.0.0 fastEthernet 1/0
  15. R2(config)#router rip
  16. R2(config-router)#version 2
  17. R2(config-router)#no auto-summary
  18. R2(config-router)#network 192.168.4.0
  19. R2(config-router)#network 192.168.5.0
  20. R2(config-router)#default-information originate

Router(config)hostname R2

R2(config)#interface fastEthernet 0/0

R2(config-if)#ip address 192.168.4.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#interface fastEthernet 0/1

R2(config-if)#ip address 192.168.5.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#interface fastEthernet 1/0

R2(config-if)#ip address 61.159.62.130 255.255.255.248

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)ip route 0.0.0.0 0.0.0.0 fastEthernet 1/0

R2(config)#router rip

R2(config-router)#version 2

R2(config-router)#no auto-summary

R2(config-router)#network 192.168.4.0

R2(config-router)#network 192.168.5.0

R2(config-router)#default-information originate

2)MS2配置IP地址添加动态路由条目

copytextpop-up

  1. MS2(config)#interface fastEthernet 0/1
  2. MS2(config-if)#no switchport
  3. MS2(config-if)#ip address 192.168.4.1 255.255.255.0
  4. MS2(config-if)#no shutdown
  5. MS2(config-if)#exit
  6. MS2(config)#router rip
  7. R2(config-router)#version 2
  8. MS2(config-router)#network 192.168.4.0

MS2(config)#interface fastEthernet 0/1

MS2(config-if)#no switchport

MS2(config-if)#ip address 192.168.4.1 255.255.255.0

MS2(config-if)#no shutdown

MS2(config-if)#exit

MS2(config)#router rip

R2(config-router)#version 2

MS2(config-router)#network 192.168.4.0

3)MS1配置IP地址添加动态路由条目

copytextpop-up

  1. MS1(config)#interface fastEthernet 0/24
  2. MS1(config-if)#no switchport
  3. MS1(config-if)#ip address 192.168.5.1 255.255.255.0
  4. MS1(config-if)#no shutdown
  5. MS1(config-if)#exit
  6. MS1(config)#router rip
  7. R2(config-router)#version 2
  8. MS1(config-router)#network 192.168.5.0

MS1(config)#interface fastEthernet 0/24

MS1(config-if)#no switchport

MS1(config-if)#ip address 192.168.5.1 255.255.255.0

MS1(config-if)#no shutdown

MS1(config-if)#exit

MS1(config)#router rip

R2(config-router)#version 2

MS1(config-router)#network 192.168.5.0

4)在客户端测试网络的联通性

copytextpop-up

  1. SERVER>ipconfig
  2. FastEthernet0 Connection:(default port)
  3. Link-local IPv6 Address.........: FE80::201:96FF:FEA8:404B
  4. IP Address......................: 192.168.1.1
  5. Subnet Mask.....................: 255.255.255.0
  6. Default Gateway.................: 192.168.1.254
  7. SERVER>ping 192.168.2.1
  8. Pinging 192.168.2.1 with 32 bytes of data:
  9. Reply from 192.168.2.1: bytes=32 time=0ms TTL=255
  10. Reply from 192.168.2.1: bytes=32 time=0ms TTL=255
  11. Reply from 192.168.2.1: bytes=32 time=0ms TTL=255
  12. Reply from 192.168.2.1: bytes=32 time=0ms TTL=255
  13. Ping statistics for 192.168.2.1:
  14. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  15. Approximate round trip times in milli-seconds:
  16. Minimum = 0ms, Maximum = 0ms, Average = 0ms
  17.  
  18. SERVER>ping 192.168.3.1
  19. Pinging 192.168.3.1 with 32 bytes of data:
  20. Reply from 192.168.3.1: bytes=32 time=0ms TTL=255
  21. Reply from 192.168.3.1: bytes=32 time=0ms TTL=255
  22. Reply from 192.168.3.1: bytes=32 time=0ms TTL=255
  23. Reply from 192.168.3.1: bytes=32 time=0ms TTL=255
  24. Ping statistics for 192.168.3.1:
  25. Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),
  26. Approximate round trip times in milli-seconds:
  27. Minimum = 0ms, Maximum = 0ms, Average = 0ms
  28.  
  29. SERVER>ping 192.168.4.1
  30.  
  31. Pinging 192.168.4.1 with 32 bytes of data:
  32. Reply from 192.168.4.1: bytes=32 time=1ms TTL=255
  33. Reply from 192.168.4.1: bytes=32 time=0ms TTL=255
  34. Reply from 192.168.4.1: bytes=32 time=0ms TTL=255
  35. Reply from 192.168.4.1: bytes=32 time=0ms TTL=255
  36. Ping statistics for 192.168.4.1:
  37. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  38. Approximate round trip times in milli-seconds:
  39. Minimum = 0ms, Maximum = 1ms, Average = 0ms
  40.  
  41. SERVER>ping 192.168.5.1
  42. Pinging 192.168.5.1 with 32 bytes of data:
  43. Reply from 192.168.5.1: bytes=32 time=1ms TTL=255
  44. Reply from 192.168.5.1: bytes=32 time=1ms TTL=255
  45. Reply from 192.168.5.1: bytes=32 time=1ms TTL=255
  46. Reply from 192.168.5.1: bytes=32 time=0ms TTL=255
  47. Ping statistics for 192.168.5.1:
  48. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  49. Approximate round trip times in milli-seconds:
  50. Minimum = 0ms, Maximum = 1ms, Average = 0ms
  51.  
  52. SERVER>ping 192.168.2.2
  53. Pinging 192.168.2.2 with 32 bytes of data:
  54. Reply from 192.168.2.2: bytes=32 time=1ms TTL=254
  55. Reply from 192.168.2.2: bytes=32 time=1ms TTL=254
  56. Reply from 192.168.2.2: bytes=32 time=11ms TTL=254
  57. Reply from 192.168.2.2: bytes=32 time=0ms TTL=254
  58. Ping statistics for 192.168.2.2:
  59. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  60. Approximate round trip times in milli-seconds:
  61. Minimum = 0ms, Maximum = 11ms, Average = 3ms
  62.  
  63. SERVER>ping 192.168.3.2
  64. Pinging 192.168.3.2 with 32 bytes of data:
  65. Reply from 192.168.3.2: bytes=32 time=0ms TTL=254
  66. Reply from 192.168.3.2: bytes=32 time=0ms TTL=254
  67. Reply from 192.168.3.2: bytes=32 time=1ms TTL=254
  68. Reply from 192.168.3.2: bytes=32 time=0ms TTL=254
  69. Ping statistics for 192.168.3.2:
  70. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  71. Approximate round trip times in milli-seconds:
  72. Minimum = 0ms, Maximum = 1ms, Average = 0ms

SERVER>ipconfig

FastEthernet0 Connection:(default port)

Link-local IPv6 Address.........: FE80::201:96FF:FEA8:404B

IP Address......................: 192.168.1.1

Subnet Mask.....................: 255.255.255.0

Default Gateway.................: 192.168.1.254

SERVER>ping 192.168.2.1

Pinging 192.168.2.1 with 32 bytes of data:

Reply from 192.168.2.1: bytes=32 time=0ms TTL=255

Reply from 192.168.2.1: bytes=32 time=0ms TTL=255

Reply from 192.168.2.1: bytes=32 time=0ms TTL=255

Reply from 192.168.2.1: bytes=32 time=0ms TTL=255

Ping statistics for 192.168.2.1:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 0ms, Average = 0ms

 

SERVER>ping 192.168.3.1

Pinging 192.168.3.1 with 32 bytes of data:

Reply from 192.168.3.1: bytes=32 time=0ms TTL=255

Reply from 192.168.3.1: bytes=32 time=0ms TTL=255

Reply from 192.168.3.1: bytes=32 time=0ms TTL=255

Reply from 192.168.3.1: bytes=32 time=0ms TTL=255

Ping statistics for 192.168.3.1:

Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 0ms, Average = 0ms

 

SERVER>ping 192.168.4.1

 

Pinging 192.168.4.1 with 32 bytes of data:

Reply from 192.168.4.1: bytes=32 time=1ms TTL=255

Reply from 192.168.4.1: bytes=32 time=0ms TTL=255

Reply from 192.168.4.1: bytes=32 time=0ms TTL=255

Reply from 192.168.4.1: bytes=32 time=0ms TTL=255

Ping statistics for 192.168.4.1:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

 

SERVER>ping 192.168.5.1

Pinging 192.168.5.1 with 32 bytes of data:

Reply from 192.168.5.1: bytes=32 time=1ms TTL=255

Reply from 192.168.5.1: bytes=32 time=1ms TTL=255

Reply from 192.168.5.1: bytes=32 time=1ms TTL=255

Reply from 192.168.5.1: bytes=32 time=0ms TTL=255

Ping statistics for 192.168.5.1:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

 

SERVER>ping 192.168.2.2

Pinging 192.168.2.2 with 32 bytes of data:

Reply from 192.168.2.2: bytes=32 time=1ms TTL=254

Reply from 192.168.2.2: bytes=32 time=1ms TTL=254

Reply from 192.168.2.2: bytes=32 time=11ms TTL=254

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254

Ping statistics for 192.168.2.2:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 11ms, Average = 3ms

 

SERVER>ping 192.168.3.2

Pinging 192.168.3.2 with 32 bytes of data:

Reply from 192.168.3.2: bytes=32 time=0ms TTL=254

Reply from 192.168.3.2: bytes=32 time=0ms TTL=254

Reply from 192.168.3.2: bytes=32 time=1ms TTL=254

Reply from 192.168.3.2: bytes=32 time=0ms TTL=254

Ping statistics for 192.168.3.2:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

5)关闭MS1

copytextpop-up

  1. MS1(config)#interface range fastEthernet 0/1-24
  2. MS1(config-if-range)#shutdown

MS1(config)#interface range fastEthernet 0/1-24

MS1(config-if-range)#shutdown

6)在外网测试是否可以访问web服务器如图-4所示

图-4

步骤八:在R2上配置端口映射

1)在R2上配置端口映射,指定NAT进口

copytextpop-up

  1. R2(config)#ip nat inside source static tcp 192.168.1.8 80 61.159.62.131 80
  2. R2(config)#interface fastEthernet 0/0
  3. R2(config-if)#ip nat inside
  4. R2(config-if)#exit
  5. R2(config)#interface fastEthernet 0/1
  6. R2(config-if)#ip nat inside
  7. R2(config-if)#exit
  8. R2(config)#interface fastEthernet 1/0
  9. R2(config-if)#ip nat outside

R2(config)#ip nat inside source static tcp 192.168.1.8 80 61.159.62.131 80

R2(config)#interface fastEthernet 0/0

R2(config-if)#ip nat inside

R2(config-if)#exit

R2(config)#interface fastEthernet 0/1

R2(config-if)#ip nat inside

R2(config-if)#exit

R2(config)#interface fastEthernet 1/0

R2(config-if)#ip nat outside

2)关闭R1(如图-5所示)测试外网是否可以正常访问web服务器(因为模拟器有BUG所以需要填加一台Internet主机IP:61.159.62.133测试如图-6所示)

图-5

图-6

可以访问web服务器证明项目升级成功。

 

猜你喜欢

转载自blog.csdn.net/rio520/article/details/81148781