1.       作业要求:

参照拓扑:

利用跟踪技术实现链路的安全备份,达到让用户安全上网的需求!

1.1    正常情况vlan10的用户走左侧链路(即通过s1 访问internet

Vlan20的用户走右侧链路(即通过s0 访问internet

1.2    S1链路断掉后,VLAN10也走右侧通过S0上网(R5vlan1020成为master

1.3    S1链路复原之后,vlan10还自动切回这条路(链路分流,提升速度)

1.4    提示:R14上监控S1 ,R5上监控S0

2.       拓扑图

clip_image002

IP地址分配表:

路由器     端口        ip地址及子网掩码    网关          DNS

R7          S1         192.168.1.1/24

              S0         192.168.2.1/24

              E1         192.168.101.222/24

R14        S1         192.168.1.2/24      192.168.1.1

R5          S0         192.168.2.2/24      192.168.2.1

V10        E0/4        192.168.10.8/24    192.168.101.24   222.88.88.88

V20       E0/14        192.168.20.10/24  192.168.101.24   222.88.88.88

注意:v10指的是vlan10内的主机 v20指的是vlan20内的主机

其他设备为本局域网上网用的,直接连上即可(可上网网关为192.168.101.254/24

DNS为:222.88.88.88  辅助DNS:222.85.85.85

3.       设备描述:

路由器:H3C Quidway R26213台)

交换机:H3C Quidway S 3526E (2)

4.       配置命令及注意事项:

4.1 ip+启动gvrpvlan同步)+做通道+启动STP

配基本ip

[R14]int s1

[R14-Serial1]ip add 192.168.1.2 24

[R14-Serial1]int e1.10

[R14-Ethernet1.10]vlan-type dot1q vid 10

[R14-Ethernet1.10]ip address 192.168.10.1 24

[R14-Ethernet1.10]int e1.20

[R14-Ethernet1.20]vlan-type dot1q vid 20   

[R14-Ethernet1.20]ip address 192.168.20.1 24

[R5]int s0

[R5-Serial0]ip add 192.168.2.2 24

[R5-Serial0]int e1.10

[R5-Ethernet1.10]vlan-type dot1q vid 10

[R5-Ethernet1.10]ip add 192.168.10.2 24

[R5-Ethernet1.10]int e1.20            

[R5-Ethernet1.20]vlan-type dot1q vid 20

[R5-Ethernet1.20]ip add 192.168.20.2 24

   启动gvrp协议并做trunk链路

[S10]gvrp               //该协议目的达到交换机上vlan信息同步

 GVRP is enabled globally.

[S10]stp enable  //启用生成树协议

[S10]int e 0/1

[S10-Ethernet0/1]port link-type trunk

[S10-Ethernet0/1]port trunk permit vlan all

 Please wait........................................... Done.

[S10-Ethernet0/1]quit

[S10]vlan 10

[S10-vlan10]port e0/4 to e 0/5

[S10-vlan10]vlan 20

[S10-vlan20]port e0/11 to e 0/15

   通道:通过链路聚合实现(要求百兆全双工链路)

[S10]link-aggregation eth 0/9 to et0/10 ingress

 The duplex of aggregating ports should be full mode!

[S10]int e0/9

[S10-Ethernet0/9]duplex full

[S10-Ethernet0/9]speed 100

[S10]int e0/10

[S10-Ethernet0/10]duplex full

[S10-Ethernet0/10]

%Aug 19 17:50:25 2012 S10 L2INF/5/PORT LINK STATUS CHANGE:

 Ethernet0/10: turns into DOWN state

%Aug 19 17:50:26 2012 S10 L2INF/5/PORT LINK STATUS CHANGE:

 Ethernet0/10: turns into UP state

[S10-Ethernet0/10]speed 100

  Gvrp 协议应用于接口

[S10]int e0/9

[S10-Ethernet0/9]port link-type trunk

[S10-Ethernet0/9]port trunk permit vlan all

 Please wait........................................... Done.

[S10-Ethernet0/9]gvrp  

 GVRP is enabled on port Ethernet0/9.

[S10-Ethernet0/9]int e0/10

[S10-Ethernet0/10]port link-type trunk     

[S10-Ethernet0/10]port trunk permit vlan all

 Please wait........................................... Done.

[S10-Ethernet0/10]gvrp

 GVRP is enabled on port Ethernet0/10.

[S10-Ethernet0/10]quit

[S38]GVRP

 GVRP is enabled globally.

[S38]stp enable  //启用生成树协议

[S38]INT E0/1

[S38-Ethernet0/1]port link-type trunk

[S38-Ethernet0/1]port trunk permit vlan all

 Please wait........................................... Done.

[S38]link-aggregation eth0/9 to eth0/10 both  改为另一个模式即 ingress

 The duplex of aggregating ports should be full mode!

S38]int e0/9

[S38-Ethernet0/9]duplex full

[S38-Ethernet0/9]speed  100

[S38-Ethernet0/9]gvrp

[S38-Ethernet0/9]int e0/10

[S38-Ethernet0/10] 

%Aug 19 17:01:54 2012 S38 SYSM/5/MAC MOVE:Slot=1;MAC addr 00e0-fc06-5520 will move to port 9 from port 10

%Aug 19 17:01:54 2012 S38 SYSM/5/MAC MOVE:Slot=1;MAC addr 00e0-fc06-5520 will move to port 10 from port 9

[S38-Ethernet0/10]duplex ful

[S38-Ethernet0/10]speed 100

[S38-Ethernet0/10]gvrp

查看链路捆绑状态

[S38]dis link-aggregation e0/9

 Master port: Ethernet0/9

 Other sub-ports:

      Ethernet0/10

 Mode: both

[S38]dis link-aggregation e0/10

 This port is not a master port. Its master port is Ethernet0/9.

[S38]dis  gvrp status

                   GVRP is enabled

[S38]dis  gvrp statistics

         GVRP statistics on port Ethernet0/1

             

     GVRP Status                       : Disabled

                   GVRP Failed Registrations       : 0

                   GVRP Last Pdu Origin                : 0000-0000-0000

                   GVRP Registration Type           : Normal

         GVRP statistics on port Ethernet0/9

                   GVRP Status                       : Enabled

                   GVRP Failed Registrations       : 0

                   GVRP Last Pdu Origin                : 00e0-fc06-5520

                   GVRP Registration Type           : Normal

         GVRP statistics on port Ethernet0/10

                   GVRP Status                       : Enabled

                   GVRP Failed Registrations       : 0

                   GVRP Last Pdu Origin                : 00e0-fc06-5520

                   GVRP Registration Type           : Normal

   检测gvrp是否生效

[S38]dis vlan all

 VLAN ID: 1

 VLAN Type: static

 Route Interface: not configured

 Description: VLAN 0001

 Tagged   Ports: none

 Untagged Ports:

             Ethernet0/1          Ethernet0/2          Ethernet0/3         

             Ethernet0/4          Ethernet0/5          Ethernet0/6         

             Ethernet0/7          Ethernet0/8          Ethernet0/9         

             Ethernet0/10         Ethernet0/11         Ethernet0/12        

             Ethernet0/13         Ethernet0/14         Ethernet0/15        

             Ethernet0/16         Ethernet0/17         Ethernet0/18        

             Ethernet0/19         Ethernet0/20         Ethernet0/21        

             Ethernet0/22         Ethernet0/23         Ethernet0/24        

 VLAN ID: 10

 VLAN Type: dynamic

 Route Interface: not configured

 Description: VLAN 0010

 Tagged   Ports:

             Ethernet0/9          Ethernet0/10        

 Untagged Ports: none                                     

 VLAN ID: 20                             

 VLAN Type: dynamic                      

 Route Interface: not configured         

 Description: VLAN 0020                  

 Tagged   Ports:                         

             Ethernet0/9          Ethernet0/10        

 Untagged Ports: none          //证明gvrp已达到同步

vlan划分端口:

[S38]vlan 10

[S38-vlan10]port e0/4 to e0/5

 Dynamic VLAN is configured, now changed to static!

[S38-vlan10]vlan 20

[S38-vlan20]port e0/11 to e0/15

 Dynamic VLAN is configured, now changed to static!

[R14]ping 192.168.10.2

  PING 192.168.10.2: 56  data bytes, press CTRL_C to break

    Reply from 192.168.10.2: bytes=56 Sequence=0 ttl=255 time = 13 ms

Reply from 192.168.10.2: bytes=56 Sequence=1 ttl=255 time = 2 ms

[R5]ping 192.168.10.1

  PING 192.168.10.1: 56  data bytes, press CTRL_C to break

    Request time out

    Request time out

  Reply from 192.168.10.1: bytes=56 Sequence=2 ttl=255 time = 2 ms

  Reply from 192.168.10.1: bytes=56 Sequence=3 ttl=255 time = 2 ms

clip_image004

4.2 配置VRRP 冗余安全配置:

[R14]vrrp ping-enable            //不写不能ping通虚拟ip

[R14]int e1.10

[R14-Ethernet1.10]vrrp vrid 10 virtual-ip 192.168.10.254

[R14-Ethernet1.10]vrrp vrid 10 priority 120   //优先级

[R14-Ethernet1.10]vrrp vrid 10 preempt-mode  //权限争夺

[R14-Ethernet1.10]vrrp vrid 10 track serial 1 reduced 40

//跟踪出口,调整浮动值(在优先级的基础上)

[R14-Ethernet1.10]int e1.20  // 优先级默认100

[R14-Ethernet1.20]vrrp vrid 20 virtual-ip 192.168.20.254

[R14-Ethernet1.20]vrrp vrid 20 preempt-mode            

[R14-Ethernet1.20]vrrp vrid 20 track serial 1 reduced 40

[R14]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1  //静态路由

[R5]int e1.10

[R5-Ethernet1.10]vrrp vrid 10 virtual-ip 192.168.10.254

[R5-Ethernet1.10]vrrp vrid 10 preempt-mode

[R5-Ethernet1.10]vrrp vrid 10 track s0 reduced 40

[R5-Ethernet1.10]int e1.20

[R5-Ethernet1.20]vrrp vrid 20 virtual-ip 192.168.20.254

[R5-Ethernet1.20]vrrp vrid 20 priority 120

[R5-Ethernet1.20]vrrp vrid 20 preempt-mode

[R5-Ethernet1.20]vrrp vrid 20 track s0 reduce 40

[R5]ip route-static 0.0.0.0 0.0.0.0 192.168.2.1

[R5]ping  -C 2000 192.168.20.2 

  PING 192.168.20.2: 56  data bytes, press CTRL_C to break

    Reply from 192.168.20.2: bytes=56 Sequence=0 ttl=255 time = 1 ms

    Reply from 192.168.20.2: bytes=56 Sequence=1 ttl=255 time = 2 ms

clip_image006

 

[R7]int s0

[R7-Serial0]ip add 192.168.2.1 24

[R7-Serial0]

%01:04:55: Line protocol ip on the interface Serial0 is UP

[R7-Serial0]shutdown

% Interface Serial0 is down

[R7-Serial0]

%01:05:01: Interface Serial0 is DOWN

[R7-Serial0]undo shutdown

% Interface Serial0 is reset

[R7]int s1

[R7-Serial1]ip add 192.168.1.1 24

[R7-Serial1]

%01:08:14: Line protocol ip on the interface Serial1 is UP

[R7-Serial1]shutdown   //串行端口的另一端要复位!

% Interface Serial1 is down

[R7-Serial1]

%01:08:20: Interface Serial1 is DOWN

[R7-Serial1]undo shutdown

% Interface Serial1 is reset

[R7-Serial1]int e 1

[R7-Ethernet1]ip add 192.168.101.222 24

[R7]acl 2000

[R7-acl-2000]rule permit source any

  Rule has been added to normal packet-filtering rules

[R7-acl-2000]int e1

[R7-Ethernet1]nat outbound 2000 interface

[R7-Ethernet1]quit

[R7]ip route-static 0.0.0.0 0.0.0.0 192.168.101.254

查看配置:display  cu 

  ip route-static 0.0.0.0 0.0.0.0 192.168.101.254 preference 60  //默认60

  ip route-static 192.168.10.0 255.255.255.0 192.168.1.2 preference 40 //该路正常就走1.2

  ip route-static 192.168.10.0 255.255.255.0 192.168.2.2 preference 50 断掉,走2.2

  ip route-static 192.168.20.0 255.255.255.0 192.168.2.2 preference 40

  ip route-static 192.168.20.0 255.255.255.0 192.168.1.2 preference 50 !

  return

[R7]display  ip routing

Routing Tables:

  Destination/Mask  Proto   Pref     Metric     Nexthop    Interface

        0.0.0.0/0   Static   60         0  192.168.101.254 Ethernet1          

      127.0.0.0/8   Direct    0         0        127.0.0.1 LoopBack0          

      127.0.0.1/32  Direct    0         0        127.0.0.1 LoopBack0          

    192.168.1.0/24  Direct    0         0      192.168.1.2 Serial1            

    192.168.1.1/32  Direct    0         0        127.0.0.1 LoopBack0          

    192.168.1.2/32  Direct    0         0      192.168.1.2 Serial1            

    192.168.2.0/24  Direct    0         0      192.168.2.2 Serial0            

    192.168.2.1/32  Direct    0         0        127.0.0.1 LoopBack0          

    192.168.2.2/32  Direct    0         0      192.168.2.2 Serial0            

   192.168.10.0/24  Static   40         0      192.168.1.2 Serial1            

   192.168.20.0/24  Static   40         0      192.168.2.2 Serial0            

  192.168.101.0/24  Direct    0         0  192.168.101.222 Ethernet1          

192.168.101.222/32  Direct    0         0        127.0.0.1 LoopBack0 

clip_image008

拔掉(shutdown)R14R7之间的链路!状态发生了改变!

clip_image010

clip_image012

 

测试:客户机:

clip_image014

clip_image016

clip_image018

clip_image020

clip_image022

clip_image024

走的是右侧的路!

断开R5 R7之间的串行链路,测试:

clip_image026

clip_image028

clip_image030

clip_image032

没有丢包!

断开R14R7之间的链路:

clip_image034

Vlan20 的机器还能和vlan10中的pc正常通信!

clip_image036

clip_image038

Vlan10 中的机器:

clip_image040

Dns 222.88.88.88        辅助dns 222.85.85.85

正常上网:

走的是左侧:

经过:192.168.10.1

      192.168.1.1

      192.168.101.254

clip_image042

如果S1断掉:

clip_image044

走的是右侧的路,成功!