• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Xin chào ! Nếu đây là lần đầu tiên bạn đến với diễn đàn, xin vui lòng danh ra một phút bấm vào đây để đăng kí và tham gia thảo luận cùng VnPro.

Announcement

Collapse
No announcement yet.

Lab 14-1: Cơ bản HSRP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lab 14-1: Cơ bản HSRP

    Lab 14-1: Cơ bản HSRP

    Để cung cấp tính năng dự phòng cho một group các user nào đó, ta sử dụng nhiều router để đảm bảo độ tin cậy. Đối với HSRP thì 1 Router/Switch sẽ được chọn làm primary hay active, các router/switch còn lại làm standby. Ta có thể đặt priority cho một cho một group nào đó.

    Cấu hình cơ bản

    HSRP bầu chọn dựa vào Priority(0 đến 225), Router có priority sẽ được chọn làm active, nếu priority bằng nhau thì router nào có điạ chỉ IP trên interface HSRP cao hơn sẻ được chọn làm active: việc đặt Priority như sau:

    Router(config-if)#standby group priority priority

    Thông thường thì khi một Router đã là active trong HSRP rồi thì cho dù Router mới có Priority cao hơn cũng không được chọn làm active, tuy nhiên ta có thể cho phép router có priority cao làm active với bất kỳ lúc nào.

    Router(config-if)#standby group preempt

    Do các router chạy HSRP không tự động nhận biết được khi nào thì các gói của user không còn đi ra bên ngoài được thông qua nó nữa do đó mà ta phảI cấu hình để nhận biết được, khi nào thì một giao tiếp của HSRP router bị down không còn khả năng chuyển traffic cho user nữa thì nó sẻ tự động giảm priority của nó xuống.

    Router(config-if)#standby group track type mod/num decrementvalue
    Decrementvalue là giá trị của Priority phải giảm xuống khi track thấy một interface nào đó bị down. Mỗi cỗng giao tiếp của HSRP của router sẽ có một địa chỉ IP riêng. Tuy nhiên các Host sẽ thấy router qua một dịa chỉ ảo
    khác đó là Virtual router address.

    Router(config-if)#standby group ip ip-address

    Cấu hình Load balancing

    Với cấu hình loại này, giả sử ta có hai router chay HSRP. Ta tạo ra hai group và hai địạ chỉ IP ảo cho hai group này. Router1 có Priority lớn đối với group thứ nhất và có Priority nhỏ hơn đối với Group thứ hai. Do đó Router 1 sẽ là active cho group 1 và sẽ là Standby cho group 2. Đối với các host thì ta sẽ cấu hình cho một số host có default gateway là Virtual IP address của group 1 và một số host có default gateway là Virtual IP address của group 2. Đo đó mà tải sẽ cân bằng ở 2 router. Mỗi router sẽ đảm nhiệm một lượng tải nhất định.

    R1#show run

    Building configuration...
    !
    version 12.2
    !
    hostname R1
    !
    enable password cisco
    !
    ip subnet-zero
    !
    no ip domain lookup
    !
    interface Loopback0
    ip address 192.168.4.1 255.255.255.255
    !
    interface FastEthernet0/0
    ip address 192.168.2.1 255.255.255.0
    duplex auto
    speed auto
    standby 10 ip 192.168.2.15
    standby 20 ip 192.168.2.20
    standby 20 priority 120
    standby 30 ip 192.168.2.30
    !
    interface Serial0/0
    ip address 192.168.1.5 255.255.255.252
    no fair-queue
    clockrate 64000
    !
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    !
    ip classless
    ip http server
    !
    access-list 1 permit 172.16.0.0 0.0.3.255
    access-list 1 permit 172.16.4.0 0.0.3.255
    !
    end

    R2
    !
    hostname R2
    !
    enable password cisco
    !
    no ip domain lookup
    interface Loopback0
    ip address 192.168.4.2 255.255.255.255
    !
    interface FastEthernet0/0
    ip address 192.168.2.2 255.255.255.0
    duplex auto
    speed auto
    standby 10 ip 192.168.2.15
    standby 20 ip 192.168.2.20
    standby 30 ip 192.168.2.30
    standby 30 priority 130
    standby 30 preempt
    !
    interface Serial0/0
    ip address 192.168.1.2 255.255.255.252
    no fair-queue
    !
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    !
    ip classless
    ip http server
    end


    R3
    !
    hostname R3
    !
    enable password cisco
    !
    ip subnet-zero
    !
    no ip domain lookup
    ip host R2 192.168.1.2
    ip host R1 192.168.1.5
    !
    interface Loopback0
    ip address 192.168.4.3 255.255.255.255
    !
    interface Serial0/0
    ip address 192.168.1.6 255.255.255.252
    !
    interface Serial0/1
    ip address 192.168.1.1 255.255.255.252
    clockrate 64000
    !
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    !
    end
    Kiểm tra tính năng bằng các lệnh show standby – show standby brief
    R1#show standby
    FastEthernet0/0 - Group 10
    State is Standby
    1 state change, last state change 00:10:53
    Virtual IP address is 192.168.2.15
    Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.632 secs
    Preemption disabled
    Active router is 192.168.2.2, priority 100 (expires in 8.452 sec)
    Standby router is local
    Priority 100 (default 100)
    IP redundancy name is "hsrp-Fa0/0-10" (default)
    FastEthernet0/0 - Group 20
    State is Active
    2 state changes, last state change 00:11:07
    Virtual IP address is 192.168.2.20
    Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.024 secs
    Preemption disabled
    Active router is local
    Standby router is 192.168.2.2, priority 100 (expires in 9.724 sec)
    Priority 120 (configured 120)
    IP redundancy name is "hsrp-Fa0/0-20" (default)
    FastEthernet0/0 - Group 30
    State is Standby
    1 state change, last state change 00:10:54
    Virtual IP address is 192.168.2.30
    Active virtual MAC address is 0000.0c07.ac1e
    Local virtual MAC address is 0000.0c07.ac1e (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.432 secs
    Preemption disabled
    Active router is 192.168.2.2, priority 130 (expires in 7.252 sec)
    Standby router is local
    Priority 100 (default 100)
    IP redundancy name is "hsrp-Fa0/0-30" (default)

    R2#show standby
    FastEthernet0/0 - Group 10
    State is Active
    2 state changes, last state change 00:11:52
    Virtual IP address is 192.168.2.15
    Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.260 secs
    Preemption disabled
    Active router is local
    Standby router is 192.168.2.1, priority 100 (expires in 7.464 sec)
    Priority 100 (default 100)
    IP redundancy name is "hsrp-Fa0/0-10" (default)
    FastEthernet0/0 - Group 20
    State is Standby
    1 state change, last state change 00:11:26
    Virtual IP address is 192.168.2.20
    Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.712 secs
    Preemption disabled
    Active router is 192.168.2.1, priority 120 (expires in 8.828 sec)
    Standby router is local
    Priority 100 (default 100)
    IP redundancy name is "hsrp-Fa0/0-20" (default)
    FastEthernet0/0 - Group 30
    State is Active
    2 state changes, last state change 00:11:54
    Virtual IP address is 192.168.2.30
    Active virtual MAC address is 0000.0c07.ac1e
    Local virtual MAC address is 0000.0c07.ac1e (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.928 secs
    Preemption enabled, min delay 0 sec, sync delay 0 sec
    Active router is local
    Standby router is 192.168.2.1, priority 100 (expires in 9.132 sec)
    Priority 130 (configured 130)
    IP redundancy name is "hsrp-Fa0/0-30" (default)
    R2#show standby
    FastEthernet0/0 - Group 10
    State is Active
    2 state changes, last state change 00:11:55
    Virtual IP address is 192.168.2.15
    Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.180 secs
    Preemption disabled
    Active router is local
    Standby router is 192.168.2.1, priority 100 (expires in 7.388 sec)
    Priority 100 (default 100)
    IP redundancy name is "hsrp-Fa0/0-10" (default)
    FastEthernet0/0 - Group 20
    State is Standby
    1 state change, last state change 00:11:29
    Virtual IP address is 192.168.2.20
    Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.636 secs
    Preemption disabled
    Active router is 192.168.2.1, priority 120 (expires in 8.752 sec)
    Standby router is local
    Priority 100 (default 100)
    IP redundancy name is "hsrp-Fa0/0-20" (default)
    FastEthernet0/0 - Group 30
    State is Active
    2 state changes, last state change 00:11:57
    Virtual IP address is 192.168.2.30
    Active virtual MAC address is 0000.0c07.ac1e
    Local virtual MAC address is 0000.0c07.ac1e (default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.104 secs
    Preemption enabled, min delay 0 sec, sync delay 0 sec
    Active router is local
    Standby router is 192.168.2.1, priority 100 (expires in 9.308 sec)
    Priority 130 (configured 130)
    IP redundancy name is "hsrp-Fa0/0-30" (default)
    Ta có thể sử dụng lênh show standby brief
    R1#show standby brief
    P indicates configured to preempt.
    |
    Interface Grp Prio P State Active Standby Virtual IP
    Fa0/0 10 100 Standby 192.168.2.2 local 192.168.2.15
    Fa0/0 20 120 Active local 192.168.2.2 192.168.2.20
    Fa0/0 30 100 Standby 192.168.2.2 local 192.168.2.30
    R2#show standby brief
    P indicates configured to preempt.
    |
    Interface Grp Prio P State Active Standby Virtual IP
    Fa0/0 10 100 Active local 192.168.2.1 192.168.2.15
    Fa0/0 20 100 Standby 192.168.2.1 local 192.168.2.20
    Fa0/0 30 130 P Active local 192.168.2.1 192.168.2.30
    Ở đây thì ta thấy Router 1 active cho group 20 và standby cho group 30, ngược lạI thì Router 2 sẽ là active cho group 30 và standby cho group 20
    Kiểm tra bằng Ethereal
    Ta ping một Host có default là 192.168.2.20 (thuộc Group 20) trong HSRP ra ngoài ta thấy nó sẽ đến một Host có virtual mac là 0000:0c07:ac14: tương ứng group 20 vì 14 hex là bằng 20 decimal, vì hai số cuối cùng của Virtual mac là lấy ra từ Group number,



    Tương tự ta sử dụng một host có default gateway là 192.168.2.30 thộc group 30 thì ta cũng có được kết qủ tương tự. Ở đây thì địa chỉ mac la 0000:0c07:ac1e. 1e hexa bằng 30 decimal

    Email : vnpro@vnpro.org
    ---------------------------------------------------------------------------------------------------------------
Trung Tâm Tin Học VnPro
149/1D Ung Văn Khiêm P25 Q.Bình thạnh TPHCM
Tel : (08) 35124257 (5 lines)
Fax: (08) 35124314

Home page: http://www.vnpro.vn
Support Forum: http://www.vnpro.org
- Chuyên đào tạo quản trị mạng và hạ tầng Internet
- Phát hành sách chuyên môn
- Tư vấn và tuyển dụng nhân sự IT
- Tư vấn thiết kế và hỗ trợ kỹ thuật hệ thống mạng

Network channel: http://www.dancisco.com
Blog: http://www.vnpro.org/blog
Working...
X