Cách cấu hình router

  • Cisco
  • Networking
  • Series CCNA

Lệnh cấu hình router Cisco

Bởi
Nguyen Trung Thien
-
01/07/2019
0
1710

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
Đị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
Xác định file local host trong unix, kiểu như: /etc/hosts in unixRouter[config]#ip host mypc 10.1.1.3
Vô hiệu hóa Disables DNS lookup. Hữu ích khi lệnh bị gõ lỗi.Router[config]#no ip domain-lookup
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
Thiết lập physical clockRouter[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
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
Đị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ỉ la 10.x.x.x. Enables RIP version 2: Bật RIP v2Router[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
Thiết lập config register: Chỉ định việc router sẽ làm khi nó khởi động.Router[config]#config-register 0x2102
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
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
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
Thiết lập chuẩn ACL. Chuẩn này sử dụng số từ 1 đến 99.Router[config]#access-list 1 permit 172.16.1.1
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 RIPngRouter[config]#ipv6 unicast-routing Router[config]#ipv6 router rip ccna Router[config]#int s0/0/0 Router[config-if]#ipv6 rip ccna enable

Các lệnh đặc quyền [Privilege Commands], lệnh show trên Router

Yêu cầu

Lệnh Cisco

Vào chế độ đặc quyền

enable

Trở về user mode từ privileged

disable

Thoát router

logout/exit/quit

Xem phiên bản router

Router#show version

Xem cấu hình hiện tại [DRAM]

Router#show running-config

Xem cấu hình startup [NVRAM]

Router#show startup-config

Xem dung lượng file IOS, flash

Router#show flash

Xem tất cả log router ghi lại.

Router#show log

Xem trạng thái interface của interface e0

Router#show interface e0

Displays the interface operational status and IP addresses for all router interfaces: Xem trạng thái hoạt động của interface và địa chỉ IP cho tất cả các interface router.

Router#show ip interface brief

Xem kiểu cáp trên s0

Router#show controllers 0

Xem các thiết bị cdp đã kết nối

Router#show cdp neighbor

Xem thông tin chi tiết trên tất cả các thiết bị

Router#show cdp entry *

Displays all the configured routing protocols: Xem tất cả các giao thức định tuyến đã được cấu hình.

Router#show ip protocols

Displays the IP routeing table: Hiển thị bảng định tuyến IP.

Router#show ip route

Hiển thị access list

Router#show access-lists

Xem router nào thấy được switch ISDN

Router#show isdn status

Displays the NAT translations: Xem các NET translation.

Router#show ip nat translations

Xem cấu hình cáp vật lý:

DTE/DCE, x.21, V.35,

RS232

Router#show controllers s 0

Displays the end-to-end status: Hiển thị trạng thái end-to-end

Router#show frame-relay pvc

Displays the type of LMI and the number LMI frames: Xem kiểu LMI và số khung LMI.

Router#show frame-relay lmi

Displays the frame relay inverse ARP table: Hiện thị bảng frame relay inverse ARP.

Router#show frame-relay map

Xem danh sách ospf neighbor và trạng thái của chúng

Router#show ip ospf neighbor

Xem trạng thái interface ospf.

Router#show ip ospf interface

Xem danh sách eigrp neighbor và trạng thái của chúng.

Router#show ip eigrp neighbor

Xem trạng thái interface EIGRP.

Router#show ip eigrp interface

Xem tất cả trunk port trên thiết bị

Router#show interface trunk

ping IPv6

Router#ping 2000:1000:500:3::1

Lệnh copy trên router Cisco

Yêu cầu

Lệnh Cisco

Lưu cấu hình hiện tại từ DRAM vào NVRAM

copy running-config startup-config

Hợp nhất cấu hình NVRAM vào DRAM

copy startup-config running-config

Sao chép cấu hình DRAM vào TFTP server

copy runing-config tftp

Hợp nhất cấu hình TFTP với cấu hình router hiện tại lưu trên DRAM

copy tftp runing-config

Sao lưu IOS lên TFTP server

copy flash tftp

Nâng cấp router IOS từ TFTP server

copy tftp flash

Lệnh debug trên router Cisco

Yêu cầu

Lệnh Cisco

Bật debug cho RIP

debug ip rip

Xem thông tin debug IGRP tóm tắt

debug ip igrp events

Xem thông tin debug IGRP chi tiết

debug ip igrp transactions

Debug IPX RIP

debug ipx routing activity

Debug IPX SAP

debug IPX SAP

Bật debug cho CHAP hoặc PAP

debug ppp authentication

Tắt tất cả debug

no debug all

undebug all

VỚIQuantrimang
  • TAGS
  • cisco
Bài trướcLệnh cấu hình switch CISCO
Bài tiếp theoTìm hiểu định dạng OVA và OVF trên vmware workstation
//trungthienit.com/
Tôi là Nguyễn Trung Thiện, với mục đích lập website là chia sẽ kinh nghiệm cũng như đúc kết kiến thức của bản thân mình đã học và chia sẽ đến mọi người cùng biết, với Phương châm " Chia sẽ kinh nghiệm - Chạm để cảm nhận ". Certifation: MCSA, MCSE, CEH, CCNA_R & S, CCNA_VOICE, VMWARE VSPHERE , LPI, Troubleshotting.

Video liên quan

Chủ Đề