Cấu hình AAA trên router Cisco

Discussion in 'Routing' started by chien96, Sep 28, 2018.

  1. chien96

    chien96 New Member

    Cấu hình AAA (authentication, authorization, and accounting) trên Router Cisco
    1.png
    Yêu cầu:

    1. Cấu hình cơ bản trên các thiết bị.
    2. Authentication:
    a. Cấu hình telnet trên R1 sử dụng cơ chế xác thực AAA.
    b. Cấu hình xác thực kết nối console sử dụng cơ chế AAA.
    3. Authorization:
    a. Cấu hình phân quyền trên R1 chỉ cho phép quản trị subadmin tiến hành telnet, đặt IP trên các cổng, được quyền “shutdown” & “no shutdown” các interface và kiểm tra được cấu hình “running-config”.
    b. Cấu hình các phân quyền khác cho subadmin.
    4. Accounting: Cấu hình kiểm toán Accounting bằng tính năng Config Log Archive trên Router.

    Thực hiện:

    Yêu cầu 1.
    Cấu hình cơ bản trên các thiết bị.
    Cấu hình cơ bản trên R1.
    hostname R1
    interface f0/0
    ip address 192.168.1.1 255.255.255.0
    no shutdown
    exit
    line con 0
    logging synchronous
    exec-timeout 0 0
    exit

    Yêu cầu 2.a. Cấu hình telnet trên R1 sử dụng cơ chế xác thực AAA.
    Cấu hình telnet sử dụng cơ chế xác thực AAA trên R1.
    - aaa new-model: Kích hoạt tính năng xác thực AAA cục bộ tại thiết bị và sử dụng local username & password trên router nếu không khai báo các phương thức AAA statement khác. AAA được viết tắt từ 3 từ khóa.
    o Authentication: Xác thực, ai được quyền telnet tới thiết bị.
    o Authorization: Phân quyền, user sau khi telnet thành công tới thiết bị chỉ được thực hiện một số câu lệnh nhất định.
    o Accounting: Kiểm toán, ghi chú lại thông tin user đã thực hiện những câu lệnh nào tại thiết bị.
    - aaa authentication login TELNET-LOGIN local enable:
    o local: sử dụng local username để xác thực.
    o enable: Sử dụng enable password để xác thực.
    - username admin secret cisco: tạo tài khoản cho phép user kết nối telnet tới thiết bị, có thể tạo nhiều username & password.

    aaa new-model
    aaa authentication login VTY local enable
    line vty 0 4
    login authentication VTY
    exit
    username admin privilege 15 secret cisco
    username subadmin privilege 1 secret cisco

    enable secret level 2 level2
    enable secret level 15 cisco

    Tại PC1 telnet tới R1 với tài khoản admin hoặc subadmin nhưng subadmin gần như vẫn chưa thể cấu hình được R1.

    C:\PC1> telnet 192.168.1.1

    User Access Verification
    Username: subadmin
    Password: cisco
    R1>

    R1> enable 2
    Password: level2
    R1#

    R1# show privilege
    Current privilege level is 2
    R1#

    R1# show ip interface brief
    Interface IP-Address OK? Method Status Protocol
    FastEthernet0/0 192.168.1.1 YES manual up up
    FastEthernet0/1 unassigned YES unset administratively down down
    R1#

    R1# show arp
    Protocol Address Age (min) Hardware Addr Type Interface
    Internet 192.168.1.1 - c202.b65f.0000 ARPA FastEthernet0/0
    Internet 192.168.1.2 145 c201.b794.0000 ARPA FastEthernet0/0
    R1#

    R1# configure terminal
    Enter configuration commands, one per line. End with CNTL/Z.
    R1(config)# interface f0/1
    R1(config-if)# ip add 172.16.2.1 255.255.255.0
    R1(config-if)# shutdown

    ^
    % Invalid input detected at '^' marker.
    R1(config-if)# no shutdown
    ^
    % Invalid input detected at '^' marker.
    R1(config-if)#

    R1(config)# interface f0/1
    R1(config-if)# ?

    Interface configuration commands: default Set a command to its defaults exit Exit from interface configuration mode help Description of the interactive help system ip Interface Internet Protocol config commands no Negate a command or set its defaults
    R1(config-if)#

    R1# show running-config
    ^
    % Invalid input detected at '^' marker.
    R1#

    Yêu cầu 2.b. Cấu hình xác thực kết nối console sử dụng cơ chế AAA.
    aaa authentication login CONSOLE local enable
    aaa authentication login VTY local enable

    line vty 0 4
    login authentication VTY
    exit
    line con 0
    login authentication CONSOLE
    exit

    Yêu cầu 3.a. Cấu hình phân quyền trên R1 chỉ cho phép quản trị subadmin tiến hành telnet, đặt IP trên các cổng, được quyền “shutdown” & “no shutdown” các interface và kiểm tra được cấu hình “running-config”.
    - aaa authorization exec VTY local: Kích hoạt chức năng phân quyền local authorization trên R1.
    - aaa authorization command 2 VTY local: Kích hoạt phân quyền cho level 2 bằng phương thức local authorization trên R1.

    Router# privilege exec
    Router(config)# privilege configure
    Router(config-if)# privilege interface


    privilege exec level 2 show running-config
    privilege exec level 2 configure terminal
    privilege configure level 2 interface
    privilege interface level 2 ip address
    privilege interface level 2 shutdown
    privilege interface level 2 no shutdown

    aaa authorization exec VTY local
    aaa authorization command 2 VTY local

    PC1> telnet 192.168.1.1
    Trying 192.168.1.1 ... Open
    User Access Verification
    Username: subadmin
    Password:
    R1> enable 2
    Password:
    R1# show privilege

    Current privilege level is 2
    R1# show running-config
    Building configuration...

    Current configuration : 198 bytes
    !
    boot-start-marker
    boot-end-marker
    !
    interface FastEthernet0/0
    ip address 192.168.1.1 255.255.255.0
    !
    interface FastEthernet0/1
    ip address 172.16.2.1 255.255.255.0
    shutdown
    !
    end
    R1# configure terminal
    Enter configuration commands, one per line. End with CNTL/Z.
    R1(config)# interface f0/1
    R1(config-if)# shutdown
    R1(config-if)# no shutdown


    Phụ tá quản trị subadmin có thể đăng nhập vào thiết bị với level 15 để toàn quyền cấu hình thiết bị.
    R1# show privilege
    Current privilege level is 2
    R1# enable
    Password: cisco
    R1# show privilege
    Current privilege level is 15
    R1#

    Có thể phân quyền cho telnet user bằng cách thiết lập nhiều enable secret với các level khác nhau hoặc nhúng trực tiếp level ở chế độ “line vty”.
    enable secret level 2 level2
    enable secret level 3 level3
    enable secret level 15 cisco

    line vty 0 4
    privilege level 2
    exit

    Yêu cầu 3.b. Cấu hình các phân quyền khác cho subadmin.
    Cấu hình phân quyền cho phép subadmin.
    - Thay đổi được hostname của Router.
    - Bật tắt giao thức CDP trên Router.
    - Cấu hình định tuyến tĩnh trên Router.
    - Chỉ được cấu hình Extended ACL, không được cấu hình Standard ACL.

    Yêu cầu 4. Cấu hình kiểm toán Accounting bằng tính năng Config Log Archive trên Router.
    Tính năng Config Log Archive cho phép ghi chép lại tất cả các câu lệnh command mà user hoặc admin thực hiện trên thiết bị.
    Bật tính năng Config Log Archive trên Router.
    archive
    log config
    logging enable
    exit
    exit

    Để khảo sát tính năng Config Log Archive, subadmin telnet tới R1 và thực hiện các lệnh sau.
    PC1> telnet 192.168.1.1
    Trying 192.168.1.1 ... Open
    User Access Verification
    Username: subadmin
    Password:
    R1> enable 2
    Password:
    R1# configure terminal
    Enter configuration commands, one per line. End with CNTL/Z.
    R1(config)# interface loopback 1
    R1(config-if)# ip address 10.0.0.1 255.255.255.255
    R1(config-if)# no shutdown
    R1(config-if)# exit
    R1(config)# exit
    R1# clock set 14:00:00 Nov 2 2016

    ^
    % Invalid input detected at '^' marker.
    R1#
    hoặc
    interface loopback 1
    ip address 10.0.0.1 255.255.255.255
    no shutdown
    exit
    exit
    clock set 14:00:00 Nov 2 2016

    Tiến hành console vào R1 để kiểm tra lịch sử các command đã thực hiện.
    R1# show archive log config all
    idx sess user@line Logged command
    1 1 console@console | logging enable
    2 1 console@console | exit
    3 1 console@console | exit
    4 0 subadmin@vty0 |!exec: enable failed
    5 2 subadmin@vty0 |interface loopback 1
    6 2 subadmin@vty0 | ip address 10.0.0.1 255.255.255.255
    7 2 subadmin@vty0 | no shutdown
    8 2 subadmin@vty0 | exit
    R1#

    Xóa thông tin lịch sử các command đã thực hiện.
    R1# clear archive log config force

    Chúc các bạn thành công!

     

Share This Page