zoukankan      html  css  js  c++  java
  • VRRP组网下同网段内配置基于全局地址池的DHCP服务器

    组网图形

        

    DHCP服务器简介

    • 见前面DHCP服务器文章,不再赘述。

    组网需求

    • 如图1所示,某企业内的一台主机通过Switch双归属到SwitchA和SwitchB,SwitchA为主设备,作为DHCP服务器为客户端分配IP地址。现用户希望当主设备故障时,客户端能够通过备设备重新获取IP地址。

    配置思路

    • VRRP组网下同网段内配置基于全局地址池的DHCP服务器,配置思路如下:
    • 1.配置SwitchA和SwitchB设备上接口IP地址,使各设备间网络层连通;同时配置Switch上的二层透传功能。
    • 2.在SwitchA和SwitchB上配置VRRP备份组。其中,SwitchA上配置较高优先级,作为Master设备为客户端分配IP地址;SwitchB上配置较低优先级,作为备用交换机。
    • 3.在SwitchA和SwitchB上创建全局地址池,并配置地址池相关属性。
    • 4.在SwitchA、SwitchB和Switch上配置破环协议,防止环路的产生(此处以配置STP为例)。

    操作步骤

    • 1.配置设备间的网络互连

      # 配置设备各接口的IP地址,以SwitchA为例。SwitchB的配置与SwitchA类似,不再赘述。

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] vlan batch 100
    [SwitchA] interface gigabitethernet 0/0/2
    [SwitchA-GigabitEthernet0/0/2] port link-type hybrid
    [SwitchA-GigabitEthernet0/0/2] port hybrid pvid vlan 100
    [SwitchA-GigabitEthernet0/0/2] port hybrid untagged vlan 100
    [SwitchA-GigabitEthernet0/0/2] quit
    [SwitchA] interface gigabitethernet 0/0/5
    [SwitchA-GigabitEthernet0/0/5] port link-type hybrid
    [SwitchA-GigabitEthernet0/0/5] port hybrid pvid vlan 100
    [SwitchA-GigabitEthernet0/0/5] port hybrid untagged vlan 100
    [SwitchA-GigabitEthernet0/0/5] quit
    [SwitchA] interface vlanif 100
    [SwitchA-Vlanif100] ip address 10.1.1.1 24
    [SwitchA-Vlanif100] quit
    

       # 配置Switch的二层透传功能。

    <HUAWEI> system-view
    [HUAWEI] sysname Switch
    [Switch] vlan 100
    [Switch-vlan100] quit
    [Switch] interface gigabitethernet 0/0/1
    [Switch-GigabitEthernet0/0/1] port link-type hybrid
    [Switch-GigabitEthernet0/0/1] port hybrid pvid vlan 100
    [Switch-GigabitEthernet0/0/1] port hybrid untagged vlan 100
    [Switch-GigabitEthernet0/0/1] quit
    [Switch] interface gigabitethernet 0/0/2
    [Switch-GigabitEthernet0/0/2] port link-type hybrid
    [Switch-GigabitEthernet0/0/2] port hybrid pvid vlan 100
    [Switch-GigabitEthernet0/0/2] port hybrid untagged vlan 100
    [Switch-GigabitEthernet0/0/2] quit
    [Switch] interface gigabitethernet 0/0/3
    [Switch-GigabitEthernet0/0/3] port link-type access
    [Switch-GigabitEthernet0/0/3] port default vlan 100
    [Switch-GigabitEthernet0/0/3] quit
    
    • 2.创建地址池并配置相关属性

      # 在SwitchA上启动DHCP服务。

    [SwitchA] dhcp enable
    

       # 在SwitchA上创建地址池,配置地址池范围是10.1.1.2~10.1.1.128,和SwitchB上配置的地址池地址互相排除。

    说明: 
    由于交换机主设备上的地址池信息不能实时备份到备设备上,为防止主备切换后出现IP地址分配冲突,主设备和备设备上配置的地址池必须要互相排除。
    
    [SwitchA] ip pool 1
    [SwitchA-ip-pool-1] network 10.1.1.0 mask 255.255.255.0
    [SwitchA-ip-pool-1] gateway-list 10.1.1.111
    [SwitchA-ip-pool-1] excluded-ip-address 10.1.1.1
    [SwitchA-ip-pool-1] excluded-ip-address 10.1.1.129 10.1.1.254
    [SwitchA-ip-pool-1] lease day 10
    [SwitchA-ip-pool-1] quit
    

       # 在SwitchB上创建地址池,配置地址池范围是10.1.1.130~10.1.1.254,和SwitchA上配置的地址池地址互相排除。

    [SwitchB] dhcp enable
    [SwitchB] ip pool 1
    [SwitchB-ip-pool-1] network 10.1.1.0 mask 255.255.255.0
    [SwitchB-ip-pool-1] gateway-list 10.1.1.111
    [SwitchB-ip-pool-1] excluded-ip-address 10.1.1.1 10.1.1.110
    [SwitchB-ip-pool-1] excluded-ip-address 10.1.1.112 10.1.1.129
    [SwitchB-ip-pool-1] lease day 10
    [SwitchB-ip-pool-1] quit
    
    •  3.配置VRRP备份组

      # 在SwitchA上创建VRRP备份组1,配置SwitchA在该备份组中的优先级为120,并配置客户端从全局地址池中获取IP地址。

    [SwitchA] interface vlanif 100
    [SwitchA-Vlanif100] vrrp vrid 1 virtual-ip 10.1.1.111
    [SwitchA-Vlanif100] vrrp vrid 1 priority 120
    [SwitchA-Vlanif100] dhcp select global
    [SwitchA-Vlanif100] quit
    

       # 在SwitchB上创建VRRP备份组1,其在该备份组中的优先级为缺省值100,并配置客户端从全局地址池中获取IP地址。

    [SwitchB] interface vlanif 100
    [SwitchB-Vlanif100] vrrp vrid 1 virtual-ip 10.1.1.111
    [SwitchB-Vlanif100] dhcp select global
    [SwitchB-Vlanif100] quit
    
    •  4.配置STP协议,实现破除环路

      # 在Switch上全局使能STP功能,SwitchA和SwitchB的配置与之类似,不再赘述。

    [Switch] stp enable
    

       # 在Switch的GE0/0/3接口上去使能STP并将端口GE0/0/1的路径开销值配置为20000。

    [Switch] interface gigabitethernet 0/0/3
    [Switch-GigabitEthernet0/0/3] stp disable
    [Switch-GigabitEthernet0/0/3] quit
    [Switch] interface gigabitethernet 0/0/1
    [Switch-GigabitEthernet0/0/1] stp cost 20000
    [Switch-GigabitEthernet0/0/1] quit
    
    •  5.验证配置结果

      # 完成上述配置以后,在SwitchA和SwitchB上分别执行display vrrp命令,可以看到SwitchA在备份组中的状态为Master,SwitchB在备份组中的状态为Backup。

    [SwitchA] display vrrp
      Vlanif100 | Virtual Router 1
        State : Master
        Virtual IP : 10.1.1.111
        Master IP : 10.1.1.1
        PriorityRun : 120
        PriorityConfig : 120                                                        
        MasterPriority : 120                                                        
        Preempt : YES   Delay Time : 0 s
        TimerRun : 1 s
        TimerConfig : 1 s
        Auth type : NONE                                                            
        Virtual MAC : 0000-5e00-0101                                                
        Check TTL : YES                                                             
        Config type : normal-vrrp                                                   
        Backup-forward : disabled
        Create time : 2019-01-12 20:15:46
        Last change time : 2019-01-12 20:15:46
    
    [SwitchB] display vrrp
      Vlanif100 | Virtual Router 1
        State : Backup
        Virtual IP : 10.1.1.111
        Master IP : 10.1.1.1
        PriorityRun : 100
        PriorityConfig : 100                                                        
        MasterPriority : 120                                                        
        Preempt : YES   Delay Time : 0 s
        TimerRun : 1 s
        TimerConfig : 1 s
        Auth type : NONE                                                            
        Virtual MAC : 0000-5e00-0101                                                
        Check TTL : YES                                                             
        Config type : normal-vrrp                                                   
        Backup-forward : disabled
        Create time : 2019-01-12 20:15:46
        Last change time : 2019-01-12 20:15:46
    

       # 在SwitchA和SwitchB上使用display ip pool命令用来查看地址池中的IP地址分配情况,可以看到作为主设备的SwitchA成功为DHCP客户端分配了IP地址,而作为备设备的SwitchB则没有为DHCP客户端分配IP地址。

    [SwitchA] display ip pool
     -----------------------------------------------------------------------------  
      Pool-name      : 1                                                            
      Pool-No        : 0                                                            
      Lease          : 10 Days 0 Hours 0 Minutes 
      Position       : Local           Status           : Unlocked                  
      Gateway-0      : 10.1.1.111                                                   
      Network        : 10.1.1.0     
      Mask           : 255.255.255.0                                                
      VPN instance   : --                                                           
      Address Statistic: Total       :253       Used        :1                      
                         Idle        :125       Expired     :0                      
                         Conflict    :0         Disable     :127 
                                                                                    
                                                   
      IP address Statistic                                                          
        Total       :253                                                            
        Used        :1          Idle        :125                                    
        Expired     :0          Conflict    :0          Disable   :127 
    
    [SwitchB] display ip pool
     -----------------------------------------------------------------------------  
      Pool-name      : 1                                                            
      Pool-No        : 0                                                            
      Lease          : 10 Days 0 Hours 0 Minutes 
      Position       : Local           Status           : Unlocked                  
      Gateway-0      : 10.1.1.111                                                   
      Network        : 10.1.1.0     
      Mask           : 255.255.255.0                                                
      VPN instance   : --                                                           
      Address Statistic: Total       :253       Used        :0                      
                         Idle        :125       Expired     :0                      
                         Conflict    :0         Disable     :128 
                                                                                    
                                                                                    
      IP address Statistic                                                          
        Total       :253                                                            
        Used        :0          Idle        :125                                    
        Expired     :0          Conflict    :0          Disable   :128 
    

       # 在SwitchA的接口GE0/0/2和接口GE0/0/5上执行shutdown命令,模拟SwitchA出现故障。

    [SwitchA] interface gigabitethernet 0/0/2
    [SwitchA-GigabitEthernet0/0/2] shutdown
    [SwitchA-GigabitEthernet0/0/2] quit
    [SwitchA] interface gigabitethernet 0/0/5
    [SwitchA-GigabitEthernet0/0/5] shutdown
    [SwitchA-GigabitEthernet0/0/5] quit
    

       # 在SwitchB上执行display vrrp命令查看VRRP状态信息,可以看到SwitchB的状态是Master。

    [SwitchB] display vrrp
      Vlanif100 | Virtual Router 1
        State : Master
        Virtual IP : 10.1.1.111
        Master IP : 10.1.1.129
        PriorityRun : 100
        PriorityConfig : 100                                                        
        MasterPriority : 100                                                        
        Preempt : YES   Delay Time : 0 s
        TimerRun : 1 s
        TimerConfig : 1 s
        Auth type : NONE                                                            
        Virtual MAC : 0000-5e00-0101                                                
        Check TTL : YES                                                             
        Config type : normal-vrrp                                                   
        Backup-forward : disabled
        Create time : 2019-01-12 20:15:46
        Last change time : 2019-01-12 20:15:46
    

       # 在SwitchB上使用display ip pool命令用来查看IP地址池配置情况。

    [SwitchB] display ip pool
     -----------------------------------------------------------------------------  
      Pool-name      : 1                                                            
      Pool-No        : 0                                                            
      Lease          : 10 Days 0 Hours 0 Minutes 
      Position       : Local           Status           : Unlocked                  
      Gateway-0      : 10.1.1.111                                                   
      Network        : 10.1.1.0     
      Mask           : 255.255.255.0                                                
      VPN instance   : --                                                           
      Address Statistic: Total       :253       Used        :1                      
                         Idle        :124       Expired     :0                      
                         Conflict    :0         Disable     :128 
                                                                                    
                                                                                    
      IP address Statistic                                                          
        Total       :253                                                            
        Used        :1          Idle        :124                                    
        Expired     :0          Conflict    :0          Disable   :128 
    
  • 相关阅读:
    Windows Phone云应用开发实践之(三)——OData
    Windows Phone 云应用开发实践之(二)Windows Live SDK
    使用Windows Azure Web Sites构建托管的WEB应用
    Windows Phone Mango开发实践——GB2312编码转换
    概念 : 用户>角色>权限 的管理(RoleBased Access Control)
    angular uirouter 正则
    过程 : 概念 : 结构 jobbox jobPost
    css 居中,中央
    javascript : detect at the end of bottom
    设计理念 : popup login 在前后台
  • 原文地址:https://www.cnblogs.com/zhangwencheng/p/14074614.html
Copyright © 2011-2022 走看看