• 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.

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

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

  • Cấu hình SSH trên router Cisco

    Cấu hình router để hỗ trợ SSH

    Phiên bản IOS hỗ trợ cho SSH và được dùng trong bài lab này là Advance Security. Đầu tiên hãy dùng lệnh show version để kiểm tra IOS của bạn có hỗ trợ SSH không.

    demi#sh ver
    Cisco IOS Software, 2801 Software (C2801-ADVENTERPRISEK9-M), Version 12.3(14)T4, RELEASE SOFTWARE (fc2)
    Technical Support: http://www.cisco.com/techsupport
    Copyright (c) 1986-2005 by Cisco Systems, Inc.
    Compiled Thu 08-Sep-05 17:00 by kehsiao

    ROM: System Bootstrap, Version 12.3(8r)T9, RELEASE SOFTWARE (fc1)

    demi uptime is 2 hours, 37 minutes
    System returned to ROM by power-on
    System image file is "flash:c2801-adventerprisek9-mz.123-14.T4.bin"


    Sau đó cấu hình router demi hoạt động như ssh server. Vào chế độ config mode.

    demi#conf t
    Enter configuration commands, one per line. End with CNTL/Z.

    demi(config)#ip domain-name vnpro.org
    demi(config)#crypto key generate ?
    rsa Generate RSA keys
    <cr>

    demi(config)#crypto key generate rsa ?
    general-keys Generate a general purpose RSA key pair for signing and
    encryption
    usage-keys Generate separate RSA key pairs for signing and encryption
    <cr>

    demi(config)#crypto key generate rsa gnereneral
    demi(config)#crypto key generate rsa general-keys ?
    exportable Allow the key to be exported
    label Provide a label
    modulus Provide number of modulus bits on the command line
    <cr>


    demi(config)#crypto key generate rsa general-keys modulus 1024
    The name for the keys will be: demi.vnpro.org

    % The key modulus size is 1024 bits
    % Generating 1024 bit RSA keys ...[OK]

    demi(config)#
    *Dec 10 03:53:24.763: %SSH-5-ENABLED: SSH 1.99 has been enabled


    Cấu hình cho phép các line vty chạy ssh

    demi#conf t
    Enter configuration commands, one per line. End with CNTL/Z.
    demi(config)#line vty 0 4
    demi(config-line)#login local
    demi(config-line)#transport input ssh


    Khai báo username và password cục bộ

    demi#conf t
    Enter configuration commands, one per line. End with CNTL/Z.
    demi(config)#username cisco password cisco



    Cài đặt chương trình Putty làm ssh client



    Sau đó chạy chương trình Putty



    Nhập vào username và password đã khai báo trên router



    Sau đó bạn có thể vào enable mode để cấu hình router bình thường



    Trên router lúc này dùng lệnh show ssh

    demi#show ssh
    Connection Version Mode Encryption Hmac State Username
    0 2.0 IN aes256-cbc hmac-sha1 Session started vnpro
    0 2.0 OUT aes256-cbc hmac-sha1 Session started vnpro
    %No SSHv1 server connections running.
    Đặng Quang Minh, CCIEx2#11897 (Enterprise Infrastructure, Wireless), DEVNET, CCSI#31417

    Email : dangquangminh@vnpro.org
    https://www.facebook.com/groups/vietprofessional/

  • #2
    Anh cho em hỏi khi em cấu hình các bước như trên thì khi truy nhập vào router luôn bị báo lỗi "passwork authentication fail" .Em dùng secureCRT .
    Khi dùng với puTTy thì cũng bị lỗi tương tự "access denied " do sai pass . Em dùng user và pass khai báo trong câu lệnh "user cisco pass cisco" . Em ko biết lỗi này là do đâu ?
    Cám ơn anh !

    Comment


    • #3
      hi

      bạn kiểm tra lại phiên bản IOS mà bạn đang dùng xem có hỗ trợ SSH hay không. Ngoài ra, dưới đây là một số troubleshooting tips cho phần cấu hình SSH này:

      Troubleshooting Tips

      •If your SSH configuration commands are rejected as illegal commands, you have not successfully generated a RSA key pair for your router. Make sure you have specified a host name and domain. Then use the crypto key generate rsa command to generate a RSA key pair and enable the SSH server. --> Kiểm tra xem có chỉ ra hostname/domain name hay chưa? Nếu có thì dùng lệnh cryptp key generate rsa để tạo ra cặp khóa RSA.

      •When configuring the RSA key pair, you might encounter the following error messages:

      –No hostname specified

      You must configure a host name for the router using the hostname global configuration command. For more information, see " Prerequisites to Configuring SSH."

      –No domain specified

      You must configure a host domain for the router using the ip domain-name global configuration command. For more information, see " Prerequisites to Configuring SSH."

      •The number of allowable SSH connections is limited to the maximum number of vtys configured for the router. Each SSH connection will use a vty resource. --> số kết nối SSH bằng với số line VTY có trên router.

      Xem thêm ở link cisco
      Đặng Quang Minh, CCIEx2#11897 (Enterprise Infrastructure, Wireless), DEVNET, CCSI#31417

      Email : dangquangminh@vnpro.org
      https://www.facebook.com/groups/vietprofessional/

      Comment


      • #4
        System image file is "flash:/c3550-ipservicesk9-mz.122-25.SED.bin"

        Em đang dùng hệ điều hành như trên cho switch 3550. Mọi câu lệnh cho SSH như anh hướng dẫn đều có ạ . Lệnh crypto key generate rsa để tạo ra cặp khóa RSA đều dùng được bình thường . Tuy nhiên khi SHOW SSH

        3550#show ssh
        %No SSHv1 server connections running.
        %No SSHv2 server connections running.

        thì đều báo như trên . Em chưa hiểu nguyên nhân tại sao ?

        Comment


        • #5
          hi

          Bật
          #aaa new-model

          sau đó để chế độ xác thực mặc định là local

          aaa authentication login default local

          thử lại và báo kết quả nhé.
          Đặng Quang Minh, CCIEx2#11897 (Enterprise Infrastructure, Wireless), DEVNET, CCSI#31417

          Email : dangquangminh@vnpro.org
          https://www.facebook.com/groups/vietprofessional/

          Comment


          • #6
            Em đã thử lại với cấu hình sau :
            ip http secure-server

            line vty 04
            login local
            transport input telnet ssh

            Sau đó dùng secureCRT và puttty thì đều đã chạy bình thường với SSH

            Tuy nhiên em không hề dùng lệnh
            Router(config)#crypto key ..

            Nếu như vậy thì quá trình sử dụng ssh của em có gì khác biệt không anh ??
            Khi sử dụng lệnh "ip http secure-server" thì cũng thấy thiết bị báo tạo ra cryto key . Lần cấu hình này thì em sử dụng router 2811 và chỉ có IOS ipbase thôi ạ.

            router#show ssh
            %No SSHv1 server connections running.
            %No SSHv2 server connections running.

            Thiết bị báo như trên là do ko có phiên telnet tới ạ . Khi em chạy ssh client thì có hiện ra những dòng thông báo như ví dụ của anh .

            Em sẽ kiểm tra lại kết quả với triple A . Khó khăn còn lại là lệnh cryto key..Trong secureCRT có SSH ver 1 với ISA , khi mình bắt đầu kết nối thì nhân được thông báo là phải có thêm public key . Em chưa rõ cái này có tác dụng gì
            có phải là key này do mình tạo và được truyền trong quá trính mã hoá ko anh ?

            Comment


            • #7
              vậy em muốn đặt username và passwork cho SSH thì phải làm sao?

              Comment

              Working...
              X