【思唯网络】HSRP+DHCP实验讲解
首页 > >   作者:浙江思唯网络  2019年11月19日 17:19 星期二  字号:   评论:0 条
时间:2019-11-19 17:19   评论:0 条 

HSRP+DHCP实验

拓扑图

119.png

实验目的

1)在三层交换机上f0/1-2做三层portchannel,创建vlan 100vlan 200,分别对应网段192.168.100.0/24 ,192.168.200.0/24

2) 两台交换机上配置HSRP sw1作为vlan100的主路由器,sw2作为vlan 200的主路由器

3)配置dhcp pool,是的下联pc自动获取地址

 

配置脚本

1.配置三层portchannel

1 SW1(config)#int port-channel 1

2 SW1(config-if)#no switchport

3 SW1(config-if)#ip addr 12.1.1.1 255.255.255.0

4 SW1(config)#int range f0/1-2

5 SW1(config-if-range)#no switchport

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

7

8

9

10 SW2(config)#int port-channel 1

11 SW2(config-if)#no switchport

12 SW2(config-if)#ip addr 12.1.1.2 255.255.255.0

13 SW2(config)#int range f0/1-2

14 SW2(config-if-range)#no switchport

15 SW2(config-if-range)#channel-group 1 mode active

验证:

 

1 SW2#show etherchannel su

2 Flags:  D - down        P - in port-channel

3        I - stand-alone s - suspended

4       H - Hot-standby (LACP only)

5        R - Layer3      S - Layer2

6        U - in use      f - failed to allocate aggregator

7        u - unsuitable for bundling

 8      w - waiting to be aggregated

 9      d - default port

10

11

12 Number of channel-groups in use: 1

13 Number of aggregators:           1

14

15 Group  Port-channel  Protocol    Ports

16 ------+-------------+-----------+----------------------------------------------

17

18 1      Po1(RU)           LACP   Fa0/1 (P ) Fa0/2(P )

19

2.配置HSRP

1 #创建vlan100 vlan200

2 SW1(config)#vlan 100

3 SW1(config-vlan)#vlan 200

4

5 #配置HSRP

6 SW1(config)#int range f0/3-4

7 SW1(config-if-range)#sw tr en do

8 SW1(config-if-range)#sw mo tr

9 SW1(config)#int f0/4

10 SW1(config-if)#sw tr allowed vlan 200

11 SW1(config-if)#int f0/3

12 SW1(config-if)#sw tr allowed vlan 100

13 二层交换机接口设置trunk

14

15

16 SW1(config)#int vlan 100

17 SW1(config-if)#ip addr 192.168.100.252 255.255.255.0

18 SW1(config-if)#standby 1 ip 192.168.100.254 #设置虚拟网关

19 SW1(config-if)#standby 1 priority 200 #设置优先级为200

20 SW1(config-if)#standby 1 preempt #开启抢占

21

22

23 SW1(config-if)#int vlan 200

24 SW1(config-if)#ip addr 192.168.200.253 255.255.255.0

25 SW1(config-if)#standby 2 ip 192.168.200.254

26 SW1(config-if)#standby 2 priority 195

27 SW1(config-if)#standby 2 preempt

28 %HSRP-6-STATECHANGE: Vlan100 Grp 1 state Speak -> Standby

29

30 %HSRP-6-STATECHANGE: Vlan100 Grp 1 state Standby -> Active

31

32 %HSRP-6-STATECHANGE: Vlan200 Grp 2 state Speak -> Standby

33

34 %HSRP-6-STATECHANGE: Vlan200 Grp 2 state Standby -> Active

35

36

37 -----------------

38 SW2(config)#vlan 100

39 SW2(config-vlan)#vlan 200

40

41 SW2(config)#int range f0/3-4

42 SW2(config-if-range)#sw tr en do

43 SW2(config)#int vlan 100

44 SW2(config-if-range)#sw mo tr

45 SW2(config)#int f0/4

46 SW2(config-if)#sw tr allowed vlan 200

47 SW2(config-if)#int f0/3

48 SW2(config-if)#sw tr allowed vlan 100

49

50 SW2(config-if)#ip addr 192.168.100.253 255.255.255.0

51 SW2(config-if)#standby 1 ip 192.168.100.254

52 SW2(config-if)#standby 1 priority 195

53 SW2(config-if)#standby 1 preempt

54 SW2(config-if)#int vlan 200

55 SW2(config-if)#ip addr 192.168.200.252 255.255.255.0

56 SW2(config-if)#standby 2 ip 192.168.200.254

57 SW2(config-if)#standby 2 priority 200

58 SW2(config-if)#standby 2 preempt

