码迷,mamicode.com
首页 > 其他好文 > 详细

热备份路由协议(HSRP)与生成树协议(TCP)

时间:2014-08-15 10:54:49      阅读:399      评论:0      收藏:0      [点我收藏+]

标签:hstp   ip地址   tcp   路由器   拓扑图   


 热备份路由协议与生成树协议

 

实验01: 热备份路由协议(HSRP)

实验目标:共享一个虚拟IP地址,该IP地址作为内网主机的网关

实验环境:出口设备上配置热备份路由协议(HSRP),组成一个HSRP组,组内    

           两个出口设备共享一个虚拟IP地址,该IP地址作为内网主机的网关

 

实验拓扑图:

bubuko.com,布布扣

 

 

实验步骤:

一. 配置IP地址

    1. 配置PC0 IP地址

bubuko.com,布布扣

 

        2. 配置PC1 IP地址

bubuko.com,布布扣

 

         3.配置PC2 IP地址

bubuko.com,布布扣

 

 

二. 配置路由器热备份路由协议

1. 配置路由器1

1) Router#configure terminal 

2) Router(config)#interface f0/0(端口0/0)

3) Router(config-if)#ip address 192.168.1.254 255.255.255.0(IP地址)

4) Router(config-if)#no shutdown 

5) Router(config-if)#exit

6) Router(config)#interface f0/1(端口0/1)

7) Router(config-if)#ip address 192.168.3.1 255.255.255.0(IP地址)

8) Router(config-if)#no shutdown 

9) Router(config)#router rip 

10) Router(config-router)#version 2(RIPv2)

11) Router(config-router)#no auto-summary (关闭路由汇总)

12) Router(config-router)#network 192.168.1.0(主网络ID)

13) Router(config-router)#network 192.168.3.0

14) Router(config-router)#exit

15) Router(config)#interface f0/0(端口0/0)

16) Router(config-if)#standby 2 ip 192.168.1.252(配置为HSRP的成员)

17) Router(config-if)#standby 2 priority 200(配置HSRP的优先级)

18) Router(config-if)#standby 2 track f0/0 (HSRP端口跟踪)

19) Router(config-if)#standby 2 preempt(HSRP占先权)

20) Router(config-if)#exit

21) Router(config)#end

22) Router#show standby brief(查看HSRP摘要信息)

23)                      P indicates configured to preempt.

24)                      |

25) Interface   Grp  Pri P State    Active          Standby         Virtual IP

26) Fa0/0       2    200 P Active   local           192.168.1.253   192.168.1.152  (虚拟IP)

2. 配置路由器2

1) Router>en

2) Router#configure terminal 

3) Router(config)#interface f0/0

4) Router(config-if)#ip address 192.168.1.254 255.255.255.0

5) Router(config-if)#no shutdown 

6) Router(config-if)#exit

7) Router(config)#interface f0/1

8) Router(config-if)#ip address 192.168.5.1 255.255.255.0

9) Router(config-if)#no shutdown 

10) Router(config-if)#exit

11) Router(config)#router rip 

12) Router(config-router)#version 2 (RIPv2)

13) Router(config-router)#no auto-summary  (关闭路由汇总)

14) Router(config-router)#network 192.168.1.0  主网络ID

15) Router(config-router)#network 192.168.5.0

16) Router(config-router)#exit

17) Router(config)#interface f0/0    

18) Router(config-if)#standby 2 ip 192.168.2.252  (配置为HSRP的成员)

19) Router(config-if)#standby 2 priority 195(配置HSRP的优先级)

20) Router(config-if)#standby 2 track f0/0   (HSRP端口跟踪)

21) Router(config-if)#standby 2 preempt  (HSRP占先权)

22) Router(config-if)#end 

23) Router#show standby brief  (查看HSRP摘要信息)

24)                      P indicates configured to preempt.

25)                      |

