Mô tả:
Tổng hợp đầy đủ các câu lệnh dành cho cấu hình mạng căn bản.
OSPF
R(config)# router ospf [process – id] (chọn 1) [1 – 65.535]
R(config – router)# network (ip tham chiếu) (wildcard) (area – id) (chọn 0)
Hiệu chỉnh router – id:
Show OSPF
R(config – router)# router – id A.B.C.D
R# show ip ospf interface
R# clear ip ospf process => yes
R# show ip ospf neighbor
Hiệu chỉnh gói tin hello – dead timer:
R(config – if)# ip ospf hello – internal (giá trị timer)
R(config – if)# ip ospf dead – internal (giá trị timer)
Hiệu chỉnh priority – bandwidth – cost:
R(config – if)# ip ospf priority (giá trị priority)
R(config – if)# bandwidth (giá trị bps)
Hiệu chỉnh Router route:
R(config – if)# ip ospf cost (giá trị cost)
R(config)# default – information originate
Xác thực trên cổng:
R(config – if)# ip ospf authentication [null / message – digsest]
(clear text) # ip ospf authentication (– key)
(mã md5) # ip ospf message – digsest (– key) md5 (pass)
STP: SPANNING – TREE PROTOCOL
SW(config)# spanning – tree vlan (n) root [primary / secondary]
SW(config)# spanning – tree vlan (n) priority (giá trị priority 4096)
Hiệu chỉnh up nhanh cổng: (các port của SW trừ đường trunk)
SW(config – if)# switchport mode access
Show STP
SW(config – if)# spanning – tree port fast default
SW# show spanning – tree vlan (n)
VLAN – TRUNKING
Show VLAN
SW(config)# vlan (n) [1 – 1001]
SW# show vlan
SW(config – vlan)# name (tên) (dùng tên để nhớ vlan)
SW# show interface trunk
SW(config)# interface f0/1 (nếu chọn cổng từ 1 – 5: # interface range f0/1 – 5)
SW(config – if)# switchport mode access
SW(config – if)# switchport access vlan (n) (gán cổng vào vlan)
Đặt trunk cho cổng – default native vlan:
SW3500(config – if)# switchport trunk encapsulation [dot1Q / ISL]
SW3500(config – if)# switchport mode trunk {access / trunk / desinable / auto}
- Không đánh bất kì thông tin nào vào.
- Liên lạc được với các switch ko hiểu vlan.
Show Port – Security
- Cổng nào chọn làm vlan thì ko thấy được nữa
R# show port – security address
Tắt thương lượng trunk trên cổng:
R#show port interface (f number)
SW(config – if)# support nonegotiation (cần thiết)
R#show mac – address
VTP – Vlan Trunking Protocol:
Show VTP
SW(config)# vtp domain VNPro
SW# show vtp status
SW(config)# vtp password cisco
SW(config)# vtp mode [server / transparent / client]
Tạo sub – interface: (no shut trên cổng chính)
R(config)# interface f0/0.1
R(config – subif)# encapsulation [dot1Q / ISL] (map vào vlan1)
R(config – subif)# ip address 192.168.1.254 255.255.255.0
Không gửi thông tin vlan ra các cổng không cần thiết:
SWServer(config – if)# vtp prunning (native vlan dot1Q / ISL)
SWServer(config – if)# switchport trunk native vlan 99 (vào cổng chạy đường trunk)
Nếu chưa đồng bộ thông tin vlan thì tạo vlan xóa vlan 1 lần.
DHCP
R1(config)# ip dhcp pool ABC
R1(config – dhcp)# network 192.168.1.0 255.255.255.0
R1(config – dhcp)# default – router 192.168.1.254
R1(config – dhcp)# dns – server 8.8.8.8 8.8.4.4
R1(config – dhcp)# lease 0 1 0 (ngày) (giờ) (phút) (thời gian cấp)
R1(config)# ip dhcp excluted – address 192.168.1.1 192.168.1.5 (bỏ cấp ip 1 – 5)
Gán cho PC:
R(config)# ip dhcp pool ABC
R(config – dhcp)# network 192.168.1.0 255.255.255.0
R(config – dhcp)# host 192.168.1.10 255.255.255.0
R(config – dhcp)# default – router 192.168.1.254
R(config – dhcp)# dns – server 8.8.8.8 8.8.4.4
R(config – dhcp)# lease (ngày) (giờ) (phút)
R(config – dhcp)# client – identifier (MAC: 01AA.BBCC.DDEE.FF)
Xin cấp IP từ server DHCP:
R(config – if)# ip address dhcp
(chỉ đánh trên Router biên)
R(config)# default information originate
DHCP Relay Agent:
Nhập R2 cấu hình như R, vào cổng 192.168.1.254 của R1 nhập
R1(config – if)# ip helper – address 192.168.12.2 (ip đối diện để hổ trợ cho PC1)
NAT
R(config)# access – list 1 permit any
R(config)# ip nat inside source list 1 interface f0/1 overload
R(config)# interface f0/1
(đầu ra)
Show NAT
R(config – if)# ip nat outsie
R# show ip nat translation
R(config)# interface f0/0
(đầu vào)
R# clear ip nat translation
R(config – if)# ip nat inside (tất cả các cổng phụ bên trong)
Dạng static NAT:
R(config)# ip nat inside source static 192.168.1.1 200.0.0.1
Dạng dynamic NAT:
R(config)# access – list 1 permit 192.168.1.0 0.0.0.7
R(config)# ip nat pool ABC 200.0.0.1 200.0.0.6 (subnetmask / prefix – length 24)
BASIC CONFIGURATION
R(config)# hostname (name)
(tên Router)
Show
R(config)# banner motd #banner# (tên Banner)
R# show running – config
R(config)# no ip domain – lookup (chống router tìm DNS) R# show ip interface brief
R(config)# line console 0
(chống trôi dòng lệnh)
R# show version
R(config – line)# logging synchronous
R(config – line)# password (pass) (đặt pass cho console)
R# show ip protocols
R(config – line)# login
R(config)# enable password (pass) (đặt pass cho enable)
R(config)# enable secret (pass)
(mã hóa MD5)
R(config)# service password – encryption (mã hóa MD7)
Đặt IP – Mô tả đầu nối interface:
Tạo Card Loopback:
R(config)# interface (f/s) (number)
R(config)# interface loopback (number)
R(config – if)# ip address (ip) (subnetmask)
R(config – if)# ip address (ip) (subnetmask)
R(config – if)# no shutdown
R(config – if)# no shutdown
R(config – if)# description (nội dung mô tả)
Chọn nhiều cổng cùng lúc:
R(config)# interface range f0/1 – 24
PORT SECURITY
SW(config – if)# switchport mode access (thêm bảo mật cho cổng đang chọn)
SW(config – if)# switchport port – security
SW(config – if)# switchport port – security maximum 1
SW(config – if)# switchport port – security mac – address [sticky / MAC]
SW(config – if)# switchport port – security violation [shutdown / restric / protect] (3 trạng thái)
TELNET (password)
R(config)# line vty 0 4
SW((config)# line vty 0 15
R(config – line)# password (pass)
SW(config – line)# password (pass)
R(config – line)# login
SW(config – line)# login
TELNET (không password)
R(config)# line vty 0 4
SW((config)# line vty 0 15
R(config – line)# privilege level 15
SW(config – line)# privilege level 15
R(config – line)# no login
SW(config – line)# no login
SSH
Show CDP
R(config)# username (name) password (pass)
R# show cdp neighbors (detail)
R(config)# ip domain – name vnpro.org
R# show cdp entry *
R(config)# crypto – key generate rsa
[512]:1024
(kích hoạt thuật toán mã hóa RSA)
Tắt CDP
R(config)# ip ssh version 2
R(config)# (no) cdp run
R(config)# line vty 0 4
R(config – if)# (no) cdp enable
R(config – line)# transport input ssh telnet (chọn cả 2 giao thức)
R(config – line)# login local
Đăng nhập SSH:
Show SSH
R(config)# ssh – l (username) –v 2 (địa chỉ ip)
R# show ssh
STATIC ROUTE
Show IP
R(config)# ip route (network) (subnetmask)
R# show ip route
[interfacera / ip đối diện]
R# show ip route (static / rip / eigrp / ospf )
Default Route:
R* 0.0.0.0/0 via 10.215.145.149
R(config)# ip route 0.0.0.0 0.0.0.0 (f number)
(trong bảng định tuyến ra internet)
RIP
Tắt chuyển thông tin RIP:
R(config)# router rip
R(config)# router rip
R(config – router)# version 2
R(config – router)# passive – interface (f number)
R(config – router)# network (major)
R(config – router)# no auto – summary
R# debug ip rip (un all)
EIGRP
Show EIGRP
R(config)# router eigrp (số AS) (giống nhau)
R# show ip route EIGRP
R(config – router)# network (major netwok)
R# show ip protocols
R(config – router)# no auto – summary
R# show EIGRP interfaces
R# debug ip eigrp(un all)
R# show ip EIGRP neighbors (detail)
Load Balancing:
R# show ip EIGRP topology (all)
R(config)# router eigrp (số AS)
R# show ip EIGRP traffic
R(config – router)# variance (multiplier)
Stub:
R(config – router)# maximum – path (số đường) [0 – 16]
R(config)# router eigrp (số AS)
Default Route EIGRP: (Router biên)
R(config – router)# eigrp stub
R(config – if)#ip summary – address eigrp (số AS) 0.0.0.0 0.0.0.0
EIGRP Authentication MD5 (xác thực md5)
R(config)# key chain (name) (tên chìa)
R(config – keychain)# key (key-id) (số chìa)
R(config – keychain – key)# key – string (text / pass)
R(config – if)# ip authentication key-chain eigrp (số AS) (name)
R(config – if)# ip authentication mode eigrp (số AS) md5
Lưu cấu hình
Xóa cấu hình
R# copy running – config starup – config
R# erase starup – config
R# write memory
R# reload
CRACK Router: (khởi động lại) (Ctrl + Break)
R# confreg 0x2142 reset
Port
21
22
23
24
25
53
56
69
80
109
110
115
118
161
213
218
220
443
520
646
674
706
753
1293
1701
5050
Application
PING
FTP
SSH
TELNET
MAIL
SMTP
DNS
RAP
TFTP
HTTP
POP2
POP3
SFTP
SQL
SNMP
IPX
MPP
IMAP
HTTPS
EIGRP
OSPF
RIP
MPLS
ACAP
SILC
RRH
IPSec
VPN
YAHOO
Describtion
File Transfer Protocol
Secure Shell
Simple Mail Transfer Protocol
Domain Name System
Route Access Protocol
Trivial File Transfer Protocol
Hypertext Transfer Protocol
Post Office Protocol
Post Office Protocol
Simple File Transfer Protocol
Structured Query Language
Simple Network Management Protocol
Internetwork Packet Exchange
Message Posting Protocol
Internet Message Access Protocol
Hypertext Transfer Protocol over SSL/TLS
Enhanced Interior Gateway Routing Protocol
Open Shortest Path First
Routing Information Protocol
Multi Protocol Label Switching
Application Configuration Access Protocol
Secure Internet Live Conferencing
Reverse Routing Header
Internet Protocol Security
Transport Layer
ICMP
TCP
TCP
TCP
TCP
UDP
TCP
TCP
UDP
TCP
UDP
UDP
TCP
TCP
TCP
TCP
TCP
UDP
UDP
TCP
UDP
TCP
UDP
TCP
UDP
TCP
TCP
TCP
TCP
TCP
TCP
TCP
UDP
UDP
UDP
UDP
AD
90
110
120
ACCESS CONTROL LIST
Dạng standard: (dựa vào S.IP)
(chặn càng gần đích càng tốt)
R(config)# access – list (n) {permit / deny} (ip tham chiếu) (wildcard)
(n từ 1 – 99)
R(config)# access – list (n) permit any
R(config – if)# ip access group (n) {in / out}
Dạng name: (số thứ tự cho dòng, tăng 10 dòng)
(chặn càng gần đích càng tốt)
R(config)# ip access – list standard (name) ABC
R(config – std – nacl)# (số thứ tự dòng sequence) {permit / deny} (ip tham chiếu) (wildcard)
R(config – if)# ip access group (name) ABC {in / out}
Dạng extended: (dựa vào S.IP – D.IP – S.Port – D.Port) (chặn càng gần nguồn càng tốt)
R(config)# access – list (n) {permit / deny} (protocol) S.IP (wildcard) (eq S.P) D.IP (wildcard) (eq D.P)
R(config – if)# ip access group (n) {in / out}
Dạng name:
R(config)# ip access – list extended (name) ABC
R(config – ext – nacl)# (số thứ tự dòng sequence) {permit / deny}
Cấm Telnet:
(trên Router được cấm)
R(config)# access – list (n) {permit / deny} (ip tham chiếu) (wildcard)
R(config)# access – list (n) permit any
R(config)# line vty 0 4
(cổng ảo)
R(config – line)# access – class (n) {in / out} in
Cấm Ping đến Server:
R(config)# access – list (n) deny icmp (ip tham chiếu) (wildcard) (server) 0.0.0.0
R(config)# access – list (n) permit any
R(config)# interface s0/0/0
R(config – if)# ip access group (n) {in / out} out
Server ping Host:
R(config)# access – list (n) deny icmp 1.0.0.0 0.0.0.255 host (server) echo
R(config)# access – list (n) permit any
CẤU HÌNH TRÊN FRAME-RELAY
Fr(config)# frame-relay switching
Fr(config)# int S1
Fr(config-if)# encapsulation frame-relay
Fr(config-if)# frame-relay intf-type dce
Fr(config-if)# frame-relay route 102 interface S2 201
Fr(config-if)# frame-relay route 103 interface S3 301
Fr(config)# int S2
Fr(config)# encapsulation frame-relay
Fr(config-if)# frame-relay intf-type dce
Fr(config-if)# frame-relay route 201 interface S1 102
Fr(config)# int S3
Fr(config)# encapsulation frame-relay
Fr(config-if)# frame-relay intf-type dce
Fr(config-if)# frame-relay route 301 interface S1 103
CẤU HÌNH TRÊN CÁC ROUTER
POINT – TO – POINT:
R1:
R1(config)# interface S0
R1(config-if)# encapsulation frame-relay
R1(config-if)# interface S0.2 point-to-point
R1(config-if)# ip address 192.168.12.1 255.255.255.0
R1(config-if)# frame-relay interface-dlci 102
R1(config-if)# interface S0.3 point-to-point
R1(config-if)# ip address 192.168.13.1 255.255.255.0
R1(config-if)# frame-relay interface-dlci 103
R2:
R2(config)# interface S0
R2(config-if)# encapsulation frame-relay
R1(config-if)# ip address 192.168.12.2 255.255.255.0
R3:
R2(config)# interface S0
R2(config-if)# encapsulation frame-relay
R1(config-if)# ip address 192.168.13.2 255.255.255.0
MULTIPOINT:
R1:
R1(config)# interface S0
R1(config-if)# encapsulation frame-relay
R1(config-if)# interface S0.100 multipoint
R1(config-if)# ip address 192.168.123.1 255.255.255.0
R1(config-if)# frame-relay map ip 192.168.123.2 102 broadcast
R1(config-if)# frame-relay map ip 192.168.123.3 103 broadcast
R2:
R2(config)# interface S0
R2(config-if)# ip address 192.168.123.2 255.255.255.0
R2(config-if)# frame-relay map ip 192.168.123.1 201 broadcast
R3:
R3(config)# interface S0
R3(config-if)# ip address 192.168.123.2 255.255.255.0
R3(config-if)# frame-relay map ip 192.168.123.1 301 broadcast
Muốn R2 ping R3, ta phải map trên R2, R3 để có thể thấy nhau:
R2(config)# interface S0
R2(config-if)# frame-relay map ip 192.168.123.3 201 broadcast
R3(config)# interface S0
R3(config-if)# frame-relay map ip 192.168.123.2 301 broadcast
20 = 1
21 = 2
22 = 4
23 = 8
24 = 16
25 = 32
26 = 64
Luỹ thừa 2
27 = 128
28 = 256
29 = 512
210 = 1024
211 = 2048
212 = 4096
216 = 65536
00000000
10000000
11000000
11100000
11110000
11111000
11111100
11111110
11111111
7
2
27+26
27+26+25
27+26+25+24
27+26+25+24+23
27+26+25+24+23+22
27+26+25+24+23+22+21
27+26+25+24+23+22+21+20
Số bit mượn = n
Bước nhảy = 28–n
Bandwidth
10 Mbps
100 Mbps
1 Gbps
10 Gbps
Cost
100
19
4
2
1
2 3 4
128 64 32 16
5
8
0
128
192
224
240
248
252
254
255
6
4
7
2
8
1
- Xem thêm -