59 %HSRP-6-STATECHANGE: Vlan100 Grp 1 state Speak -> Standby

60

61 %HSRP-6-STATECHANGE: Vlan100 Grp 1 state Standby -> Active

62

63 %HSRP-6-STATECHANGE: Vlan200 Grp 2 state Speak -> Standby

64

65 %HSRP-6-STATECHANGE: Vlan200 Grp 2 state Standby -> Active

66

67 %HSRP-6-STATECHANGE: Vlan100 Grp 1 state Speak -> Standby

68

验证:

 

1 SW2#show standby brief

2                    P indicates configured to preempt.

3                     |

4 Interface   Grp  Pri P State    Active          Standby         Virtual IP

5 Vl100       1    195 P Standby  192.168.100.252 local           192.168.100.254

6 Vl200       2    200 P Active   local           192.168.200.253 192.168.200.254

7

8

9 SW1#show standby brief

10                    P indicates configured to preempt.

11                     |

12 Interface   Grp  Pri P State    Active          Standby         Virtual IP

13 Vl100       1    200 P Active   local           192.168.100.253 192.168.100.254

14 Vl200       2    195 P Standby  192.168.200.252 local           192.168.200.254

15

16 ## 3.配置DHCP POOL

17 SW1(config)#ip dhcp pool vlan100

18 SW1(dhcp-config)#network 192.168.100.0 255.255.255.0

19 SW1(dhcp-config)#default-router 192.168.100.254

20 SW1(dhcp-config)#dns-server 8.8.8.8

21 SW1(config)#ip dhcp excluded-address 192.168.100.252 192.168.100.254

22

23 SW1(dhcp-config)#network 192.168.200.0 255.255.255.0

24 SW1(dhcp-config)#default-router 192.168.200.254

25 SW1(dhcp-config)#dns-server 8.8.8.8

26 SW1(config)#ip dhcp excluded-address 192.168.200.252 192.168.200.254

27

28

29

30 SW2(config)#ip dhcp excluded-address 192.168.100.252 192.168.100.254

31 SW2(config)#ip dhcp excluded-address 192.168.200.252 192.168.200.254

32 SW2(config)#ip dhcp pool vlan100

33 SW2(dhcp-config)# network 192.168.100.0 255.255.255.0

34 SW2(dhcp-config)# default-router 192.168.100.254

35 SW2(dhcp-config)# dns-server 8.8.8.8

36 SW2(dhcp-config)#ip dhcp pool vlan200

37 SW2(dhcp-config)# network 192.168.200.0 255.255.255.0

38 SW2(dhcp-config)# default-router 192.168.200.254

验证

关闭sw1,验证是否能够ping通网关

 

1 SW1(config)#int range f0/1-4

2 SW1(config-if-range)#shut

3

 

1

2 SW2#show standby brief

3                     P indicates configured to preempt.

4                     |

5 Interface   Grp  Pri P State    Active          Standby         Virtual IP

6 Vl100       1    195 P Active   local           unknown         192.168.100.254

7 Vl200       2    200 P Active   local           192.168.200.253 192.168.200.254

8

9

10

11 C:\>ping 192.168.100.254

12

13 Pinging 192.168.100.254 with 32 bytes of data:

14

15 Reply from 192.168.100.254: bytes=32 time<1ms TTL=255

16 Reply from 192.168.100.254: bytes=32 time=1ms TTL=255

17 Reply from 192.168.100.254: bytes=32 time<1ms TTL=255

18 Reply from 192.168.100.254: bytes=32 time<1ms TTL=255

开启sw1

 

1 SW1(config-if-range)#no shut

2

3

4 SW1#show standby brief

5                    P indicates configured to preempt.

6                     |

7 Interface   Grp  Pri P State    Active          Standby         Virtual IP

8 Vl100       1    200 P Active   local           192.168.100.253 192.168.100.254

9 Vl200       2    195 P Standby  192.168.200.252 local           192.168.200.254

 

目前CCIE RS 笔试和LAB 稳定,持续过人中,了解之前的PASS情况和咨询考试情况

请加QQ:804990984 , 839898248

技术交流请加群:859273036,备注博客

扫描二维码也可以加群哦:
技术交流群.jpg

 您阅读这篇文章共花了: 
 本文无需标签!
二维码加载中...
技术交流:欢迎在本文下方留言或加入QQ群:859273036 互相学习。     
本文地址:http://www.023wg.com/670.html
版权声明:若无注明,本文皆为“Swiers思唯网络博客”原创,转载请保留文章出处。

返回顶部    首页   
版权所有:Swiers思唯网络博客    浙江思唯网络