26) Interface   Grp  Pri P State    Active          Standby         Virtual IP

27) Fa0/0       2    195 P Standby  192.168.1.254   local           192.168.1.152  

 

3. 配置路由器3

1) Router#configure terminal 

2) Router(config)#interface f0/1

3) Router(config-if)#ip address 192.168.5.2 255.255.255.0

4) Router(config-if)#no shutdown 

5) Router(config-if)#exit

6) Router(config)#interface f0/0

7) Router(config-if)#ip address 192.168.3.2 255.255.255.0

8) Router(config-if)#no shutdown 

9) Router(config-if)#exit

10) Router(config)#interface f1/0

11) Router(config-if)#ip address 192.168.4.254 255.255.255.0

12) Router(config-if)#no shutdown 

13) Router(config-if)#exit

14) Router(config)#router rip 

15) Router(config-router)#version 2  (RIPv2)

16) Router(config-router)#no auto-summary   (关闭路由汇总)

17) Router(config-router)#network 192.168.3.0主网络ID

18) Router(config-router)#network 192.168.4.0

19) Router(config-router)#network 192.168.5.0

 

结构验证:

1. 路由1

1)  Router#show standby brief

2)                     P indicates configured to preempt.

2)                      |

3) Interface   Grp  Pri P State    Active          Standby         Virtual IP

4) Fa0/0       2    200 P Active   local           192.168.1.253   192.168.1.152  

            (优先级)(活跃)                             (虚拟IP)

 

2.路由2

1)  Router#show standby brief

2)                      P indicates configured to preempt.

3)                      |

4) Interface   Grp  Pri P State    Active          Standby         Virtual IP

5) Fa0/0       2    195 P Standby  192.168.1.254   local           192.168.1.152  

 

问题和经验:

1. 生成树的算法

     每个广播域一个跟网桥

     每个非根网桥一个根端口

     每个网段上一个指定端口

     非指定端口,非根端口被阻塞

 

实验02:三层交换机上配置路由

实验目标:三层交换机的动态路由配置

实验环境:为了保证在冗余环境下不会出广播风暴等问题,引入了生成树(STP)协议。通过生成树协议可以把冗余线路上的某一个端口置为阻塞(BLOCKING)状态,防止广播风暴的产生,当某一线路出现故障时,被阻塞的端口自动进入转发(FORWARDING)状态,保证网络的畅通性。

实验拓扑图:

bubuko.com,布布扣

 

 

实验步骤:

1. 配置三层1交换机

1) Switch#configure terminal 

2) Switch(config)#spanning-tree vlan 1 root primary (vlan1直接指定优先级  主根)

3) Switch(config)#vlan 2(划分vlan 2)

4) Switch(config-vlan)#exit

5) Switch(config)#interface range fastEthernet 0/5-7(端口0/5-7)

6) Switch(config-if-range)#switchport trunk encapsulation dot1q (接口封装)

7) Switch(config-if-range)#switchport mode trunk (trunk模式)

8) Switch(config-if-range)#exit

9) Switch(config)#spanning-tree vlan 2 root secondary (vlan2制定为次根)

10) Switch(config)#end

11) Switch#show spanning-tree (查看)

12) VLAN0001(vlan 1)

13)   Spanning tree enabled protocol ieee

14)   Root ID    Priority    24577

15)              Address     0060.2F12.80EA

16)              This bridge is the root

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

18) 

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

20)              Address     0060.2F12.80EA

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

22)              Aging Time  20

23) 

24) Interface        Role Sts Cost      Prio.Nbr Type

25) ---------------- ---- --- --------- -------- --------------------------------

26) Fa0/5            Desg FWD 19        128.5    P2p

27) Fa0/7            Desg FWD 19        128.7    P2p

28) Fa0/6            Desg FWD 19        128.6    P2p

29) 

30) VLAN0002(vlan 2)

31)   Spanning tree enabled protocol ieee

32)   Root ID    Priority    24578

