Các lệnh thông dụng cấu hình Router Cisco Set a console password to cisco (Đặt mật khẩu console là cisco). Router(config)#line con 0 Router(config-line)#login Router(config-line)#password cisco Set a telnet password (Đặt mật khẩu telnet). Router(config)#line vty 0 4 Router(config-line)#login Router(config-line)#password cisco Stop console timing out (Console không bị log off). Router(config)#line con 0 Router(config-line)#exec-timeout 0 0 Set the enable password to cisco (Đặt mật khẩu enable là cisco). Router(config)#enable password cisco Set the enable secret password to peter (Đặt mật khẩu secret là peter. Mật khẩu này ghi đè lên mật khẩu enable và được mã hóa trong file cấu hình). Router(config)#enable secret peter Enable an interface (Bật interface). Router(config-if)#no shutdown To disable an interface (Tắt interface). Router(config-if)#shutdown Set the clock rate for a router with a DCE cable to 64K (Đặt clock rate cho router với cáp DCE là 64000). Router(config-if)#clock rate 64000 Set a logical bandwidth assignment of 64K to the serial interface (Gán băng thông logic cho serial interface). Router(config-if)#bandwidth 64 To add an IP address to a interface (Thêm IP cho interface). Router(config-if)#ip addr 10.1.1.1 255.255.255.0 To enable RIP on all 172.16.x.y interfaces (Bật RIP trên tất cả interface 172.16.x.y). Router(config)#router rip Router(config-router)#network 172.16.0.0 Disable RIP (Tắt RIP). Router(config)#no router rip To enable IRGP with a AS of 200, to all interfaces (Bật IRGP với AS 200 cho tất cả interface). Router(config)#router igrp 200 Router(config-router)#network 172.16.0.0 Disable IGRP (Tắt IGRP). Router(config)#no router igrp 200 Static Routing (Định tuyến tĩnh remote network là 172.16.1.0, với mask là 255.255.255.0, next hop là 172.16.2.1, với cost là 5 hop). Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.2.1 5 Disable CDP for the whole router (Tắt CDP cho cả router). Router(config)#no cdp run Enable CDP for the whole router (Bật CDP cho cả router). Router(config)#cdp run Disable CDP on an interface (Tắt CDP trên interface). Router(config-if)#no cdp enable Enable the http server to SDM can be used (Bật http server để dùng SDM). Router(config)#ip http server Defines a username and password (Đặt username (sue) và mật khẩu (cisco). Có thể dùng để xác thực PPP hoặc truy cập của người dùng). Router(config)#username sue password cisco Ip host (Xác định file local host trong unix, kiểu như: /etc/hosts in unix) Router(config)#ip host mypc 10.1.1.3 Disables DNS lookup (Vô hiệu hóa Disables DNS lookup. Hữu ích khi lệnh bị gõ lỗi). Router(config)#no ip domain-lookup Set Bandwidth (Thiết lập băng thông logic (không phải vật lý) cho interface. Thường được sử dụng bởi các giao thức định tuyến, truy vấn SNMP). Router(config)#int s0 Router(config-if)#bandwidth Set Clock (Thiết lập physical clock) Router(config-if)#clock rate 64000 Set the serial interface WAN encapsulation (Ngoài hdlc còn có tùy chọn khác là PPP và frame-relay). Router(config-if)#encapsulation hdlc Authentication on PPP is optional (Xác thực trên PPP là tùy chọn. Lệnh này bật chap trên interface, tùy chọn khác là PAP). Router(config-if)#ppp authentication chap Set LMI type (Chọn kiểu LMI. Nếu kiểu LMI không được cấu hình đúng nó sẽ được phát hiện tự động). Router(config-if)#frame-relay lmi-type cisco Static Routing (Định tuyến tĩnh. Kiểu định tuyến tĩnh có Administrative Distance (AD) là 1, do đó nó sẽ ghi đè lên bất kỳ định tuyến động nào). Router(config)#ip route 50.0.0.0 255.0.0.0 10.1.2.1 Enables RIP version 1 on all LOCAL interfaces which have a 10.x.x.x address (Bật RIP v1 trên tất cả LOCAL interfaces có địa chỉ là 10.x.x.x). Enables RIP version 2 (Bật RIP v2) Router(config)#router rip Router(config-router)#network 10.0.0.0 Router(config-router)#version 2 Enable the router to provide a DHCP service (Thiết lập DHCP trên router). Router(config)#ip dhcp pool MYPOOL Router(dhcp-config)#network 10.1.1.0 255.255.255.0 Router(dhcp-config)#default-router 10.1.1.1 Router(dhcp-config)#exit Router(config)#ip dhcp excluded-address 10.1.1.1 10.1.1.99 Set config register (Chỉ định việc router sẽ làm khi nó khởi động). Router(config)#config-register 0x2102 Sub interface and encapsulation (Tạo sub logic interface dưới physical interface. Kích hoạt 802.1q trunking trên interface. Đặt địa chỉ IP). Router(config)#int fa0/0.1 Router(config-subif)#encapsulation dot1Q 1 Router(config-subif)#ip address 10.1.1.1 255.255.255.0 Set OSPF (Bật OSPF trên bất kỳ local interface nào bắt đầu bằng địa chỉ IP 10.1.x.x). Router(config)#router ospf 1 Router(config-router)#network 10.1.0.0 0.0.255.255 area 0 Set EIGRP (EIGRP có thể cấu hình giống với RIP hoặc sử dụng tùy chọn mask). Router(config)#router eigrp 1 Router(config-router)#network 172.16.0.0 or Router(config-router)#network 172.16.2.0 0.0.0.255 Config ACL (Thiết lập ACL chuẩn. Chuẩn này sử dụng số từ 1 đến 99). Router(config)#access-list 1 permit 172.16.1.1 Config ACL extend (Thiết lập Extended ACL. Địa chỉ đầu tiên là địa chỉ IP nguồn). Router(config)#access-list 101 deny tcp host 172.16.1.1 host 172.16.2.1 eq telnet Router(config)#access-list 101 permit ip any any Use the group command to attach an ACL to an interface (Sử dụng lệnh group để gắn ACL vào interface). Router(config)#interface fa0/0 Router(config-if)#ip access-group 1 out Ví dụ: về sử dụng tên ACL thay vì số. Router(config)#ip access-list extended my_list Router(config-ext-nacl)# deny tcp host 172.16.1.1 host 172.16.2.1 eq ftp Router(config-ext-nacl)# permit ip any any Gán ACL cho interface bằng tên. Router(config)#int fa0/0 Router(config-if)#ip access-group my_list in Configuring a static NAT to allow a server to be access via the Internet, using the IP address on interface s0/0/1 (Cấu hình NAT tĩnh để cho phép truy cập server qua Internet, sử dụng địa chỉ IP trên interface s0/0/1). Router(config)#ip nat inside source static 10.1.1.2 interface s0/0/1 Defining interface which NAT takes place between (Xác định interface mà NAT xảy ra). Router(config)#int fa0/0.1 Router(config-if)#ip nat inside Enables RIPng (Bật RIPng) Router(config)#ipv6 unicast-routing Router(config)#ipv6 router rip ccna Router(config)#int s0/0/0 Router(config-if)#ipv6 rip ccna enable Chi tiết: Tổng hợp các lệnh căn bản (CLI) khi làm việc với thiết bị mạng Cisco (Switch Cisco, Router Cisco)