33)              Address     000D.BD3B.6779

34)              Cost        19

35)              Port        7(FastEthernet0/7)

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

37) 

38)   Bridge ID  Priority    28674  (priority 28672 sys-id-ext 2)

39)              Address     0060.2F12.80EA

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

41)              Aging Time  20

42) 

43) Interface        Role Sts Cost      Prio.Nbr Type

44) ---------------- ---- --- --------- -------- --------------------------------

45) Fa0/5            Desg FWD 19        128.5    P2p

46) Fa0/7            Root FWD 19        128.7    P2p

47) Fa0/6            Desg FWD 19        128.6    P2p

2. 配置三层2交换机

1) Switch#configure terminal 

2) Switch(config)#spanning-tree vlan 1 root secondary (vlan1上配置为次根)

3) Switch(config)#vlan 2(划分vlan 2)

4) Switch(config-vlan)#exit

5) Switch(config)#interface range fastEthernet 0/5-7(端口0/5-7开启trunk)

6) Switch(config-if-range)#switchport trunk encapsulation dot1q t(接口封装)

7) Switch(config-if-range)#switchport mode trunk (trunk模式)

8) Switch(config)#spanning-tree vlan 2 root primary (vlan 2配置为主根)

9) Switch#show spanning-tree (查看)

10) VLAN0001(vlan1)

11)   Spanning tree enabled protocol ieee

12)   Root ID    Priority    24577

13)              Address     0060.2F12.80EA

14)              Cost        19

15)              Port        7(FastEthernet0/7)

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

17) 

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

19)              Address     000D.BD3B.6779

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

21)              Aging Time  20

22) 

23) Interface        Role Sts Cost      Prio.Nbr Type

24) ---------------- ---- --- --------- -------- --------------------------------

25) Fa0/5            Desg FWD 19        128.5    P2p

26) Fa0/6            Desg FWD 19        128.6    P2p

27) Fa0/7            Root FWD 19        128.7    P2p

28) 

29) VLAN0002(vlan 2)

30)   Spanning tree enabled protocol ieee

31)   Root ID    Priority    24578

32)              Address     000D.BD3B.6779

33)              This bridge is the root

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

35) 

36)   Bridge ID  Priority    24578  (priority 24576 sys-id-ext 2)

37)              Address     000D.BD3B.6779

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

39)              Aging Time  20

40) 

41) Interface        Role Sts Cost      Prio.Nbr Type

42) ---------------- ---- --- --------- -------- --------------------------------

43) Fa0/5            Desg FWD 19        128.5    P2p

44) Fa0/6            Desg FWD 19        128.6    P2p

45) Fa0/7            Desg FWD 19        128.7    P2p

3. 二层交换机1

1) 1 Switch(config)#vlan 划分vlan 2

2) Switch(config-vlan)#exit

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

4) Switch(config-if-range)#switchport mode trunk   trunk

5) Switch(config-if-range)#exit

4.二层交换机2

6) Switch(config)#vlan 2 划分 vlan2 

7) Switch(config-vlan)#exit

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

9) Switch(config-if-range)#switchport mode trunk 

10) Switch(config-if-range)#exit

结构验证:

交换机1

bubuko.com,布布扣

 

交换机2

bubuko.com,布布扣

 

问题和经验:

1、HSRP组成员

活跃路由器

备份路由器

虚拟路由器(即该LAN上的网关)

其他路由器

2、HSRP虚拟MAC地址格式

0000.0c07.ac2f

厂商编码

HSRP虚拟MAC地址,HSRP编码总是07.ac

HSRP组号

 

热备份路由协议(HSRP)与生成树协议(TCP),布布扣,bubuko.com

热备份路由协议(HSRP)与生成树协议(TCP)

标签:hstp   ip地址   tcp   路由器   拓扑图   

原文地址:http://9265610.blog.51cto.com/9255610/1540257

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!